*
The moose likes Struts and the fly likes XWorks throws Missing Dependency Exception for HelloWorld? HELP! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "XWorks throws Missing Dependency Exception for HelloWorld? HELP!" Watch "XWorks throws Missing Dependency Exception for HelloWorld? HELP!" New topic
Author

XWorks throws Missing Dependency Exception for HelloWorld? HELP!

Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
I'm trying to learn Struts, starting with the HelloWorld sample here, but on startup, Tomcat is showing me this in the logs:


I have the following in the lib directory for the webapp, so I don't know what xworks isn't finding...

commons-logging-1.1.1.jar
freemarker-2.3.13.jar
ognl-2.6.11.jar
struts2-core-2.1.6.jar
xwork-2.1.2.jar


Can anyone tell me what this means?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If nothing else, you need commons-io and commons-fileupload (we're in the process of updating some of the docs still). See if that fixes it, although I had thought that missing those would give a different error message-so that might not be the only problem.
Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
I fixed this by moving the struts.xml file into the class path (WEB-INF/classes). Even though I had configured the FilterDispatcher to look in a specific location for the file, (see below) it wasn't finding the config. Don't know why it was giving an xwork error, though.

snip from my previous web.xml, which apparantly didn't work.

Maybe you can help me with my next problem? How do I get Struts to use a different extension from the default .action? I'm trying to get it to recognize, say, "index.do", which resides in a specific subdirectory of the webapp. Like I want Struts to handle all requests that look like

http://localhost:8080/mywebapp/strutspages/myaction.do

Looks like no matter what I do, Struts ignores the "strutspages" part, and the ".do" part. I can't use <url-pattern>/strutspages/*.do</url-pattern> in web.xml, because Tomcat barfs on load (bad url pattern apparently, though it looks fine to me).

Is the url being handled by the Struts filter somehow related to the "name" and "namespace" attributes of struts-config.xml <package> elements? I'm not clear on what those attributes do, whether they are local identifiers (like a Spring context file), or somehow related to the actual path of the request...

Any ideas?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm not sure you'd want to set the filter to anything other than "/*" at this point anyway; S2 serves static content from its jar files. It's not *necessary* to do it this way, though.

The action extension is configured via the "struts.action.extension" constant, which defaults to "action,,".

In general it's best to start new threads for new topics; this helps other people find topics of interest to them.
 
wood burning stoves
 
subject: XWorks throws Missing Dependency Exception for HelloWorld? HELP!
 
Similar Threads
Could not find a suitable constructor in com.opensymphony.xwork2.conversion
Sending a mail from struts application using the Spring Framework utility library
struts2 question!
Dispatcher initialization failed + Struts 2.1.8
executing struts2.2.3 core