Search code examples
java-ee-6glassfish-3earglassfish-4payara

WAR module can't find EJB classes in EJB module in the same EAR


Well, I have an EAR project with the following structure:

EarSample
  - EarSample-ejb.jar
  - EarSample-web.war

Inside the EJB module a have a simple stateless session bean with no interfaces (no-view interface).

What's happening is that I'm not being able to inject that EJB in a JSF managed bean packaged in war module. Netbeans not even sees the class.

I've already tried GF 3/4 and Payara.

Any help will be appreciated. Thank you.


Solution

  • Well, as suggested by @OndrejM, I only added EJB-module dependence in WAR's pom.xml as "provided" and it worked perfectly.

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>EarSample-ejb</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>