GeeCON Prague 2014*
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
Author

Problem with struts 2

Gopi Chand
Greenhorn

Joined: Feb 04, 2007
Posts: 24
Hi,

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...!

cheers!
Pranav Sharma
Ranch Hand

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

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...

GL
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

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
Greenhorn

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..
<jar-root>/lib/
+ -- 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.

thanks!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

As previously stated, when you deploy the application the libraries need to be in /WEB-INF/lib.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with struts 2