• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can't find classes in my webapps lib directory

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've searched the forums and seen this question asked, but there doesn't seem to be an answer to it. I deployed a webapp of mine to tomcat 5.5 as a .war file. The deployment works and I can call jsps. I try to call a servlet which uses a .jar file which is in my application's /WEB-INF/lib/ directory.
I get a NoClassDefFoundError for a class that the servlet tries to call. However, if I add my .jar file to $tomcat-home/common/lib everything works fine. I can't imagine I would need to add all my .jar files to the common/lib to get them to work. Please let me know what I need to do to have the files in my own application's \WEB-INF\lib directory to be seen.

Thanks in advance.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should never need to add them to common/lib.
Are the classes in a package?
 
Michael Beck
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there are multiple .jars including castor-jdo jars, commons classes, mysql connector, xml parsers etc...so yes, they are in packages within the .jars
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it a JDBC driver class that can't be found?
If you're setting up container managed connection pooling, then yes, the driver libraries have to be in a place where the container can access them.
 
Michael Beck
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, it is a jdbc class that cant be found. i'm using castor-jdo to connect to a mysql database so this wouldn't be container managed (unless i'm confused about what container managed is)
 
Michael Beck
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do I need to do anything with any of the files in the /conf directory to define my web app context? I wonder if thats why those files aren't in the classpath.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're planning on using container managed connection pooling, you'll want to see this page:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html

There are several ways to deploy an app in Tomcat.
See:
http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html
 
Michael Beck
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I figured out why it can't find the class. I am using castor-jdo to do object/database mapping with a mysql database. Castor-jdo uses a class javax.transaction.Synchronization...it doesn't seem to work without this. This class is in j2ee.jar
When I start my webapp I see
INFO: validateJarFile(C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ahs96\WEB-INF\lib\j2ee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

So j2ee.jar never gets loaded when it is in my webapp. It only gets loaded if I put it in the $CATALINA_HOME/common/lib directory.

The problem is I need this class for the castor stuff to work. It 'does' work putting it in $CATALINA_HOME/common/lib directory. but this is not the right way to do it. Can anyone give me some insight into this?

Thanks
 
Michael Beck
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've discovered that j2ee.jar is unnecessary. jta1.0.1.jar
includes the required interfaces. the jar is in
the lib directory of the full castor download.
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic