8 Replies Latest reply on Sep 2, 2013 5:34 PM by max010

    Remote JNDI lookup for JUnit tests

    max010

      Hi,

       

      I have been trying to JUnit test some beans in my application.  I have set up JBoss-eap-6.1 and junit4.10 on my Eclipse.

       

      I have followed the instructions on https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI and https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project but I cannot get it to work.

       

      Here is my stateless bean:

      {code:java}

      package myapp.ejb.account;

       

      @Stateless

      @Remote(AccountRemote.class)

      public class AccountBean implements AccountRemote {

       

           public void createUser( final UserValue user ) {

       

            //some code

           }

      }

      {code}

       

      And I have a remote interface AccoutnRemote:

       

      {code:java}

      @Remote

      public interface AccountRemote {

       

       

                void createUser( final UserValue user );

      {code}

       

      Then in my test folder I have a class AccountUnitTest that does some testing on the AccountBean:

       

      {code:java}

      public class AccountUnitTest {

       

       

                static AccountRemote accountRemote = null;

       

       

                public AccountUnitTest() throws Exception {

                               Properties jndiProps = new Properties();

                               jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

                               jndiProps.put(Context.PROVIDER_URL,"remote://localhost:4447");

                               // create a context passing these properties

                               final Context ctx = new InitialContext(jndiProps);

                               // lookup

             Object ref = ctx.lookup("ejb:/myapp-web/AccountBean!com.myapp.ejb.account.AccountRemote");

             accountRemote = (AccountRemote) PortableRemoteObject.narrow(ref, AccountRemote.class);

       

                }

       

      {code}

       

      The JNDI string to lookup to get the accountRemote is composed of the name of .war deployed witch is myapp-web.war, without the .war (myapp-web).

      Then the name of the bean AccountBean, then the ! and then the fully qualified name of the AccountRemote interface com.myapp.ejb.account.AccountRemote.

       

      The standalone.xml of my JBoss instance has configured port 4447 for remoting invocation:

       

      <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

              <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>

              <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>

              <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>

              <socket-binding name="ajp" port="8009"/>

              <socket-binding name="http" port="8080"/>

              <socket-binding name="https" port="8443"/>

              <socket-binding name="jacorb" interface="unsecure" port="3528"/>

              <socket-binding name="jacorb-ssl" interface="unsecure" port="3529"/>

              <socket-binding name="messaging" port="5445"/>

              <socket-binding name="messaging-throughput" port="5455"/>

              <socket-binding name="osgi-http" interface="management" port="8090"/>

              <socket-binding name="remoting" port="4447"/>

              <socket-binding name="txn-recovery-environment" port="4712"/>

              <socket-binding name="txn-status-manager" port="4713"/>

              <outbound-socket-binding name="mail-smtp">

                  <remote-destination host="localhost" port="25"/>

              </outbound-socket-binding>

          </socket-binding-group>

       

      When starting the JBoss instance I can see the JNDI bindings for the AccountBean:

       

      14:57:08,859 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-11) JNDI bindings for session bean named AccountBean in deployment unit deployment "myapp-web.war" are as follows:

       

       

       

      14:57:08,859 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-11) JNDI bindings for session bean named AccountBean in deployment unit deployment "myapp-web.war" are as follows:

       

                java:global/myapp-web/AccountBean!myapp.ejb.account.AccountRemote

                java:app/myapp-web/AccountBean!myapp.ejb.account.AccountRemote

                java:module/AccountBean!myapp.ejb.account.AccountRemote

                java:jboss/exported/myapp-web/AccountBean!myapp.ejb.account.AccountRemote

                java:global/myapp-web/AccountBean

                java:app/myapp-web/AccountBean

                java:module/AccountBean

       

      Yet when I try to run the AccountUnitTest as a JUnit test it fails with the error:

       

      javax.naming.NameNotFoundException: ejb:/myapp-web/AccountBean!myapp.ejb.account.AccountRemote -- service jboss.naming.context.java.jboss.exported.ejb:.myapp-web."AccountBean!myapp.ejb.account.AccountRemote"

                at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:103)

                at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197)

                at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:174)

                at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:127)

                at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                at java.lang.Thread.run(Thread.java:724)

       

      While debugging in Eclipse I also get the following stack trace error:

       

      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:53210

           Thread [main] (Suspended (exception ClassNotFoundException))

           owns: Object  (id=22)

           owns: Object  (id=23)

           URLClassLoader$1.run() line: 366

           URLClassLoader$1.run() line: 355

           AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]

           Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: 354

       

      I am not sure what is going on here.  Can anyone plese help me solve this issue?

       

      Thanks,

       

      Max

        • 1. Re: Remote JNDI lookup for JUnit tests
          sfcoy

          It looks like you have mixed up your ejb JNDI properties.

           

          If you want to use the "ejb:..." form of lookup name then the JNDI properties you use are quite different.

           

          Have a look at https://docs.jboss.org/author/display/AS72/EJB+invocations+from+a+remote+client+using+JNDI (again).

           

          That said, are you using remote interfaces because you want to test the EJB, or because you have real remote clients? You can use http://arquillian.org for in-container testing of local and remote EJBS.

          • 2. Re: Remote JNDI lookup for JUnit tests
            wdfink

            You should never mix the remote-naming (URL remote://) with the ejb-client (lookup starts with ejb:).

            Remote-naming is a library which uses the ejb-client library to connect, but it is not supposed to work if you mix it.

             

            You can not use the jboss-ejb-client.properties or direct access to *jboss*EJBClient classes the results might unexpected and change for different versions.

            The recommended way is the ejb-client lookup(ejb:...), see the link which  Stephen Coy provides.

            • 3. Re: Remote JNDI lookup for JUnit tests
              max010

              Thanks for your suggestions.

               

              I am going to try to use Arquillian although it only works for Maven project.  I am trying to convert a Java project in Eclipse to a Maven project and it works out to be more difficult than I expected.

               

              I will let you know how it progresses.

              • 4. Re: Remote JNDI lookup for JUnit tests
                max010

                I have tried to set up Arquillian but it just does not work.

                 

                The error I am getting when trying to convert an Eclipse Java project to a Maven project is:

                 

                An internal error occurred during: "Updating Maven Project".

                Unsupported IClasspathEntry kind=4

                 

                I have googled the error and tried to resolve it by running mvn eclipse:clean and then mvn eclipse:eclipse but no luck.  The .classpath generated by mvn eclipse:eclipse cancel all the libraries that the project needs to compile correctly.   

                 

                I have other projects that have dependencies to the converted Maven Project and unless I manually add the libraries dependecies I cant build the .war using ANT.

                I am going to try Apache TomEE but I am guessing it wont work either.  I need a way to run Junit tests on EJB remote and local interfaces without the project being Maven.

                 

                I will try to implement a remote client as explained in https://docs.jboss.org/author/display/AS72/EJB+invocations+from+a+remote+client+using+JNDI .

                 

                Thanks

                • 5. Re: Remote JNDI lookup for JUnit tests
                  sfcoy

                  If you describe your project directory structure I can try to help.

                   

                  It will be hugely beneficial to you if you can get a maven build working. Eclipse builds are not repeatable as a general rule and this leads to general quality issues with code that you deliver upstream.

                   

                  I note from the above that you have tried to use the maven-eclipse-plugin. This should not be confused with the m2e plugin (an eclipse plugin) and they are quite incompatible with each other.

                  1 of 1 people found this helpful
                  • 6. Re: Remote JNDI lookup for JUnit tests
                    max010

                    Thanks Stephen,

                     

                    I will read the m2e plugin docs and see if I can get this to work.

                     

                    The project directory is pretty simple.

                     

                    my-app-ejb

                    my-app-web

                    my-app-lib

                     

                    The my-app-ejb is where all the session beans and entity beans are located.  Think of this directory as where the business logic is.

                    The my-app-web is where all the front end resides .js, .css, .jsp, .jspf and so on.

                    The my-app-lib is just a bunch of third party libraries that are used by the my-app-ejb and my-app-web projects.

                     

                    My objective is to JUnit test the session beans.

                    • 7. Re: Remote JNDI lookup for JUnit tests
                      max010

                      I have installed Maven and converted the my-app-ejb project to be a Maven project.  I have added all the dependencies to the pom.xml and the my-app-ejb compiles without any errors. I have converted the existing project using Eclipse by right clicking on the project and selecting Configure > Convert to Maven Project.

                       

                      I am following the Arquillian Getting Started guide http://arquillian.org/guides/getting_started/?utm_source=cta to write a JUnit test to test a session stateless bean.

                      After converting the project to Maven I have noticed that the package structure is not the same as in the Arquillian Getting Started Guide.

                      This is what I have:

                      my-app-ejb

                           /src

                                /ejb.account

                                     AccountBean.java

                                     AccountLocal.java

                           /test

                                /test.account

                                     AccountUnitTest.java

                          /Maven Dependencies

                          /JRE System Library [JavaSE-1.7]

                           /build

                           /resources

                           /target

                           pom.xml

                       

                      The above project does not match the example on the guide where it looks like:

                       

                      arquillian_tutorial_eclipse_project.png

                      I do not have src/main/java, src/main/resources, src/test/java and src/test/resources.  Can anyone explain to me why?

                       

                      I then wrote a JUnit test for a session bean.  The session bean code is below:

                       

                      @Stateless

                      public class AccountBean implements AccountLocal {

                       

                             @PersistenceContext(unitName = "mydb")

                             private EntityManager entityManager;

                       

                           public Boolean findUser( final String username ) {

                       

                                return true;

                             }

                      }

                       

                      The AccountLocal interface is:

                      @Local

                      public interface AccountLocal {

                       

                        public Boolean findUser( final String username );

                      }

                       

                      The JUnit test code is:

                       

                      @RunWith(Arquillian.class)

                      public class AccountUnitTest {

                       

                       

                        @Deployment

                          public static JavaArchive createDeployment() {

                                  JavaArchive jar = ShrinkWrap.create(JavaArchive.class)    

                                      .addClass(AccountBean.class)

                                      .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

                                       System.out.println(jar.toString(true));

                                       return jar;

                          }

                       

                         @EJB

                        AccountLocal accountLocal;

                       

                       

                        @Test

                        public void findUser(){

                             UserValue user = accountBean.findUser("admin");

                             assertEquals(true, user);

                        }

                       

                      When I run the test from Eclipse I get the following error message:

                       

                      java.lang.NoSuchMethodError: org.jboss.arquillian.container.spi.client.deployment.Validate.archiveHasExpectedFileExtension(Lorg/jboss/shrinkwrap/api/Archive;)Z

                        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.logWarningIfArchiveHasUnexpectedFileExtension(AnnotationDeploymentScenarioGenerator.java:130)

                        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:100)

                        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:62)

                        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)

                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                        at java.lang.reflect.Method.invoke(Method.java:616)

                       

                      I have also run the test from a terminal using the command mvn test and the output is:

                       

                      [INFO] Scanning for projects...

                      [INFO]                                                                      

                      [INFO] ------------------------------------------------------------------------

                      [INFO] Building my-app-ejb.test 0.0.1-SNAPSHOT

                      [INFO] ------------------------------------------------------------------------

                      [INFO]

                      [INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ my-app-ejb.test ---

                      [INFO] Using 'UTF-8' encoding to copy filtered resources.

                      [INFO] skip non existing resourceDirectory /home/max/src/main/resources

                      [INFO]

                      [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @my-app-ejb.test ---

                      [INFO] No sources to compile

                      [INFO]

                      [INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ my-app-ejb.test ---

                      [INFO] Using 'UTF-8' encoding to copy filtered resources.

                      [INFO] skip non existing resourceDirectory /home/max/src/test/resources

                      [INFO]

                      [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ my-app-ejb.test ---

                      [INFO] No sources to compile

                      [INFO]

                      [INFO] --- maven-surefire-plugin:2.12:test (default-test) @ my-app-ejb.test ---

                      [INFO] No tests to run.

                      [INFO] Surefire report directory: /home/max/target/surefire-reports

                       

                      -------------------------------------------------------

                      T E S T S

                      -------------------------------------------------------

                       

                      Results :

                       

                      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

                       

                      [INFO] ------------------------------------------------------------------------

                      [INFO] BUILD SUCCESS

                      [INFO] ------------------------------------------------------------------------

                      [INFO] Total time: 1.249s

                      [INFO] Finished at: Wed Aug 28 13:20:10 NZST 2013

                      [INFO] Final Memory: 6M/239M

                      [INFO] ------------------------------------------------------------------------

                       

                      Here is my pom.xml:

                       

                      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

                        <modelVersion>4.0.0</modelVersion>

                        <groupId>my-app-ejb</groupId>

                        <artifactId>my-app-ejb</artifactId>

                        <version>0.0.1-SNAPSHOT</version>

                        <packaging>jar</packaging>

                       

                        <properties>

                              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

                          </properties>

                       

                          <build>

                        <sourceDirectory>src</sourceDirectory>

                        <testSourceDirectory>test</testSourceDirectory>

                        <plugins>

                        <plugin>

                        <artifactId>maven-compiler-plugin</artifactId>

                        <version>3.1</version>

                        <configuration>

                        <source>1.6</source>

                        <target>1.6</target>

                        </configuration>

                        </plugin>

                        <plugin>

                          <artifactId>maven-surefire-plugin</artifactId>

                          <version>2.15</version>

                        </plugin>

                        </plugins>

                        </build>

                      <dependencies>

                        <dependency>

                        <groupId>junit</groupId>

                        <artifactId>junit</artifactId>

                        <version>4.11</version>

                        </dependency>

                      .

                      .

                      .

                      .

                      .

                      <dependency>

                                  <groupId>org.jboss.arquillian</groupId>

                                  <artifactId>arquillian-bom</artifactId>

                                  <version>1.1.1.Final</version>

                                  <scope>import</scope>

                                  <type>pom</type>

                              </dependency>

                        <dependency>

                        <groupId>org.jboss.arquillian.junit</groupId>

                        <artifactId>arquillian-junit-container</artifactId>

                        <version>1.1.0.Final</version>

                        </dependency>

                        <dependency>

                        <groupId>org.jboss.arquillian.container</groupId>

                        <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>

                        <version>1.0.0.CR7</version>

                        </dependency>

                        <dependency>

                        <groupId>org.jboss.weld</groupId>

                        <artifactId>weld-core</artifactId>

                        <version>2.0.3.Final</version>

                        </dependency>

                        <dependency>

                        <groupId>org.slf4j</groupId>

                        <artifactId>slf4j-simple</artifactId>

                        <version>1.7.5</version>

                        </dependency>

                      <dependency>

                        <groupId>org.jboss.spec</groupId>

                        <artifactId>jboss-javaee-6.0</artifactId>

                        <version>3.0.2.Final</version>

                        <type>pom</type>

                        </dependency>

                      </dependencies>

                      </project>

                       

                      I am just guessing that when converting the Java project to Maven the latter packaging structure did not occur.  Can anyone help me please?

                       

                      Thanks

                      • 8. Re: Remote JNDI lookup for JUnit tests
                        max010

                        I have changed approach and created a complete new maven project.

                        The directory structure is:

                         

                        my-app-ejb

                             src/main/java

                                  /ejb.account

                                       AccountBean.java

                                       AcoountLocal.java

                             src/main/resources

                             src/test/java

                                  /test.account

                                       AccountUnitTest.java

                             src/test/resources

                                  arquillian.xml

                            /Maven Dependencies

                            /JRE System Library [JavaSE-1.7]

                             /build

                             /resources

                             /target

                             pom.xml

                         

                        Here is the content of my pom.xml:

                         

                        <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

                          <modelVersion>4.0.0</modelVersion>

                          <groupId>my-app-ejb</groupId>

                          <artifactId>my-app-ejb</artifactId>

                          <version>0.0.1-SNAPSHOT</version>

                          <packaging>jar</packaging>

                         

                         

                          <properties>

                               <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

                          </properties>

                         

                         

                          <build>

                               <plugins>

                                    <plugin>

                                         <artifactId>maven-compiler-plugin</artifactId>

                                         <version>3.1</version>

                                         <configuration>

                                              <source>1.6</source>

                                              <target>1.6</target>

                                        </configuration>

                                    </plugin>

                               <plugin>

                                    <artifactId>maven-surefire-plugin</artifactId>

                                    <version>2.15</version>

                               </plugin>

                          </plugins>

                          </build>

                        <dependencyManagement>

                               <dependencies>

                                    <dependency>

                                         <groupId>org.jboss.arquillian</groupId>

                                         <artifactId>arquillian-bom</artifactId>

                                         <version>1.1.1.Final</version>

                                         <scope>import</scope>

                                         <type>pom</type>

                                         </dependency>

                               </dependencies>

                          </dependencyManagement>

                         

                         

                          <dependencies>

                               <dependency>

                               <groupId>junit</groupId>

                              <artifactId>junit</artifactId>

                               <version>4.11</version>

                               <scope>test</scope>

                          </dependency>

                        .

                        .

                        .

                           <dependency>

                               <groupId>org.jboss.arquillian</groupId>

                               <artifactId>arquillian-bom</artifactId>

                               <version>1.1.1.Final</version>

                               <scope>import</scope>

                               <type>pom</type>

                           </dependency>

                          <dependency>

                               <groupId>org.jboss.arquillian.junit</groupId>

                               <artifactId>arquillian-junit-container</artifactId>

                               <scope>test</scope>

                          </dependency>

                          <dependency>

                               <groupId>xalan</groupId>

                               <artifactId>xalan</artifactId>

                               <version>2.7.1</version>

                          </dependency>

                          </dependencies>

                        <profiles>

                          <profile>

                               <id>arquillian-jbossas-managed</id>

                               <dependencies>

                                      <dependency>

                                         <groupId>org.jboss.bom</groupId>

                                         <artifactId>jboss-javaee-6.0-with-all</artifactId>

                                         <version>1.0.7.CR10</version>

                                         <type>pom</type>

                                    </dependency>

                                    <dependency>

                                         <groupId>org.jboss.as</groupId>

                                         <artifactId>jboss-as-arquillian-container-managed</artifactId>

                                         <version>7.2.0.Final</version>

                                         <scope>test</scope>    

                                    </dependency>

                                    <dependency>

                                         <groupId>org.jboss.arquillian.protocol</groupId>

                                         <artifactId>arquillian-protocol-servlet</artifactId>

                                         <scope>test</scope>

                                    </dependency>

                               </dependencies>

                          </profile>

                          </profiles>

                         

                        I am only trying to run 1 test (see below)

                         

                        @RunWith(Arquillian.class)

                        public class AccountUnitTest {

                         

                         

                          @Deployment

                            public static JavaArchive createDeployment() {

                                return ShrinkWrap.create(JavaArchive.class)

                                    .addClass(AccountBean.class)

                                    .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

                            }

                         

                          @EJB

                          AccountLocal accountLocal;

                         

                          @Test

                          public void findUser(){

                          UserValue user = accountLocal.findUser("admin");

                          boolean userFound = false;

                          if(user != null) {

                          userFound = true;

                          }

                        I get the ClassNotFoundException for the AccountLocal interface:

                         

                        Running com.my-app-ejb.test.account.AccountUnitTest

                        Aug 30, 2013 3:14:59 PM org.jboss.as.arquillian.container.managed.ManagedDeployableContainer startInternal

                        INFO: Starting container with: [/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java, -Xmx512m, -XX:MaxPermSize=128m, -ea, -Djboss.home.dir=/opt/jboss7/jboss-eap-6.1, -Dorg.jboss.boot.log.file=/opt/jboss7/jboss-eap-6.1/standalone/log/boot.log, -Dlogging.configuration=file:/opt/jboss7/jboss-eap-6.1/standalone/configuration/logging.properties, -Djboss.bundles.dir=/opt/jboss7/jboss-eap-6.1/bundles, -jar, /opt/jboss7/jboss-eap-6.1/jboss-modules.jar, -mp, /opt/jboss7/jboss-eap-6.1/modules, -jaxpmodule, javax.xml.jaxp-provider, org.jboss.as.standalone, -server-config, standalone.xml]

                        15:15:00,509 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)

                        15:15:01,009 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-9) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss7/jboss-eap-6.1/standalone/deployments

                        15:15:06,373 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "test.war" (runtime-name: "test.war")

                        15:15:06,676 WARN  [org.jboss.modules] (MSC service thread 1-13) Failed to define class com.my-app-ejb.ejb.account.AccountBean in Module "deployment.test.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/my-app-ejb/ejb/account/AccountBean (Module "deployment.test.war:main" from Service Module Loader)

                          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:427) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:260) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:75) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at org.jboss.modules.Module.loadModuleClass(Module.java:526) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:188) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_25]

                          at java.lang.Class.forName(Class.java:270) [rt.jar:1.7.0_25]

                          at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54)

                          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:85) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                          at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120)

                          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]

                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]

                          at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]

                        Caused by: java.lang.NoClassDefFoundError: com/my-app-ejb/ejb/account/AccountLocal

                          at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_25]

                          at java.lang.ClassLoader.defineClass(ClassLoader.java:788) [rt.jar:1.7.0_25]

                          at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:344) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:422) [jboss-modules.jar:1.2.0.Final-redhat-1]

                          ... 19 more

                        Caused by: java.lang.ClassNotFoundException: com.my-app-ejb.ejb.account.AccountLocal from [Module "deployment.test.war:main" from Service Module Loader]

                          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) [jboss-modules.jar:1.2.0.Final-redhat-1]

                         

                        When running the test from Eclipse I can see that the AccountLocal.java interface is missing from the deployed .jar (see below).

                         

                        09:20:13,271 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-11) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss7/jboss-eap-6.1/standalone/deployments

                        97c43801-ca88-4784-94ef-13a055e936c4.jar:

                        /com/

                        /com/my-app-ejb/

                        /com/my-app-ejb/

                        /com/my-app-ejb/ejb/

                        /com/my-app-ejb/ejb/account/

                        /com/my-app-ejb/ejb/account/AccountBean.class

                        /META-INF/

                        /META-INF/beans.xml

                         

                        Why is the AccountLocal.class not included in the .jar?

                        Has anyone any idea what I am doing wrong?