File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes deploying multiple ejb module Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "deploying multiple ejb module" Watch "deploying multiple ejb module" New topic

deploying multiple ejb module

Mohammad Norouzi
Ranch Hand

Joined: Jul 12, 2005
Posts: 71
Hi experts

I have a problem in injecting EntityManager when I have multiple ejb module in my ear file. Actually, only in one EJB module I need the EntityManager and the others are only a bunch of stateless business object.
there is no persistence.xml in any module except the one that needs EntityManager. the code I am using is:

private EntityManager entityManager

but during the deployment the container complains that could not set the em.

I have test with and withour unitName attribute but no success.

the thing is when I make all my classes into one jar file and declare it as an EJB module in the application.xml everything is OK.

I am using TopLink and Sun Glassfish v9.x

I am really stuck any help would be appreciated

Regards, Mohammad | my.photoblog | Add your name to SCJP Wall Of Fame
Mohammad Norouzi
Ranch Hand

Joined: Jul 12, 2005
Posts: 71
By the way, I eventually end up to injecting EMF as the following code

private EntityManagerFactory emf;

private EntityManager em;

public void construct(){
em = emf.createEntityManager();

public void destroy(){

but this is not good nor does it work fine

please help me
I agree. Here's the link:
subject: deploying multiple ejb module
It's not a secret anymore!