This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Are jars in EAR available

 
Bryon Phinney
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we put two separate bean jar files into one ear file are the classes in one jar on the classpath of the other?
Thanks for the help
Bryon
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think so(but I�ve never tryied) as when you deploy a war file with a jar file in an ear file they do so. But I really can�t understand why you don�t package the ejbs in the same jar file as they are in the same ear.
regards.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marcos Maia:
I think so(but I�ve never tryied) as when you deploy a war file with a jar file in an ear file they do so. But I really can�t understand why you don�t package the ejbs in the same jar file as they are in the same ear.
regards.

The answer will depend on your application server, but possibly no. To force the classes in one EJB JAR file onto the classpath of the other, modify the CLASS-PATH line of the MANIFEST.MF file in the JAR file that wants to reference the other classes. For instance if I needed classes from JAR A.JAR in my JAR B.JAR I would have
CLASS-PATH: A.JAR
inside my B.JAR's manifest file. This is the "J2EE sanctioned" way of doing things and should work in all J2EE application servers.
BTW -- there are many good reasons not to package all of the EJB's in a single EAR in one JAR file. The simplest being that you only want to group "logically" related EJB's together into a JAR. If you have a reusable subsystem that should comprise its own JAR since it will probably change less often than the code that references it. That's just standard SCM procedures.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic