This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Resource not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Resource not found" Watch "Resource not found" New topic
Author

Resource not found

vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi friends,
I am new to struts 2. I did very small program using struts 2 it is saying requested resource not found error. I deplyed it using Apache tomcat.
My directory structure is

vino(root directory)
------web-inf
---------classes
------------Helloworld.class
------------struts.xml
---------lib
-----------commons-logging.jar
-----------freemarker.jar
-----------ognl.jar
-----------struts-core.jar
-----------xwork-core.jar
--------src
-----------Helloworld.java
--------web.xml
------index.jsp
------success.jsp

web.xml file


struts.xml


index.jsp


success.jsp


Helloworld.java


When i run it shows the requested resource not. Help me in this. Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Check the startup logs. If nothing else, you're missing the commons-fileupload and commons-io libraries--but without specifics it's impossible to help further.
vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi David Newton,
Thanks for your reply. I have included commons-fileupload and commons-io libraries. But still it is saying the

The requested resource (/vino/Helloworld) is not available.
when i call using http://localhost:8080/vino/Helloworld.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Which version of Struts 2 are you using? Did you try "Helloworld.action"? Did you look at the startup logs?
vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi
I dont know how to check startup logs. Helloworld.action not working. using struts-core-1.3.10.jar but my struts-core-1.3.10.jar doesn't contain struts-taglib.jar. I dont know how to refer the struts-taglib in taglib tag and where to place the struts-taglib.jar file. will problem be there?
<%@ taglib prefix="s" uri="/struts-tags" %>
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I think the biggest problem will be thinking you're using Struts 2, but actually using Struts 1.3.

You need to know how to look at your log files before you continue.
vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi,

1. I don`t know how to refer the struts-tags in the taglib uri tag. and where to place the struts-taglib.jar in the directory structure
2.Can you give hint how to read startup logs.

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Did you read what I wrote? You claim you're using Struts 2--but the library you say you're deploying is Struts 1.3. What libraries are you deploying?

For Tomcat-specific questions, please post in the Tomcat forum... it's really, really important you know how to look at the log files.
vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi David,
You were correct i changed the version of struts its working now, but now new problem comes when i put struts.xml file in
web-inf/classes/App/struts.xml it is showing index page
then when i send the request it is showing another error
There is no Action mapped for namespace / and action name Helloworld.
but when i put it in
web-inf/classes/struts.xml it is not displaying index.jsp itself and saying
requested resource not found error
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What libraries are you deploying? Is there anything in the logs? (I don't understand not being able to look at the logs.)
vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi David

Log is showing

SEVERE: Exception starting filter struts2
Unable to load configuration. - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/Example1/WEB-INF/classes/struts.xml:1:8

I am using the following library

commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-logging-1.0.4.jar
freemarker-2.3.15.jar
ognl-2.7.3.jar
struts2-core-2.1.8.1.jar
xwork-core-2.1.6.jar
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You need to show the entire stack trace.
vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi David,
Above mentioned errors are cleared the new error araises
ERROR: There is no Action mapped for namespace / and action name Helloworld.

the stacktrace as follows


And this is my struts-config.xml
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Is there anything else in the logs?
Atul Darne
Ranch Hand

Joined: Jul 05, 2009
Posts: 118

iam also stucked here, getting the same error. i need to know where should i place my struts.xml

this is my struts.xml




and web.xml



i want to use struts2


Regards, Atul.
I came to this world on a Learner's License
Atul Darne
Ranch Hand

Joined: Jul 05, 2009
Posts: 118

a complete log is as below

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Resource not found
 
Similar Threads
Request not able to reach Action class in Struts2
problem in Struts2 while running an application
Struts2 Helloworld Problem
sample struts helloworld not working on eclipse
The requested resource () is not available.