user3181047
user3181047

Reputation: 15

http status 404 while running struts2 application on server

This question may sounds duplicate but fact is that I haven't received a solution for this. I have just into struts2 and trying for a login application. I have attached following libraries:

commons-fileupload-1.2.2.jar
commons-io-1.4.jar
commons-lang-2.4.jar
commons-logging-1.0.4.jar
freemarker-2.3.15.jar
javassist-3.14.0-GA.jar
ognl-2.6.11.jar
struts2-core-2.0.14.jar
struts2-core-2.1.6.jar
xwork-2.0.7.jar

when I run normal JSP pages(without struts tag) individually it runs okay. But whenever I run jsp pages with struts tag individually it displays http error 500. After creating whole web.xml and struts.xml and run entire application it reports http status 404. I know problem is that my jsp pages are not getting recognized.Please help.

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" version="3.0">
   <display-name>Struts2 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>Login.jsp</welcome-file>
    </welcome-file-list>
</web-app>

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>
    <constant name="struts.enable.DynamicMethodInvocation"
        value="false" />
    <constant name="struts.devMode" value="false" />
    <constant name="struts.custom.i18n.resources"
        value="ApplicationResources" />

    <package name="default" extends="struts-default" namespace="/">
        <action name="login"
            class="com.vvv.struts.LoginAction">
            <result name="success">Welcome.jsp</result>
            <result name="error">Login.jsp</result>
        </action>
    </package>
</struts>

Upvotes: 0

Views: 2948

Answers (2)

Md Azam
Md Azam

Reputation: 11

HTTP Status 404 SOLVED- in Struts2

To resolve this issue please copy below mention 10 jar files only inside lib folder.

commons-fileupload-1.3.1.jar,
commons-io-2.2.jar,
commons-lang-2.4.jar,
commons-lang3-3.2.jar,
commons-logging-api-1.1.jar,
freemarker-2.3.19.jar,
javassist-3.11.0.GA.jar,
ognl-3.0.6.jar,
struts2-core-2.3.20.1.jar,
xwork-core-2.3.20.1.jar

Hope it will work.. Thanks:)

Upvotes: 1

Andrea Ligios
Andrea Ligios

Reputation: 50203

struts2-core-2.0.14.jar
struts2-core-2.1.6.jar

This is wrong and won't make it work.

Ensure you have:

  • only one version of each JAR
  • all the JARs with the same version of the others

and possibly

  • all the JARs with the latest version.

Check out the latest version and the non-struts libraries with the appropriate version here: http://struts.apache.org/release/2.3.x/struts2-core/dependencies.html

Or download the full package as described here: https://stackoverflow.com/a/21044848/1654265

Upvotes: 0

Related Questions