This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes IDEs, Version Control and other tools and the fly likes JARs needed by Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "JARs needed by Tomcat" Watch "JARs needed by Tomcat" New topic
Author

JARs needed by Tomcat

Antonio Fornie
Ranch Hand

Joined: Aug 07, 2008
Posts: 117
Hello.

I'm starting to develop a web project (Struts2+Spring2) with Eclipse and Tomcat 5.5. I configured the Java Build Path in order to reference every lib (.jar) I needed.

Tomcat complained because there were classes it didn't find, even though those classes were in the libs I had just included. Well, I've solved the problem placing a copy of those libs in Tomcat/common/lib folder, but I don't like this solution. I musn't place there every lib for every project. I KNOW it's something I did wrong but I don't know what. Can anybody help me?

Thank you very much.


I feel there must be far better ways to do what I do... that makes learning even funnier
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

Antonio,
Are the jars in the WEB-INF/lib folder of your Eclipse Web project (and therefore in the war when you deploy) ? This is the only place Tomcat will look automatically that is part of your app.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Antonio Fornie
Ranch Hand

Joined: Aug 07, 2008
Posts: 117
Hello. Thank you for your reply.

There are several ways to include jars in an eclipse project. In my case I have all the jars in User Libraries that I've been adding to the project. For some of the jars it works well, but for many others it's like they weren't there until I put them in Tomcat/common/lib

Anyway I tried to put all of them in WEB-INF/lib and it doesn't work either.

Thank you very much. Any other idea?

Antonio
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Originally posted by Antonio Fornie:
Hello. Thank you for your reply.

There are several ways to include jars in an eclipse project. In my case I have all the jars in User Libraries that I've been adding to the project. For some of the jars it works well, but for many others it's like they weren't there until I put them in Tomcat/common/lib

Anyway I tried to put all of them in WEB-INF/lib and it doesn't work either.

Thank you very much. Any other idea?

Antonio


Putting them in WEB-INF/lib is the way to go, but the WEB-INF/lib eclipse uses won't be the that Tomcat's default uses if you launch Tomcat from inside Eclipse (it uses its own working area usually in the User's directory workspace).

The proper way to define dependencies for the eclipse web projects would be to use the Project -> Properties -> Java EE Module Dependencies to define the libraries that get copied to the correct WEB-INF/lib directory (both for running in Eclipse and packing the WAR file). Using Project -> Properties -> Java Build Path only defines the dependencies for compile-time inside the Eclipse platform (and defining which dependencies get copied to an exported JAR file).


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JARs needed by Tomcat