You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ssmtpmailtesting ssmtpmailtesting <ss...@gmail.com> on 2018/06/30 11:53:33 UTC
http://mybox:8080/struts/hello.action gets HTTP Status 404 - Not Found
tree .
.
├── pom.xml
├── src
│ └── main
│ ├── java
│ │ └── com
│ │ └── actions
│ │ ├── HelloWorldAction.java
│ │ └── MessageStore.java
│ ├── resources
│ │ └── struts.xml
│ └── webapp
│ ├── HelloWorld.jsp
│ ├── index.jsp
│ └── WEB-INF
│ └── web.xml
└── target
├── classes
│ └── struts.xml
└── maven-status
└── maven-compiler-plugin
└── compile
└── default-compile
14 directories, 8 files
I'm following this:
https://struts.apache.org/getting-started/hello-world-using-struts2.html
struts.xml =>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="basicstruts2" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
web.xml =>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
package com.actions;
import com.actions.MessageStore;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorldAction extends ActionSupport {
private MessageStore messageStore;
public String execute() {
messageStore = new MessageStore() ;
return SUCCESS;
}
public MessageStore getMessageStore() {
return messageStore;
}
}
package com.actions;
public class MessageStore {
private String message;
public MessageStore() {
message = "Hello Struts User";
}
public String getMessage() {
return message;
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.actions</groupId>
<artifactId>struts</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>struts Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.5.16</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>struts</finalName>
</build>
</project>
Why am I getting this error? How can I solve it?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: http://mybox:8080/struts/hello.action gets HTTP Status 404 - Not Found
Posted by ssmtpmailtesting ssmtpmailtesting <ss...@gmail.com>.
I solved the problem, this is web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="MyStrutsApp" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Archetype Created Web Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
On Sat, Jun 30, 2018 at 7:52 PM, Dave Newton <da...@gmail.com> wrote:
> That means you're hitting a JSP page with S2 tags without having run
> through an S2 request process, e.g., hitting a JSP page directly.
>
> On Sat, Jun 30, 2018 at 9:14 AM ssmtpmailtesting ssmtpmailtesting <
> ssmtpmailtesting@gmail.com> wrote:
>
>> struts.xml =>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE struts PUBLIC
>> "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
>> "http://struts.apache.org/dtds/struts-2.5.dtd">
>> <struts>
>> <constant name="struts.devMode" value="true" />
>>
>> <package name="com.actions" extends="struts-default">
>> <action name="index">
>> <result>/index.jsp</result>
>> </action>
>>
>> <action name="hello" class="com.actions.HelloWorldAction"
>> method="execute">
>> <result name="success">/HelloWorld.jsp</result>
>> </action>
>> </package>
>> </struts>
>>
>>
>> web.xml
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE struts PUBLIC
>> "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
>> "http://struts.apache.org/dtds/struts-2.5.dtd">
>> <struts>
>> <constant name="struts.devMode" value="true" />
>>
>> <package name="com.actions" extends="struts-default">
>> <action name="index">
>> <result>/index.jsp</result>
>> </action>
>>
>> <action name="hello" class="com.actions.HelloWorldAction"
>> method="execute">
>> <result name="success">/HelloWorld.jsp</result>
>> </action>
>> </package>
>> </struts>
>>
>> Still I get error for http://mybox:8080/struts/
>>
>> HTTP Status 500 - Internal Server Error
>>
>> ________________________________
>>
>> type Exception report
>>
>> messageInternal Server Error
>>
>> descriptionThe server encountered an internal error that prevented it
>> from fulfilling this request.
>>
>> exception
>>
>> org.apache.jasper.JasperException: The Struts dispatcher cannot be
>> found. This is usually caused by using Struts tags without the
>> associated filter. Struts tags are only usable when the request has
>> passed through its servlet filter, which initializes the Struts
>> dispatcher needed for this tag. - [unknown location]
>>
>> root cause
>>
>> The Struts dispatcher cannot be found. This is usually caused by
>> using Struts tags without the associated filter. Struts tags are only
>> usable when the request has passed through its servlet filter, which
>>
>>
>>
>> and same error for http://mybox:8080/struts/hello.action
>>
>> On Sat, Jun 30, 2018 at 6:43 PM, Yasser Zamani <ya...@apache.org>
>> wrote:
>> >
>> >
>> > On 6/30/2018 4:23 PM, ssmtpmailtesting ssmtpmailtesting wrote:
>> >> web.xml =>
>> >>
>> >> <!DOCTYPE web-app PUBLIC
>> >> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>> >> "http://java.sun.com/dtd/web-app_2_3.dtd" >
>> >>
>> >> <web-app>
>> >> <display-name>Archetype Created Web Application</display-name>
>> >> <filter>
>> >> <filter-name>struts2</filter-name>
>> >> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
>> >> </filter-class>
>> >
>> > The maven pom.xml is using Struts 2.5.16 but web.xml is using Struts
>> > 2.3.x either DTD and filter. The FilterDispatcher is used in the early
>> > Struts2 development, and it’s deprecated since Struts 2.1.3. it’s always
>> > recommended to upgrade the new filter class –
>> StrutsPrepareAndExecuteFilter.
>> >
>> > Regards.
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>> --
> e: davelnewton@gmail.com
> m: 908-380-8699
> s: davelnewton_skype
> t: @dave_newton <https://twitter.com/dave_newton>
> b: Bucky Bits <http://buckybits.blogspot.com/>
> g: davelnewton <https://github.com/davelnewton>
> so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: http://mybox:8080/struts/hello.action gets HTTP Status 404 - Not Found
Posted by Dave Newton <da...@gmail.com>.
That means you're hitting a JSP page with S2 tags without having run
through an S2 request process, e.g., hitting a JSP page directly.
On Sat, Jun 30, 2018 at 9:14 AM ssmtpmailtesting ssmtpmailtesting <
ssmtpmailtesting@gmail.com> wrote:
> struts.xml =>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE struts PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
> "http://struts.apache.org/dtds/struts-2.5.dtd">
> <struts>
> <constant name="struts.devMode" value="true" />
>
> <package name="com.actions" extends="struts-default">
> <action name="index">
> <result>/index.jsp</result>
> </action>
>
> <action name="hello" class="com.actions.HelloWorldAction"
> method="execute">
> <result name="success">/HelloWorld.jsp</result>
> </action>
> </package>
> </struts>
>
>
> web.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE struts PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
> "http://struts.apache.org/dtds/struts-2.5.dtd">
> <struts>
> <constant name="struts.devMode" value="true" />
>
> <package name="com.actions" extends="struts-default">
> <action name="index">
> <result>/index.jsp</result>
> </action>
>
> <action name="hello" class="com.actions.HelloWorldAction"
> method="execute">
> <result name="success">/HelloWorld.jsp</result>
> </action>
> </package>
> </struts>
>
> Still I get error for http://mybox:8080/struts/
>
> HTTP Status 500 - Internal Server Error
>
> ________________________________
>
> type Exception report
>
> messageInternal Server Error
>
> descriptionThe server encountered an internal error that prevented it
> from fulfilling this request.
>
> exception
>
> org.apache.jasper.JasperException: The Struts dispatcher cannot be
> found. This is usually caused by using Struts tags without the
> associated filter. Struts tags are only usable when the request has
> passed through its servlet filter, which initializes the Struts
> dispatcher needed for this tag. - [unknown location]
>
> root cause
>
> The Struts dispatcher cannot be found. This is usually caused by
> using Struts tags without the associated filter. Struts tags are only
> usable when the request has passed through its servlet filter, which
>
>
>
> and same error for http://mybox:8080/struts/hello.action
>
> On Sat, Jun 30, 2018 at 6:43 PM, Yasser Zamani <ya...@apache.org>
> wrote:
> >
> >
> > On 6/30/2018 4:23 PM, ssmtpmailtesting ssmtpmailtesting wrote:
> >> web.xml =>
> >>
> >> <!DOCTYPE web-app PUBLIC
> >> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> >> "http://java.sun.com/dtd/web-app_2_3.dtd" >
> >>
> >> <web-app>
> >> <display-name>Archetype Created Web Application</display-name>
> >> <filter>
> >> <filter-name>struts2</filter-name>
> >> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
> >> </filter-class>
> >
> > The maven pom.xml is using Struts 2.5.16 but web.xml is using Struts
> > 2.3.x either DTD and filter. The FilterDispatcher is used in the early
> > Struts2 development, and it’s deprecated since Struts 2.1.3. it’s always
> > recommended to upgrade the new filter class –
> StrutsPrepareAndExecuteFilter.
> >
> > Regards.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> --
e: davelnewton@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
Re: http://mybox:8080/struts/hello.action gets HTTP Status 404 - Not Found
Posted by ssmtpmailtesting ssmtpmailtesting <ss...@gmail.com>.
struts.xml =>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="com.actions" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="com.actions" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
Still I get error for http://mybox:8080/struts/
HTTP Status 500 - Internal Server Error
________________________________
type Exception report
messageInternal Server Error
descriptionThe server encountered an internal error that prevented it
from fulfilling this request.
exception
org.apache.jasper.JasperException: The Struts dispatcher cannot be
found. This is usually caused by using Struts tags without the
associated filter. Struts tags are only usable when the request has
passed through its servlet filter, which initializes the Struts
dispatcher needed for this tag. - [unknown location]
root cause
The Struts dispatcher cannot be found. This is usually caused by
using Struts tags without the associated filter. Struts tags are only
usable when the request has passed through its servlet filter, which
and same error for http://mybox:8080/struts/hello.action
On Sat, Jun 30, 2018 at 6:43 PM, Yasser Zamani <ya...@apache.org> wrote:
>
>
> On 6/30/2018 4:23 PM, ssmtpmailtesting ssmtpmailtesting wrote:
>> web.xml =>
>>
>> <!DOCTYPE web-app PUBLIC
>> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>> "http://java.sun.com/dtd/web-app_2_3.dtd" >
>>
>> <web-app>
>> <display-name>Archetype Created Web Application</display-name>
>> <filter>
>> <filter-name>struts2</filter-name>
>> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
>> </filter-class>
>
> The maven pom.xml is using Struts 2.5.16 but web.xml is using Struts
> 2.3.x either DTD and filter. The FilterDispatcher is used in the early
> Struts2 development, and it’s deprecated since Struts 2.1.3. it’s always
> recommended to upgrade the new filter class – StrutsPrepareAndExecuteFilter.
>
> Regards.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: http://mybox:8080/struts/hello.action gets HTTP Status 404 - Not
Found
Posted by Yasser Zamani <ya...@apache.org>.
On 6/30/2018 4:23 PM, ssmtpmailtesting ssmtpmailtesting wrote:
> web.xml =>
>
> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd" >
>
> <web-app>
> <display-name>Archetype Created Web Application</display-name>
> <filter>
> <filter-name>struts2</filter-name>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
> </filter-class>
The maven pom.xml is using Struts 2.5.16 but web.xml is using Struts
2.3.x either DTD and filter. The FilterDispatcher is used in the early
Struts2 development, and it’s deprecated since Struts 2.1.3. it’s always
recommended to upgrade the new filter class – StrutsPrepareAndExecuteFilter.
Regards.