File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes jars within jars Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "jars within jars" Watch "jars within jars" New topic

jars within jars

louise rochford
Ranch Hand

Joined: Apr 04, 2002
Posts: 119
Please help, my head is spinning with confusion...
I've 3 projects:
a) an Ear project containing:
b) a Web project &
c) a utility "Framework" Java project
I have project references from the Ear to the Web & Java projects,
and from the Web to the Java project.
The Java project is also on the build path for the Web project.
The Java project needs to use log4j-1.2.8.jar. Since this isn't
standarly included by WSAD, I've created a 'lib' folder within the
project, placed the jar in there & then used 'Add JAR' to add the
library to the build path.
I didn't put the log4j.jar in the Ear, cos I want to be able to use
the Java project in other Ears potentially.
Everything compiles OK, but I get the dreaded NoClassDefFound (
of a class in the log4j.jar) when the Web code runs code in the Java project for the first time.
Obviously some classpath issue but I don;t know how to start sorting it out.
Can anyone help?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

WSAD has two types of classpaths. The build path (accessed through right clicking and selecting properties) gives you the compile time classpath. This is probably where you added the jar.
The module dependencies give you the runtime classpath. Anything added to the module dependencies is automatically added to the build path. You can access this in the J2EE view by right clicking and selecting edit module dependencies.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
louise rochford
Ranch Hand

Joined: Apr 04, 2002
Posts: 119
Sorted it out.
I tidied up the module dependencies but it still wasn't working.
Turned out to be a version conflict between the log4j..jars.
I'm now using the one buried within the eclipe runtime (log4j-1.2.4.jar) & that seems OK.
Thanks for your help,
I agree. Here's the link:
subject: jars within jars
It's not a secret anymore!