File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Problem with struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with struts 2" Watch "Problem with struts 2" New topic

Problem with struts 2

Gopi Chand

Joined: Feb 04, 2007
Posts: 24

I have a problem with a struts 2 application...
I have my ear file, which has two files. jar with all the beans and war for servlet and jsps

i used a model driven object for struts 2 and the same model is used for persistence. So both .jar file and .war file will have model driven object since it is commonly used both
in servlets and in ejbs.

now the problem is where do i put my struts 2 jar files? i tried putting them in war/WEB-INF/lib folder i got the following error
java.lang.NoClassDefFoundError: com/opensymphony/xwork2/ModelDriven

so i created another lib folder inside the jar file and put the same jar file in both jar/war files, and if do that
i am getting already loaded error..

am confused now... what am i doing wrong?

just as a general design convention, how are the jars formulated..

i put a war file with all the servlet classes, javascript, jsps, pictures etc.,
jar file has POJOs, SSB, MDB etc.,

is it the right approach? or how to go about it??

thanks a ton for your help...!

Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
You will probably need to move your question to struts forum
Andrew Alexander

Joined: Jan 16, 2009
Posts: 3
It sounds to me like you have it set up right, but need the xwork jar.

Download the xwork jar (opensympony website has it), put it in your lib folder and see if that works...

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

Please be sure to post Struts questions in the Struts forum. This post has been moved there for you.

[Asking smart questions] [About Bear] [Books by Bear]
David Newton

Joined: Sep 29, 2008
Posts: 12617

You are correct in thinking that the web app libraries should go in /WEB-INF/lib--it's probably just a matter of making sure you have all the necessary libraries as mentioned. What libraries are you trying to deploy?
Gopi Chand

Joined: Feb 04, 2007
Posts: 24
Hi All,

First my apologies for posting in the wrong forum and thanks for moving it to the correct forum..
Regarding the libraries i have in the jar file..
+ -- commons-logging-1.1.jar
+ -- freemarker-2.3.8.jar
+ -- ognl-2.6.11.jar
+ -- struts2-core-2.0.11.jar
+ -- xwork-2.0.4.jar

am i missing something? I hope i have all the required jars.

David Newton

Joined: Sep 29, 2008
Posts: 12617

As previously stated, when you deploy the application the libraries need to be in /WEB-INF/lib.
I agree. Here's the link:
subject: Problem with struts 2
It's not a secret anymore!