0

I'm using struts framework and this problem is occurred when i deploy my project.... why this error is occurred at the deploy time???

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <welcome-file-list>
    <welcome-file>userLogin.jsp</welcome-file>
  </welcome-file-list>


<filter>
  <filter-name>f1</filter-name>
  <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  </filter>
  <filter-mapping>
  <filter-name>f1</filter-name>
  <url-pattern>/*</url-pattern>
  </filter-mapping>

  <listener>
    <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
  </listener>

</web-app>  

tiles.xml

<?xml version="1.0" encoding="UTF-8" ?> 

<!DOCTYPE tiles-definitions PUBLIC 
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" 
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd"> 

<tiles-definitions>
   <definition name="common" template="/FirstLayout.jsp"> 
   <put-attribute name="header" value="/header.jsp"/> 
   <put-attribute name="body" value="/footer.jsp"/> 
   </definition>

   <definition name="validUser" extends="common"> 
   <put-attribute name="title" value="Login User"/> 
   <put-attribute name="contents" value="/userLogin.jsp"/> 
   </definition> 

   <definition name="invalidUser" extends="common">
   <put-attribute name="tilte" value="Login Error" />
   <put-attribute name="contents" value="/relogin.jsp" />
   </definition>

</tiles-definitions>

struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>

<package name="p1" extends="tiles-default">
<action name="signin" class="action.LoginAction ">
<result name="success" type="tiles">validUser</result>
<result name="failure" type="tiles">invalidUser</result>
</action>

</package>

</struts>    

this error is occurring while i add struts jar file in my project... earlier it was running without any error..Is there any problem with my strut file. I am using Myeclipse 8.5 and Tomcat server 6.0. .

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
  • I only see a single action for signin in you struts.xml file... are you sure the same struts.xml file worked earlier for url pattern /crime/ ? – Balaji Krishnan Oct 07 '13 at 14:05

2 Answers2

1

The thread is old, but I will post the solution anyway, as more people are learning how to write a web application using apache struts frame work, they will undoubtedly encounter the same problem.

The problem is that Eclipse does not copy the ROOT folder from Apache Tomcat to your Eclipse work place. Just go to your Apache-Tomcat folder, then COPY the ROOT folder in the webapps folder.

Paste it into your Eclipse: your_workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps

tmp0 is your current server.

Also, just make sure you add your struts .jar files.

That's all folks

TL

TL098765
  • 11
  • 1
0

404 may occur due to either not setting welcome file(but you set it) or if the server failed to deploy your project. The second may be the reason here. Check the console logs did the server start at all. Secondly as you mention about the jar it may happen that you have included two jars of struts but with different versions.

Better use a build tool like Maven or Ant. Tell if that helps.Thanks.

Amit Kumar
  • 2,685
  • 2
  • 37
  • 72