maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Mistroni" <mmistr...@gmail.com>
Subject Re: DESPERATE: JBoss EJB3 embeddable container fails under surefire?
Date Mon, 20 Mar 2006 17:38:13 GMT
Hello All,
 i am trying the same.... and what i get?

-------------------------------------------------------------------------------
Battery: example1.EJB3ContainerTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.047 sec

testMethod1(example1.EJB3ContainerTest)  Time elapsed: 0.015 sec  <<< ERROR!

[ stdout ] ---------------------------------------------------------------



[ stderr ] ---------------------------------------------------------------

---- bootstrapping EJB3 container....
...... deploying embedded-jboss-beans....


[ stacktrace ] -----------------------------------------------------------

java.lang.NoClassDefFoundError: org/jboss/logging/Logger
    at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.<clinit>(
EJB3StandaloneDeployer.java:137)


My assumption is that, because i am including microcontainer libraries using
system scope, they don't turn out at test time since
org.jboss.logging.Logger is part of jboss-common.jar whic is CLEARLY listed
as dependency of my pom.xml

here is  my pom (i attach at the end aslo the ejb test class);;

-------- pom.xml ------------
<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>root</groupId>
   <artifactId>ejbs</artifactId>
   <packaging>jar</packaging>
   <version>1.0</version>
   <name>enterprise java beans</name>
   <parent>
      <groupId>root</groupId>
      <artifactId>project</artifactId>
      <version>1.0</version>
   </parent>
   <pluginRepositories>
         <pluginRepository>
            <id>apache.snapshots</id>
            <url>http://cvs.apache.org/maven-snapshot-repository</url>
         </pluginRepository>
   </pluginRepositories>
   <repositories>
         <repository>
           <id>apache.snapshots</id>
           <url>http://cvs.apache.org/maven-snapshot-repository</url>
         </repository>
   </repositories>
   <dependencies>
      <dependency>
         <groupId>root</groupId>
         <artifactId>shared</artifactId>
      </dependency>
      <dependency>
         <groupId>geronimo-spec</groupId>
         <artifactId>geronimo-spec-j2ee</artifactId>
     <scope>provided</scope>
       </dependency>
       <dependency>
         <groupId>jboss</groupId>
         <artifactId>jboss-ejb3x</artifactId>
         <version>4.0.4</version>
         <scope>system</scope>
         <systemPath>${basedir}\lib\jboss-ejb3x-4.0.4.jar</systemPath>
      </dependency>
      <dependency>
         <groupId>jboss</groupId>
         <artifactId>ejb3-persistence</artifactId>
         <version>4.0.4</version>
         <scope>system</scope>
         <systemPath>${basedir}\lib\ejb3-persistence-4.0.4.jar</systemPath>
      </dependency>
      <dependency>
         <groupId>org.testng</groupId>
         <artifactId>testng</artifactId>
         <version>4.6.1</version>
         <scope>test</scope>
         <classifier>jdk15</classifier>
      </dependency>


      <!-- JBoss Microcontainer dependencies (for tests)-->

      <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>asm</artifactId>
            <version>current</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\asm-current.jar</systemPath>

      </dependency>
      <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>asm</artifactId>
           <version>attrs</version>
           <scope>system</scope>
           <systemPath>${basedir}\microcontainer\jars\asm-attrs.jar
</systemPath>
      </dependency>
      <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>cglib</artifactId>
           <version>2.1.1</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\cglib-2.1.1.jar
</systemPath>
      </dependency>


      <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>commons</artifactId>
           <version>collections</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\commons-collections.jar</systemPath>

      </dependency>
      <dependency>
          <groupId>microcontainer</groupId>
          <artifactId>commons</artifactId>
          <version>logging</version>
          <scope>system</scope>
          <systemPath>${basedir}\microcontainer\jars\commons-logging.jar</systemPath>

       </dependency>
       <dependency>
          <groupId>microcontainer</groupId>
          <artifactId>commons</artifactId>
          <version>logging-api</version>
          <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\commons-logging-api.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>hsqldb</artifactId>
           <version>current</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\hsqldb-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss-annotations</artifactId>
           <version>ejb3</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-
annotations-ejb3.jar</systemPath>
       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss-aop</artifactId>
           <version>jdk50</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-aop-jdk50.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss-aspect-library</artifactId>
         <version>jdk50</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-
aspect-library-jdk50.jar</systemPath>
       </dependency>

       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>common</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-common.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss-common</artifactId>
           <version>jdbc-wrapper</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-
common-jdbc-wrapper.jar</systemPath>
       </dependency>
       <dependency>
            <groupId>microcontainer</groupId>
            <artifactId>jboss</artifactId>
            <version>concurrent</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-concurrent.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>container</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-container.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>current</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-current.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>dependency</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-dependency.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>ejb3</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-ejb3.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>j2ee</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-j2ee.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>j2se</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-j2se.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>jca</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-jca.jar</systemPath>
       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss-local</artifactId>
         <version>jdbc</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-local-jdbc.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>microcontainer</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-microcontainer.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jbossmq</artifactId>
           <version>current</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jbossmq-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>namespace</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-namespace.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss</artifactId>
         <version>remoting</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-remoting.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jbosssx</artifactId>
           <version>current</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jbosssx-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>system</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-system.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss</artifactId>
           <version>transaction</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-transaction.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>jboss-xa</artifactId>
           <version>jdbc</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\jboss-xa-jdbc.jar</systemPath>

       </dependency>
       <dependency>
            <groupId>microcontainer</groupId>
            <artifactId>jnpserver</artifactId>
            <version>current</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jnpserver-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>log4j</artifactId>
           <version>current</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\log4j-current.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>resolver</artifactId>
         <version>current</version>
         <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\resolver-current.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>trove</artifactId>
           <version>current</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\trove-current.jar</systemPath>

       </dependency>
       <dependency>
            <groupId>microcontainer</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>jboss</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\xercesImpl-jboss.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>xml-apis</artifactId>
           <version>jboss</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\xml-apis-jboss.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>hibernate</artifactId>
         <version>3</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\hibernate-3.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>hibernate</artifactId>
           <version>entitymanager</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\hibernate-entitymanager.jar</systemPath>

       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>hibernate</artifactId>
           <version>annotations</version>
            <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\hibernate-
annotations.jar</systemPath>
       </dependency>
       <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>dom4j</artifactId>
           <version>current</version>
            <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\dom4j-current.jar</systemPath>

       </dependency>
       <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>javassist</artifactId>
         <version>current</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\javassist-current.jar</systemPath>

       </dependency>
        <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>ehcache</artifactId>
           <version>1.1</version>
           <scope>system</scope>
     <systemPath>${basedir}\microcontainer\jars\ehcache-1.1.jar</systemPath>

    </dependency>
    <dependency>
               <groupId>microcontainer</groupId>
               <artifactId>jboss</artifactId>
               <version>ejb3</version>
               <scope>system</scope>
         <systemPath>${basedir}\microcontainer\jars\jboss-ejb3.jar</systemPath>

    </dependency>
   </dependencies>
   <build>
      <plugins>


         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
               <encoding>iso-8859-1</encoding>
            </configuration>
         </plugin>




         <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
         <suiteXmlFiles><suiteXmlFile>testng.xml
</suiteXmlFile></suiteXmlFiles>
        </configuration>
       </plugin>


        <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
         <executions>
           <execution>
             <phase>generate-sources</phase>
                 <configuration>
                   <tasks>
                   </tasks>
                 </configuration>
                 <goals>
                   <goal>run</goal>
                 </goals>
               </execution>
             </executions>
         </plugin>
      </plugins>
   </build>
</project>


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

and here's my test, whic does not test anything so far but it is supposed to
be the
base class for every test

------ EJB3 test -------
/**
 * Boots the JBoss Microcontainer with an EJB3 configuration.
 * <p>
 * You can also use this class to lookup managed beans from JNDI.
 *
 * @author christian.bauer@jboss.com
 */
public class EJB3ContainerTest extends TestCase{

    private static InitialContext initialContext;
    private EJB3StandaloneDeployer deployer;

    public void setUp() {
        try {

        System.err.println("---- bootstrapping EJB3 container....");

            // Boot the JBoss Microcontainer with EJB3 settings, loads
ejb3-interceptors-aop.xml
            EJB3StandaloneBootstrap.boot(null);
            System.err.println("...... deploying embedded-jboss-beans....");
            // Deploy CaveatEmptor beans (datasource, mostly)
            //EJB3StandaloneBootstrap.deployXmlResource("/embedded-
jboss-beans.xml");
            //EJB3StandaloneBootstrap.deployXmlResource("/embedded-
jboss-beans.xml");
            //EJB3StandaloneBootstrap.deployXmlResource("/embedded-
jboss-beans.xml");
        EJB3StandaloneBootstrap.scanClasspath();

        System.err.println("...... embedded-jboss-beans deployed....");
        // Add all EJBs found in the archive that has this file
        deployer = new EJB3StandaloneDeployer();

        System.err.println("...... deploying MM ejb3.....");
        System.err.println("...... ejb3 deployed....");
        // Deploy everything we got
        deployer.create();
        System.err.println("...... deployer created....");

        deployer.start();
        System.err.println("...... deployer started....");

        // Create InitialContext from jndi.properties
        initialContext = new InitialContext();


        System.err.println("---- end of bootstrapping EJB3 container....");

        } catch (Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
    }





    public void tearDown() {
        try {
            System.err.println("---- Invoking EJB3.shutdown..");
            deployer.stop();
            deployer.destroy();
            EJB3StandaloneBootstrap.shutdown();
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }


    public void testMethod1() {
        System.err.println("EJB3CONTAINER.....  TESTING1");
    }


     public static Test suite() {
          return new TestSuite(EJB3ContainerTest.class);
    }



    public static Object lookup(String beanName) {
        try {
            return initialContext.lookup(beanName);
        } catch (NamingException ex) {
            throw new RuntimeException("Couldn't lookup: " + beanName, ex);
        }
    }
}

i have successfully used testng plugin wtih maven1.1 but with maven2 it
looks like plugin has some bugs.....

anyone could help me out starting from this pom & test?

thanks and regards
 marco

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message