Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Resource not Found error continues even after resource is removed from xml file  RSS feed

Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is a pretty common problem with new Struts 2 learners like me. So I searched the forum, but could not find any post that matches the exact problem I have.

I am writing a simple app that takes a person's name in a jsp, passes that name to an action class, which does nothing (it just has an execute() method which returns the "SUCCESS" string), and then the name gets displayed on another jsp.

When I deploy and run the application, the index page, asking for the user to input name, shows up. On entering the name and hitting submit button, it gives a 404 error (resource not found).
Because the first jsp shows up, I assume the app has been deployed properly. The web.xml file is

The struts.xml file is

The action class is as follows

Inside the webapps directory of tomcat, I have my application named HelloWorldinStruts2. The action class is in the following directory
C:\Program Files (x86)\Tomcat\webapps\HelloWorldinStruts2\WEB-INF\classes\helloworld

Error message

HTTP Status 404 - /HelloWorldinStruts2/helloworld

type Status report

message /HelloWorldinStruts2/helloworld

description The requested resource (/HelloWorldinStruts2/helloworld) is not available.

As an attempt to debug this, I removed the 'class' parameter from the action tag, the logic being....since its the class that is not being found, removing any mention of the class from the xml file should take care of the error. The new struts.xml looks like this

I made the change, restarted the server, and tried again. The error is still the same. My question is...
1. Why does it not find the resource in the first case?
2. When I remove the class name, how can this error continue to exist;because now, there is not even any mention of a resource called helloworld.SayHelloToUser?

Can anyone please help?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!