• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejb-jar / utility jar dependencies

 
Dan Ludwig
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this post might belong in the ejb-forum, but since i'm currently studying for the scbcd exam, i didn't want to sound like a dunce posting it there

the headfirst ejb book briefly mentions using abstract 'super-interface' implementation classes to avoid having to code empty ejbActivate, ejbPassivate, etc. in a Bean class. For example, one can create an abstract class that implements the SessionBean or EntityBean interface, along with container callback methods. By extending this abstract class, one could avoid having to code empty implementations of these 7 methods in a Bean class.

For my own research, I'm trying to implement this pattern. I want to place a reusable abstract class in a jar that can be reused across several other ejb-jar's. However, I'm unaware how jar dependencies must be declared for ejb's, if at all. For example in a WAR file, one can place dependent jar files (like ejb client jars, utility jars, etc.) in the WEB-INF/lib folder. As long as the required jars are there, one need not declare jar dependencies in web.xml.

Will this also work for an ejb-jar file? Could I simply put my abstract-ejb.jar file in the META-INF/lib folder? Or must jar dependencies be declared in the application.xml so that they function properly in the EAR file?
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can simply put your util.jar at the root of ejb JAR and refer it in the manifest file.



In the Manifest.mf add the following line:
Class-Path: util.jar


This has worked for me in Weblogic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic