Enterprise Java Development@TOPIC@

Chapter 87. Basic Session EJB Component

87.1. Making POJO an EJB
87.1.1. Annotate Bean class with @javax.ejb.Stateless
87.1.2. Annotate Interface with @javax.ejb.Remote
87.1.3. Optionally Annotate Empty Interface Extending POJO Business Interface
87.1.4. @PostConstruct/@PreDestory
87.2. EJB Module
87.2.1. Source EJB Module
87.3. Naked EJB-based Deployment
87.4. Maven Aspects: EJB
87.5. JBoss Session EJB Pooling
87.6. Summary
$ jar tf target/ejb-basic-ejb-4.0.0-SNAPSHOT.jar 
...
info/ejava/examples/ejb/basic/ejb/BadRequestException.class
info/ejava/examples/ejb/basic/ejb/Greeter.class
info/ejava/examples/ejb/basic/ejb/GreeterEJB.class
info/ejava/examples/ejb/basic/ejb/GreeterRemote.class
info/ejava/examples/ejb/basic/dto/Name.class
info/ejava/examples/ejb/basic/dto/Greeting.class
...
17:19:52,979 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) 
JNDI bindings for session bean named GreeterEJB in deployment unit deployment "ejb-basic-ejb.jar" are as follows:

        java:global/ejb-basic-ejb/GreeterEJB!info.ejava.examples.ejb.basic.ejb.GreeterRemote
        java:app/ejb-basic-ejb/GreeterEJB!info.ejava.examples.ejb.basic.ejb.GreeterRemote
        java:module/GreeterEJB!info.ejava.examples.ejb.basic.ejb.GreeterRemote
        java:jboss/exported/ejb-basic-ejb/GreeterEJB!info.ejava.examples.ejb.basic.ejb.GreeterRemote
        java:global/ejb-basic-ejb/GreeterEJB
        java:app/ejb-basic-ejb/GreeterEJB
        java:module/GreeterEJB

17:19:53,012 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: ejb-basic-ejb.jar
17:19:53,029 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016008: Starting weld service for deployment ejb-basic-ejb.jar
17:19:53,485 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "ejb-basic-ejb.jar" (runtime-name : "ejb-basic-ejb.jar")


<project>
...
    <packaging>ejb</packaging>

    <dependencies>
...
        <dependency>
            <groupId>javax.ejb</groupId>
            <artifactId>javax.ejb-api</artifactId>
            <scope>provided</scope>
        </dependency>
...        
    </dependencies>
    
    <build>
        <plugins>
              <!-- tell EJB plugin to create a client-jar -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <configuration>
                    <generateClient>true</generateClient>
                    <clientExcludes>
                        <clientExclude>**/ejb/*Local.class</clientExclude>
                        <clientExclude>**/ejb/*EJB.class</clientExclude>
                    </clientExcludes>
                </configuration>
            </plugin>
        </plugins>
    </build>    
</project>