Search code examples
javaejbearapache-tomeeapplication.xml

TomEE web profile 7.1.4 not loading ejb jar?


I have a ear containing an ejb jar and a war. The war contains a servlet which calls an EJB. If I deploy the ear without the ejb jar under WEB-INF/lib folder, the servlet http request fails.

I thought it was not required to keep the ejb jar in WEB-INF/lib folder as long as it was available in the application root folder (beside the war). Both the war and the ejb jar are included as dependencies in the ear pom.xml file


Solution

  • The ear application.xml file had no ejb module tag inside. This was due to a config error in maven ear plugin. The solution was adding the bolded lines in the ear pom.xml:

      <artifactId>maven-ear-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
            <modules>
                <webModule>
                    <groupId>org.asier</groupId>
                    <artifactId>javaee7-war</artifactId>
                </webModule>
                **<ejbModule>
                    <groupId>org.asier</groupId>
                    <artifactId>javaee7-ejb</artifactId>
                </ejbModule>**
            </modules>
        </configuration>