This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
internet detective

Joined: May 26, 2003
Posts: 30130

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.

[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
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,
It is sorta covered in the JavaRanch Style Guide.
subject: jars within jars
Similar Threads
eclipse: libraries used in project are not found in the exported jar
EARs, logging and dependant jar files
Why do my JARs have to be in the server classpath?
WSAD 5.0 - Class path
WSAD Build Path vs. DD vs. Class Path