Question

SCENARIO:

I have a java maven ear project that I run on GF 3.1.2. In that project I want to use a MDB defined in an individual ejb module so i put it as a dependency. So the structure is as follows:

ProjectEAR:
   - ProjectEJB
        - ProjectWithProblematicMDB
   - ProjectWAR
        - dependency ProjectEJB with scope provided

ACTUAL PROBLEM:

When this is deployed to glassfish, with the help of jconsole, i see two different MDB pools for the ProblematicMDB: one in the ejb module and one in the war module. They are not the same pool since I have set the deployment descriptor on ProjectEJB to limit the pool size to 1 and the pool's size in ProjectEJB doesn't get larger than one but the one in ProjectWAR grows in size.

This happens with all MDBS=s from modules referred in ProjectEJB as dependencies, but does not happen with the "native" MDBs from ProjectEJB. I must mention the fact that I cannot exclude ProjectWithProblematicMDB from the war since I am using some beans there (not the mdb) .

THE QUESTION(S):

Why are there two pools for the same MDB? How can I have only one pool in this scenario?

Was it helpful?

Solution

I finally found the reason and the solution.

REASON:

Looking into the .ear archive I saw that the "native" ejb (ProjectEJB) was placed into the root of the archive and the "independent" ejb (ProjectWithProblematicMDB) was packed in the lib folder. For some reason because of this, glassfish was creating the pool in the .war module too.

SOLUTION:

Adding ProjectWithProblematicMDB to ProjectEAR as a dependecy made maven pack it in the root of the .ear archive too and wasn't in the lib folder anymore. After I deployed the application in this form, the second pool (the one from the .war) was not created anymore.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top