Common classes across separate EJB jars

What is the best way to package classes that are common across separate EJB jar files? IE, i have an object that is passed between the 2, or a utility that is used by both. Is it customary to package the classes within the EJB jar file? This seems silly to me because

now you have 2 versions of the same class that could possibly change in one of them. Or should I put the classes into the classpath of the J2EE container? Thanks for any advice.

[472 byte] By [emilesAC] at [2007-9-26 12:50:17]
# 1

Both ways will work, we prefer the first one (packaging the classes in both jars). We are using BEA WebLogic 6.x and putting it in the containers classpath would mean to restart the server every time we changed this classes. Mabe you should consider making a single jar for both EJBs if they will always be used together.

Regards,

hedtfeld.

hedtfeld at 2007-7-2 12:25:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
You may package those classes to a jar file, then put them into /WebSphere/AppServer/lib/ext.Remember to restart the server, all the classes that your EJB jar files can using without any configuration !!
n876104 at 2007-7-2 12:25:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
Hi,One solution is to package your ejb-jars in an EAR file, put those utility jars in the EAR and reference them in the manifest file of each ejb-jar.
ifrs at 2007-7-2 12:25:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 4

After going through the solutions i feel the best option among all is to follow what Author : ifrs have suggested.

To package your ejb-jars in an EAR file, put those utility jars in the EAR and reference them in the manifest file of each ejb-jar through CLASSPATH entry.

Regards,

Aru

aru_123 at 2007-7-2 12:25:13 > top of Java-index,Other Topics,Patterns & OO Design...
# 5
That's the Class-Path: entry in (as a precaution) in both the EAR and EJB-jar files.
crackers at 2007-7-2 12:25:13 > top of Java-index,Other Topics,Patterns & OO Design...