I have created a web dynamic project Struts2Starter
and for Target runtime, web container is Apache Tomcat 7.
When I run this project, it gives an error:
The requested resource(/Struts2Starter/) is not available
Here's the path:
Webb folder elements/files/contents deployed and in Deployed Resources folder:
Code snippets:
struts.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" extends="default">
<action name="getTutorial" class="TutorialAction">
<result name="success">/success.jsp</result>
<result name="failure">/error.jsp</result>
</action>
</package>
</struts>
web.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>Struts2Starter</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
error.jsp
:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Error Page!
</body>
</html>
success.jsp
:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Success Page!
</body>
</html>
However, when I am running other web projects they run fine. I had given welcome file in web.xml
. I removed it later because I did not need it.
I tried running:
http://localhost:8083/Struts2Starter/
http://localhost:8083/Struts2Starter/TutorialAction
http://localhost:8083/Struts2Starter/TutorialAction.action
Same error for all as compiler does not find project available.
Project is built. Port is 8083 and not 8080, as 8080 is already used for some service. However, as i mentioned earlier, other web projects are running fine with Apache 7, using 8083. In Deployment Assembly for project, i had mapped my user Library "Struts2" (shown in project explorer image above) to Deploy Path "WEB-INF/lib".
I am not able to figure out why project is not running, any suggestions? I have referred other threads with similar issue, but most of them are for servlets and i am not doing any servlet mapping and instead using filter.
Error Snapshot: