4 Replies Latest reply on Jun 24, 2008 12:15 PM by Kamil Demecki

    Wrong Maven pom file for JBoss embedded ?

    Olivier Thierry Apprentice

      Hi,

      I try to set up a JBoss embedded in a Maven 2 project, in order to use it for TestNG tests. I encountered classpath problems while starting the embedded server, and I am surprised nobody encoutered this since it is a problem with pom files on JBoss Maven repository !

      To set up the embedded container, as suggested by this post by cory_prowse : http://www.jboss.com/index.html?module=bb&op=viewtopic&t=126786
      I put these dependencies at first place in my pom.xml file :

      <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>thirdparty-all</artifactId>
       <version>beta3</version>
       <scope>provided</scope>
      </dependency>
      <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>hibernate-all</artifactId>
       <version>beta3</version>
       <scope>provided</scope>
      </dependency>
      <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>jboss-embedded-all</artifactId>
       <version>beta3</version>
       <scope>provided</scope>
      </dependency>


      First problem

      When I run mvn, it fails to resolve artifact org.jboss.embedded:jboss-embedded:jar:beta3-SNAPSHOT

      The problem is that jboss-embedded-all-beta3.pom file contains a dependency to a jar that is not on the repository. The beta3 is on repository, but not beta3-SNAPSHOT !

      Second problem

      To solve the first problem, I changed this pom file to have a dependency to beta3. But now I have this error :

      Caused by: java.lang.NoSuchMethodError: org.jboss.deployers.spi.structure.ContextInfo.getMetaDataPath()Ljava/util/List;
       at org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder.applyContextInfo(VFSStructureBuilder.java:93)
       at org.jboss.deployers.structure.spi.helpers.AbstractStructureBuilder.populateContext(AbstractStructureBuilder.java:73)
       ... 73 more


      The problem is that jboss-embedded-beta3.pom has this dependency :

      <groupId>org.jboss.microcontainer</groupId>
      <artifactId>jboss-deployers-client-spi</artifactId>
      <version>2.0.0.Beta6</version>


      This causes a conflict with classes embedded in jboss-embedded-all ! So you have to exclude this dependency to make it work.

      Finally my pom.xml file looks like this :

      <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>thirdparty-all</artifactId>
       <version>beta3</version>
       <scope>provided</scope>
      </dependency>
      <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>hibernate-all</artifactId>
       <version>beta3</version>
       <scope>provided</scope>
      </dependency>
      <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>jboss-embedded-all</artifactId>
       <version>beta3</version>
       <scope>provided</scope>
       <exclusions>
       <exclusion>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>jboss-embedded</artifactId>
       </exclusion>
       </exclusions>
      </dependency>
      <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>jboss-embedded</artifactId>
       <version>beta3</version>
       <scope>provided</scope>
       <exclusions>
       <exclusion>
       <groupId>org.jboss.microcontainer</groupId>
       <artifactId>jboss-deployers-client-spi</artifactId>
       </exclusion>
       </exclusions>
      </dependency>


      I still can't make my tests work (JNDI problem), but now it looks like the server starts OK.

      Is there a reason why I need to do this ? Or is it really a problem with files on JBoss Maven repository ?

        • 1. Re: Wrong Maven pom file for JBoss embedded ?
          Hernán Carrizo Newbie

          Hi, i have the same problem. I'm trying to execute my ejb3 test cases on the embedded jboss container.

          Since i'm using Eclipse to develop, i configure maven and eclipse for dependencies managment. Thats work's fine. If I execute the test case from Eclipse it works fine, but if i execute the command

          mvn test


          the test case failure. It looks like it could load the container but didn't deploy de EJB's. The stack trace is:

          Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.795 sec <<< FAILURE!
          sayHello(service.impl.HelloWorldServiceImplTest) Time elapsed: 0.02 sec <<< ERROR!
          java.lang.RuntimeException: Unable to find ejb for service.HelloWorldService
          ...
          ...
          Caused by: javax.naming.NameNotFoundException: HelloWorldService not bound
          ...
          ...
          


          If you make it work please notify us.

          Thanks!

          • 2. Re: Wrong Maven pom file for JBoss embedded ?
            Hernán Carrizo Newbie

             

            "owentar" wrote:
            Hi, i have the same problem. I'm trying to execute my ejb3 test cases on the embedded jboss container.

            Since i'm using Eclipse to develop, i configure maven and eclipse for dependencies managment. Thats work's fine. If I execute the test case from Eclipse it works fine, but if i execute the command

            mvn test


            the test case failure. It looks like it could load the container but didn't deploy de EJB's. The stack trace is:

            Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.795 sec <<< FAILURE!
            sayHello(service.impl.HelloWorldServiceImplTest) Time elapsed: 0.02 sec <<< ERROR!
            java.lang.RuntimeException: Unable to find ejb for service.HelloWorldService
            ...
            ...
            Caused by: javax.naming.NameNotFoundException: HelloWorldService not bound
            ...
            ...
            


            If you make it work please notify us.

            The example that i'm trying to make it work i take it from: http://schuchert.wikispaces.com/EJB3+Tutorial+1+-+Getting+Started+with+JBoss+Embedded+Container

            Thanks!
            [/url]

            • 3. Re: Wrong Maven pom file for JBoss embedded ?
              Alexander Naumenko Newbie

              Same problem here with dependency of jboss-embedded-all:beta3 from jboss-embedded:beta3-SNAPSHOT (which is not in jboss maven repository). I've just started with embedded jboss for junit testing, but I'm a little disappointed with project status (even if it's in "beta", sure it's "betta than nothing").
              Anyway, guys, you making great thing, good luck!

              • 4. Re: Wrong Maven pom file for JBoss embedded ?
                Kamil Demecki Novice

                 

                "owentar" wrote:
                "owentar" wrote:
                Hi, i have the same problem. I'm trying to execute my ejb3 test cases on the embedded jboss container.

                Since i'm using Eclipse to develop, i configure maven and eclipse for dependencies managment. Thats work's fine. If I execute the test case from Eclipse it works fine, but if i execute the command

                mvn test


                the test case failure. It looks like it could load the container but didn't deploy de EJB's. The stack trace is:

                Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.795 sec <<< FAILURE!
                sayHello(service.impl.HelloWorldServiceImplTest) Time elapsed: 0.02 sec <<< ERROR!
                java.lang.RuntimeException: Unable to find ejb for service.HelloWorldService
                ...
                ...
                Caused by: javax.naming.NameNotFoundException: HelloWorldService not bound
                ...
                ...
                


                If you make it work please notify us.

                The example that i'm trying to make it work i take it from: http://schuchert.wikispaces.com/EJB3+Tutorial+1+-+Getting+Started+with+JBoss+Embedded+Container

                Thanks!
                [/url]


                Maybe help something like this: (written from head, not checked ;)

                if (System.getProperty("eclipse.running") != null) {
                scanClassPath("youproject/bin".replace("/", File.separator)
                } else {
                scanClassPath("yourjar.jar")
                }