File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Getting Http 404 Error while running Strut Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting Http 404 Error while running Strut Application" Watch "Getting Http 404 Error while running Strut Application" New topic
Author

Getting Http 404 Error while running Strut Application

Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi All,

I am getting Http Status 404 error while executing strut application (Inventory).

Following is struts-config.xml.

struts-config.xml



index.jsp




Could any one please help me what is problem in above.

Thanks in Advance.



Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

Were there any deployment errors in the application?? Did you configure struts in web.xml?? Is there a jsp named product.jsp in the root folder of your application?? Is there a class TestProduct.struts.ProductListAction in your application??


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi Ankit,

Thanks for Reply. While running application GlassFish V2 gave following Exception. But i think that is related to Validation Framework and that should not be the cause of not even loading the application. (Loading even starting Page).

WebModule[/Inventory]PWC1396: Servlet /Inventory threw load() exception
javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:172)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:254)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1178)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1007)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4808)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5196)
at com.sun.enterprise.web.WebModule.start(WebModule.java:326)
at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
at com.sun.appserv.management.util.misc.RunnableBase.run(RunnableBase.java:341)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
WEB0207: Error starting web context StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[/Inventory] on virtual server server
LifecycleException: javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4818)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5196)
at com.sun.enterprise.web.WebModule.start(WebModule.java:326)
at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
at com.sun.appserv.management.util.misc.RunnableBase.run(RunnableBase.java:341)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)


Following is the struts-config.xml entry in web.xml




Follwing the product.jsp under /WEB-INF folder.




But currently TestProduct.struts.ProductListAction is not there But that should not cause problem of even not displaying first jsp page itself.

Thanks in Advance.
Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi Ankit,

I commented out snippet for /ProductList action in the strut-config.xml in. But in vain.

Thanks.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

Please show the complete declaration of struts servlet in web.xml i.e. the <servlet> and <servlet-mapping> tag used to declare struts in web.xml. Also are there files named validator-rules.xml and validation.xml in WEB-INF directory??
Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi Ankit,

Below is the code for web.xml




And Yes, there are files validator-rules.xml and validation.xml under WEB-INF folder.
Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi Ankit,

Last when i ran the application i got following error.(in bold)


Error occurred during application loading phase. The application will not run properly. Please fix your application and redeploy. WARNING: com.sun.enterprise.deployment.backend.IASDeploymentException: ContainerBase.addChild: start: LifecycleException: javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml' run-deploy: Browsing: http://localhost:14521/Inventory/ run-display-browser:


Could you let me know what went wrong here other than validator framework. Moreover i have change form bean extending to ActionForm instead of ValidatorForm.
Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi All,

Now i'm getting HTTP Status 500 and getting following exception on the display page.

exception javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null on action /Product root cause javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null on action /Product.


Do not know where the error lies or what is going wrong?

Please Help on this.
Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hey Everyone!!! The problem got resolved. I change /Add action to /Product in struts-config.xml and issue got resolved.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Http 404 Error while running Strut Application