Precedence of EJB Deployment Descriptors

374 views Asked by At

If I have an EJB packaged in a WAR because it is exposed as a REST web service, according to this link, I need to have the ejb-*.xml files at the root of the WEB-INF directory. My current environment is Websphere 8.5 and EJB 3.1

If I later add multiple EJBs ( in separate EJB projects ) in the same application and define its deployment descriptors in the respective projects, those seem to be ignored. It appears that ALL of my descriptors should be defined in the descriptors in the WEB-INF directory - or in other words, it seems that I should augment the descriptors in WEB-INF directory even for EJBs that are defined as separate projects.

Is this how it needs to be or am I missing something that is forcing me to do this? I could not find any documentation explaining this part.

More Details: This is how my application.xml looks like

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd"
 version="7">
<display-name>MyApp</display-name>
<module id="Module_1395346343165">
    <web>
        <web-uri>MyWeb.war</web-uri>
        <context-root>myapp</context-root>
    </web>
 </module>
 <module id="Module_1395346304194">
    <ejb>ejb1.jar</ejb> 
 </module>
 <module id="Module_1424684968934">
    <ejb>ejb2.jar</ejb>
 </module>
 <module id="Module_1431010943758">
    <ejb>ejb3.jar</ejb>
 </module>
</application>

The ejb1 is the one that will live in the webapp. The other two, ejb2 and ejb3 are separate ejb projects that are supposed to be in EAR's root.

1

There are 1 answers

0
Brett Kail On BEST ANSWER

For EJBs in a WAR module, the files go in WEB-INF, so .ear!/MyWeb.war!/ejb-jar.xml, .ear!/MyWeb.war!/ibm-ejb-jar-bnd.xml, etc.

For EJBs in separator EJB modules outside a WAR, the files go in META-INF. So, .ear!/ejb1.jar!/META-INF/ejb-jar.xml, .ear!/ejb1.jar!/META-INF/ibm-ejb-jar-bnd.xml, etc.