1 2 Previous Next 19 Replies Latest reply on Apr 22, 2013 8:15 AM by bmajsak

    DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance

    welocity

      Hi,

       

      I am developping a Java EE entreprise applicaiton using Netbeans 7.1, Maven2 and Glassfish3.

      I created entities and DAO facades which i want to test with Arquillian. I followed the Arquillian Getting started and JPA persistance Tutorials.

      I have tryied a long time with no success to make work, though it's supposed to be simple.

      I could make one test with dependency injection from First tutorial but not with dependency injection.

       

      Error message when tests ran:

      Exception while preparing the app: java.lang.classNotFoundException org.hibernate.ejb.HibernatePersistance.

       

       

      Here are configuration files.

      If you want you can find EJB module in this link you can get EJB module from this link: https://dl.dropboxusercontent.com/u/55939918/EJB.rar

       

      pesistance.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

        <persistence-unit name="FLAMS-PU" transaction-type="JTA">

          <provider>org.hibernate.ejb.HibernatePersistence</provider>

          <jta-data-source>flams_ds</jta-data-source>

          <exclude-unlisted-classes>false</exclude-unlisted-classes>

          <properties>

            <property name="hibernate.hbm2ddl.auto" value="update"/>

          </properties>

        </persistence-unit>

      </persistence>

       

      //Arquillian.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <arquillian xmlns="http://jboss.org/schema/arquillian"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="

              http://jboss.org/schema/arquillian

              http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

          <container qualifier="glassfish-embedded" default="true">

              <configuration>

                  <property name="resourcesXml">

                      src/test/resources-glassfish-embedded/glassfish-resources.xml

                  </property>

              </configuration>

          </container>

      </arquillian>

       

      //Glassfish-resources.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE resources PUBLIC

          "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN"

          "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">

      <resources>

          <jdbc-resource pool-name="ArquillianEmbeddedDerbyPool"

              jndi-name="jdbc/arquillian"/>

          <jdbc-connection-pool name="ArquillianEmbeddedDerbyPool"

              res-type="javax.sql.DataSource"

              datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource"

              is-isolation-level-guaranteed="false">

              <property name="databaseName" value="target/databases/derby"/>

              <property name="createDatabase" value="create"/>

          </jdbc-connection-pool>

      </resources>

       

      //Test-persistance.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="

              http://java.sun.com/xml/ns/persistence

              http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

          <persistence-unit name="test">

              <jta-data-source>jdbc/arquillian</jta-data-source>

              <properties>

                  <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>

                  <property name="eclipselink.logging.level.sql" value="FINE"/>

                  <property name="eclipselink.logging.parameters" value="true"/>

              </properties>

          </persistence-unit>

      </persistence>

       

      Snippet from pom.xml


      <dependency>

      <groupId>junit</groupId>

      <artifactId>junit</artifactId>

      <version>4.10</version>

      <scope>test</scope>

      </dependency>

      <!-- javaEE API-->

      <dependency>

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

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

      <version>1.0.0.Final</version>

      <type>pom</type>

      <scope>provided</scope>

      </dependency>

      <!-- Arquillian JUnit API-->

      <dependency>

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

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

      <scope>test</scope>

      </dependency>

      <dependency>

      <groupId>org.eclipse.persistence</groupId>

      <artifactId>eclipselink</artifactId>

      <version>2.3.2</version>

      <scope>provided</scope>

      </dependency>

      <dependency>

      <groupId>org.eclipse.persistence</groupId>

      <artifactId>javax.persistence</artifactId>

      <version>2.0.3</version>

      <scope>provided</scope>

      </dependency>

      <dependency>

      <groupId>org.eclipse.persistence</groupId>

      <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>

      <version>2.3.2</version>

      <scope>provided</scope>

      </dependency>

       

      <profile>

              <!-- Arquillian Glassfish container adapter-->

              <activation>

                  <activeByDefault>true</activeByDefault>

              </activation>

              <id>arquillian-glassfish-remote</id>

              <dependencies>

                  <dependency>

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

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

                      <version>1.0.0.Final</version>

                      <type>pom</type>

                      <scope>provided</scope>

                  </dependency>

                  <dependency>

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

                      <artifactId>weld-api</artifactId>

                      <version>1.1.Final</version>

                      <scope>test</scope>

                  </dependency>

                  <dependency>

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

                      <artifactId>arquillian-glassfish-remote-3.1</artifactId>

                      <version>1.0.0.CR3</version>

                      <scope>test</scope>

                  </dependency>

              </dependencies>

              <build>

              <testResources>

                  <testResource>

                      <directory>src/test/resources</directory>

                  </testResource>

                  <testResource>

                      <directory>src/test/resources-glassfish-embedded</directory>

                  </testResource>

              </testResources>

              <plugins>

                  <plugin>

                      <groupId>org.apache.maven.plugins</groupId>

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

                      <version>2.12</version>

                      <configuration>

                          <systemPropertyVariables>

                              <java.util.logging.config.file>

                                  ${project.build.testOutputDirectory}/logging.properties

                              </java.util.logging.config.file>

                              <derby.stream.error.file>

                                  ${project.build.directory}/derby.log

                              </derby.stream.error.file>

                          </systemPropertyVariables>

                      </configuration>

                  </plugin>

              </plugins>

          </build>

          </profile>

       

      Snippet from DAO class:

      @RunWith(Arquillian.class)

      public class AlertFacadeTest {

       

          @Deployment

          public static JavaArchive createDeployment(){

              return ShrinkWrap.create(JavaArchive.class)

                      .addClasses(Alert.class)

                      .addPackage(AlertFacade.class.getPackage())

                      .addAsManifestResource("META-INF/persistence.xml", "persistence.xml")

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

          }

       

          public AlertFacadeTest() {

          }

       

          /**

           * Test of create method, of class AlertFacade.

           */

          @Test

          public void testCreate() throws Exception {

              System.out.println("create");

              Alert entity = null;

              EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();

              AlertFacadeLocal instance = (AlertFacadeLocal)container.getContext().lookup("java:global/classes/AlertFacade");

              instance.create(entity);

              container.close();

              // TODO review the generated test code and remove the default call to fail.

              fail("The test case is a prototype.");

          }

        • 1. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
          bmajsak

          Glassfish does not come with Hibernate bundled. You need to either bundle it with your test archive or use shared library.

          • 2. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
            welocity

            I already added hibernate as module dependency. Can you please, give further explanations on how to bundle hibernate with test archive ?

            • 3. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
              bmajsak

              I hope you will find this guide helpful Probably you will need to change from JavaArchive to (preferably) WebArchive or EnterpriseArchive to add libraries. But that's minor change.

              • 4. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                welocity

                Hi, i'm still trying to get arquillian to work. I read the following tutorial http://stijnvp.wordpress.com/2012/09/22/using-arquillian-to-create-ejb-and-jpa-integration-tests-on-glassfish-with-an-in-memory-derby-for-testing-and-mysql-for-production/ and it's exactly what i want to accomplish .

                 

                When i test the project i get the following error :

                Tests in error:

                  com.procc.dao.EmployeeFacadeTest: Could not setup GlassFish Embedded Runtime

                 

                I'm using netbeans 7.2.1, glassfish3, EJB3.1 and JPA2.0. Arquillian 1.0.2.Final

                below configuration files i used.

                 

                glassfish profile ( I joined pom.xml to this message)


                <profile>

                <id>arquillian-glassfish-embedded</id>

                <dependencies>

                <dependency>

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

                <artifactId>arquillian-glassfish-embedded-3.1</artifactId>

                <version>${arquillan.glassfish.embedded.version}</version>

                <scope>test</scope>

                </dependency>

                <dependency>

                <groupId>org.glassfish.main.extras</groupId>

                <artifactId>glassfish-embedded-all</artifactId>

                <version>3.1.2</version>

                <scope>provided</scope>

                </dependency>

                </dependencies>

                </profile>

                 

                Below is package hierarchy for test configuration files:

                -EJBProject-root

                     -Source packages

                     -Test packages

                     -Other Test Sources

                           -src/test/resources

                               -EmployeeDataset.xml

                               -Arquillian.xml

                               -META-INF

                                    -persistance.xml

                           -resources-glassfish-embedded

                              -glassfish-resources.xml

                 

                glassfish-resources.xml

                <?xml version="1.0" encoding="UTF-8"?>

                <!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">

                <resources>

                  <jdbc-connection-pool name="ArquillialFlamsPool" allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">

                    <property name="URL" value="jdbc:mysql://localhost:3306/flams_schema?zeroDateTimeBehavior=convertToNull"/>

                    <property name="User" value="root"/>

                    <property name="Password" value="root"/>

                  </jdbc-connection-pool>

                  <jdbc-resource jndi-name="jdbc/flams_test" pool-name="ArquillialFlamsPool" />

                </resources>

                 

                persistance.xml

                <?xml version="1.0" encoding="UTF-8"?>

                <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="         http://java.sun.com/xml/ns/persistence         http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

                    <persistence-unit name="arquillian-PU" transaction-type="JTA">

                        <provider>org.hibernate.ejb.HibernatePersistence</provider>

                        <jta-data-source>jdbc/flams_test</jta-data-source>

                        <exclude-unlisted-classes>false</exclude-unlisted-classes>

                        <properties>

                            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>

                        </properties>

                    </persistence-unit>

                </persistence>

                 

                arquillian.xml

                <?xml version="1.0" encoding="UTF-8"?>

                <arquillian xmlns="http://jboss.org/schema/arquillian"

                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                    xsi:schemaLocation="

                        http://jboss.org/schema/arquillian

                        http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

                   <engine>

                        <property name="deploymentExportPath">target/arquillian</property>

                    </engine>

                    <container default="true" qualifier="glassfish">

                        <configuration>

                            <property name="sunResourcesXml">src/test/resources-glassfish-embedded/glassfish-resources.xml

                            </property>

                        </configuration>

                    </container>

                    <extension qualifier="persistence">

                        <property name="defaultDataSource">jdbc/flams_test</property>

                    </extension>

                </arquillian>

                 

                EmployeeFacadeTest

                @RunWith(Arquillian.class)

                @PersistenceTest

                @Transactional(TransactionMode.ROLLBACK)

                public class EmployeeFacadeTest {

                 

                 

                    @Deployment

                    public static JavaArchive createTestArchive() {

                    return ShrinkWrap.create(JavaArchive.class, "test.jar") // Create jar

                            .addPackage(Employee.class.getPackage()) // Add classes

                            .addPackage(EmployeeFacade.class.getPackage()) // Add more classes

                            // FEST Assert is not part of Arquillian JUnit

                            .addPackages(true, "org.fest")

                            // .addClasses(Person.class, PersonBean.class) is an alternative

                            // for addPackage

                            .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")) // b

                            .addAsResource("META-INF/persistence.xml");

                    }

                 

                    public EmployeeFacadeTest() {

                    }

                 

                    /**

                     * Test of create method, of class EmployeeFacade.

                     */

                    @Test

                    public void testCreate() throws Exception {

                        System.out.println("create");

                        Employee entity = null;

                        EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();

                        EmployeeFacadeLocal instance = (EmployeeFacadeLocal)container.getContext().lookup("java:global/classes/EmployeeFacade");

                        instance.create(entity);

                        container.close();

                        fail("The test case is a prototype.");

                    }

                ...

                 

                EmployeeFacade

                @Stateless

                public class EmployeeFacade extends AbstractFacade<Employee> implements EmployeeFacadeLocal {

                    @PersistenceContext(unitName = "FLAMS-PU")

                    private EntityManager em;

                 

                    @Override

                    protected EntityManager getEntityManager() {

                        return em;

                    }

                 

                    public EmployeeFacade() {

                        super(Employee.class);

                    }

                }

                 

                I am using postgreSQL for production database and chose mySQL for test database.

                Please help is really needed, i must finish the project very soon and i did'nt accomplish too much already.

                Sorry for the embedded source code, i could'nt find out how to put it into a Code tag.

                • 5. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                  bmajsak

                  Full stack trace would be very helpful

                  • 6. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                    welocity

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

                    T E S T S

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

                    Running com.procc.dao.AirportTest

                    Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.1 sec <<< FAILURE!

                    Running com.procc.dao.EmployeeFacadeTest

                    avr. 19, 2013 9:02:29 PM org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishConfiguration setSunResourcesXml

                    WARNING: The sunResourcesXml property deprecated. Please use resourcesXml. See http://docs.oracle.com/cd/E18930_01/html/821-2417/giyhh.html

                    SLF4J: Class path contains multiple SLF4J bindings.

                    SLF4J: Found binding in [jar:file:/C:/Users/ramzi/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]

                    SLF4J: Found binding in [jar:file:/C:/Users/ramzi/.m2/repository/org/glassfish/main/extras/glassfish-embedded-all/3.1.2/glassfish-embedded-all-3.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]

                    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

                    SLF4J: The requested version 1.5.6 by your slf4j binding is not compatible with [1.6]

                    SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.

                    avr. 19, 2013 9:02:33 PM com.sun.enterprise.v3.admin.CommandRunnerImpl doCommand

                    SEVERE: Exception in command execution : java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;

                    java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;

                        at org.slf4j.impl.JDK14LoggerAdapter.info(JDK14LoggerAdapter.java:303)

                        at org.hibernate.validator.util.Version.<clinit>(Version.java:24)

                        at org.hibernate.validator.engine.ConfigurationImpl.<clinit>(ConfigurationImpl.java:59)

                        at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:41)

                        at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)

                        at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)

                        at org.jvnet.hk2.config.WriteableView.<init>(WriteableView.java:112)

                        at org.jvnet.hk2.config.ConfigSupport.getWriteableView(ConfigSupport.java:214)

                        at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:359)

                        at com.sun.enterprise.v3.admin.SetCommand.set(SetCommand.java:345)

                        at com.sun.enterprise.v3.admin.SetCommand.execute(SetCommand.java:123)

                        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)

                        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)

                        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)

                        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)

                        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)

                        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)

                        at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.executeCommand(CommandExecutorImpl.java:147)

                        at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.run(CommandExecutorImpl.java:88)

                        at com.sun.enterprise.glassfish.bootstrap.ConfiguratorImpl.configure(ConfiguratorImpl.java:68)

                        at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.configure(GlassFishImpl.java:71)

                        at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.<init>(GlassFishImpl.java:65)

                        at com.sun.enterprise.glassfish.bootstrap.StaticGlassFishRuntime$1.<init>(StaticGlassFishRuntime.java:107)

                        at com.sun.enterprise.glassfish.bootstrap.StaticGlassFishRuntime.newGlassFish(StaticGlassFishRuntime.java:107)

                        at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.setup(GlassFishContainer.java:138)

                        at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.setup(GlassFishContainer.java:64)

                        at org.jboss.arquillian.container.impl.ContainerImpl.setup(ContainerImpl.java:181)

                        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$7.perform(ContainerLifecycleController.java:149)

                        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$7.perform(ContainerLifecycleController.java:145)

                        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255)

                        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.setupContainer(ContainerLifecycleController.java:144)

                        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:601)

                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

                        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                        at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)

                        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:601)

                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

                        at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

                        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:62)

                        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:55)

                        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachContainer(ContainerLifecycleController.java:209)

                        at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.setupContainers(ContainerLifecycleController.java:54)

                        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:601)

                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

                        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

                        at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

                        at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:85)

                        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:601)

                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

                        at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                        at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)

                        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:601)

                        at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

                        at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

                        at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

                        at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)

                        at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:97)

                        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)

                        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)

                        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)

                        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:601)

                        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)

                        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)

                        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)

                        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)

                        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)

                     

                    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.072 sec <<< FAILURE!

                     

                    Results :

                     

                    Failed tests:   testFacadeNotNull(com.procc.dao.AirportTest)

                     

                    Tests in error:

                      com.procc.dao.EmployeeFacadeTest: Could not setup GlassFish Embedded Runtime

                     

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

                    • 7. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                      bmajsak

                      Looks like you have some classloading issue here

                      java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;

                      please check if you don't have any slf4j version conflict

                      • 8. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                        welocity

                        I got slf4j-api-16.1 and slf4j-jdk14-1.5.6.

                        • 9. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                          bmajsak

                          This might be the problem. Please try to unify them (either 1.5 or 1.6 branch)

                          • 10. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                            welocity

                            I don't find them in pom.xml

                            • 11. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                              bmajsak

                              They are transitive then. Try

                              mvn dependency:tree

                              this should show you from which one it comes.

                              • 12. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                                welocity

                                I don't have maven installed on PC so i checked using maven dependencies graph. Both slf4j-api and slf4j-impl are dependencies of arquillian-persistance-impl.jar

                                Any ideo how to solve the problem ?

                                • 13. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                                  welocity

                                  helllp pleease!

                                  • 14. Re: DAO tests with Arquillian, class not found exception org.hibernate.ejb.HibernatePersistance
                                    bmajsak

                                    Please update Arquillian Core to 1.0.3.Final and persistence extension to 1.0.0.Alpha6.

                                    This should help. If not please attach your full pom.xml

                                    1 2 Previous Next