• 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

putting a lib jar file in an ear file

 
Trailboss
Posts: 23778
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a jar file that has a bunch of stuff in it that my ejb's need and my servlets need. My first thought was to simply put it in the ear file. Didn't work. So then I updated application.xml to include a "module" tag that had a "java" element. That didn't work either.
How do I do this?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1> put these classes in whichever ejb-jar file which uses these classes.
or you can
2> use Class-Path in ejb-jar's and war's manifest files. But i never succeeded.
 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi wei,
What utility u use to create a war/ear file? I mean Ant or IDE like Eclipse.
Let me know regarding the same.
Seetesh
 
wei wu
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
create ejb-jar and war is very easy, i just use jar -cvf command.
 
author
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When putting a jar in the EAR, the J2EE compliant way for a WAR and an EJB-JAR to see that jar is to add the jar name to the MANIFEST of the EJB-JAR and the MANIFEST of the WAR. This should be enough. This works with WebSphere
 
author & internet detective
Posts: 41860
908
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
Paul,
"My first thought was to simply put it in the ear file." This is what we do and it works fine.
What IDE are you using? Are you getting the errors at compile time or runtime? If runtime, some IDEs have a different build and runtime path.
 
paul wheaton
Trailboss
Posts: 23778
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A guy I work with is working on a jboss book. Since I was porting my stuff to jboss I asked him and came up with a really spiffy approach - at least for jboss.
Put all your jars into one jar. I named my jar lib.jar. And then put it in the ear file at lib/lib.jar. Then pop the following into application.xml:

Cake!
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure works on JBoss... however this is a non-standard solution that I guarantee will not work in other Application Servers. The standard J2EE solution as defined in the J2EE 1.3 spec is to use a Class-Path MANIFEST entry.
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this stuff portable, or specific to various containers that happen to allow it? Is there a spec that specifically talks about this?
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I mentioned above the J2EE 1.3 Specification directly addresses this issue and the portable solution is to use a Class-Path MANIFEST entry to specify dependencies. This is actually one of the least understood parts of J2EE deployment...
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you still need to include an application-client.xml DD for lib files to have the utilizing modules successfully deploy? Or can you only include them when the lib JAR has ejb-refs or resource-refs of its own? I seem to recall JBoss freaking out whenever a "java" module doesn't have any application-client DDs (although I've obviously never messed around with one that was included as part of another's classpath).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic