Discussions

EJB programming & troubleshooting: Packing of Multiple EJBs

  1. Packing of Multiple EJBs (4 messages)

    Hi,

    We have a bunch of EJBs that share a bunch of classes. We decided to pack each EJB in separate .jar files. Does this mean that we would have to package all the shared classes in each .jar file as well?

    Is there a way to deploy a jar file that contains common code in J2EE? Thanks.

    Threaded Messages (4)

  2. Packing of Multiple EJBs[ Go to top ]

    I remember looking into this and came to the conclusion that every jar file has to contain everything that it needs.

    You should probably rebundle them all as a single jar file, OR, you could forget about jars and just stuff the code under the domain directly - this means they can all share the same common class files (I think).

    Jonathan
    ps That last bit is weblogic specific
  3. Packing of Multiple EJBs[ Go to top ]

    You don't necessary need to include all the shared classes in the EJB jar but it would also be nice that your EJB jar can be deployed independently. One drawback is that you you maintain multiple copies of that shared classes in each EJB jar. So it really depends on your choice. If you decided not to include the shared classes in each individual EJB jar, what you can is packaged all the shared classes into a single jar file and include it in the classpath of the application server (for my case it's the weblogic classpath)

    cheers...
    Jerson
  4. Packing of Multiple EJBs[ Go to top ]

    I think I will create the necessary ANT script to package my EJBs with the full set of complimentary classes. All the classes will be pulled from the same source though.

    This will reduce the maintenance headache and I don't have to deal with AppServer specific.

    Thanks for you all help everyone!
  5. Packing of Multiple EJBs[ Go to top ]

    HI,

    Thanks to all for your answers. I am also facing the same problem. I am working in Weblogic, and I have a no of EJBs. I first bundled them into a single jar file. But in that case, weblogic failed to load the jar as it tries to load an EJB(1) which had a reference of another EJB(2) (which is coming later in loading sequence). I could not define the loading sequence of the EJBs and so the only way out is to make jar for each EJB. I just want to know that whether there is any thumb rule on this issue or not? I don't want to make jar for all EJBs. If I have 30 EJBs, which are belongs to 7 logical groups, I think I will go for 7 jar files not 30.

    pl. correct me if I am going wrong.

    I am agree with Jerson's comment for shared classes(application exceptions are also comes under this head).

    rgds,

    niroja