• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JARs needed by Tomcat

 
Antonio Fornie
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Antonio Fornie
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic