1
votes

I have an enterprise application which is delivered as an EAR file. The META-INF folder within the ear contains 'application.xml' as expected, with a list of modules belonging to the application.

There are a number of EJB jar files within the ear also, each of which contain a number of EJBs. For certain reasons, we wish to use XML deployment descriptors to configure all of the ejbs. As a result we have a number of ejb-jar files, each one embedded in the META-INF folder of each jar within the ear file like this.

EAR_FILE
:     
:-----META-INF
:           :
:           -application.xml
:     
:     
:------EJB_JAR_1
:              :
:              -META-INF
:                      :
:                      -ejb-jar.xml
:------EJB_JAR_2
:              :
:              -META-INF
:                      :
:                      -ejb-jar.xml
:------EJB_JAR_3
              :
              -META-INF
                      :
                      -ejb-jar.xml


As you can see, this results in a number of individual ejb-jar.xml deployment descriptors. We would like to be able to centralise this into a single deployment descriptor which defines all ejbs in the application.

also, we want to keep the separate ejb jar files within the ear, rather than having them all in a single ear.

Is it possible to have a 'master' ejb-jar file in the META-INF folder of the ear file which contains the configuration for all EJBs in the application?

Or is it possible even to place the ejb-jar files outside the actual jar containing the EJBs?

At the end of the day, what I'm really looking to achieve is to centralise all of the ejb deployment descriptors into one file somewhere, rather than having them spread over each individual EJB jar as above?

Many thanks,

Dave.

1

1 Answers

0
votes

Or is it possible even to place the ejb-jar files outside the actual jar containing the EJBs?

Yes, though more accurately: it is possible to have EJB classes outside the EJB module JAR. In other words, you can create a single EJB module with a single ejb-jar.xml, and then put all the EJB_JAR_1, EJB_JAR_2, etc. in the EAR/lib/ directory, which automatically makes all the JARs visible to all the EJB modules in the EAR (or, the singular EJB module in your case). Alternatively, you could manually maintain a Class-Path: ejb-1.jar ejb-2.jar list in the EJB module META-INF/MANIFEST.MF, but that's more work.