• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

JARs needed by Tomcat

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Bras cause cancer. And tiny ads:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic