5 Replies Latest reply on Mar 28, 2013 10:31 PM by Sam W

    Missing class with junit testing in jboss 7.1.1.Final

    Sam W Expert

      Hi With jboss 7.1.1.Final, I created a junit test case with maven.

      But it failed with the following exception:

       

       

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

      Test set: HibernateSearchDateTest.facade.ProductArticleFacadeTest

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

      Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.33 sec <<< FAILURE!

      HibernateSearchDateTest.facade.ProductArticleFacadeTest  Time elapsed: 0 sec  <<< ERROR!

      java.lang.NoClassDefFoundError: org/hibernate/internal/util/ClassLoaderHelper

                at org.hibernate.ejb.Ejb3Configuration.<init>(Ejb3Configuration.java:173)

                at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:70)

                at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)

                at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)

                at HibernateSearchDateTest.facade.ProductArticleFacadeTest.<clinit>(ProductArticleFacadeTest.java:26)

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

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

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

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

                at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

                at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)

                at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)

                at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)

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

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

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

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

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

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

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

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

                at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)

                at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)

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

      Caused by: java.lang.ClassNotFoundException: org.hibernate.internal.util.ClassLoaderHelper

                at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

                ... 27 more

      HibernateSearchDateTest.facade.ProductArticleFacadeTest  Time elapsed: 0.002 sec  <<< ERROR!

      java.lang.NoClassDefFoundError: Could not initialize class HibernateSearchDateTest.facade.ProductArticleFacadeTest

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

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

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

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

                at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

                at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)

                at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)

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

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

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

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

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

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

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

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

                at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)

                at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)

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

       

       

      My pom.xml file is shown as below:

       

       

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

      <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>

          <parent>

          <artifactId>TestDate</artifactId>

          <groupId>HibernateSearchDateTest</groupId>

          <version>1.0</version>

        </parent>

       

       

          <groupId>HibernateSearchDateTest</groupId>

          <artifactId>TestDate-ejb</artifactId>

          <version>1.0</version>

          <packaging>ejb</packaging>

       

       

          <name>TestDate-ejb</name>

       

       

          <properties>

              <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>

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

              <log4j.version>1.2.14</log4j.version>

              <hibernate.version>4.1.7.Final</hibernate.version>

              <org.springframework-version>3.0.7.RELEASE</org.springframework-version>

          </properties>

       

       

          <dependencies>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-annotations</artifactId>

                  <version>3.5.6-Final</version>

              </dependency>

              <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-infinispan</artifactId>

                      <version>4.1.9.Final</version>

              </dependency>

              <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-entitymanager</artifactId>

                      <version>4.2.0.Final</version>

              </dependency>

              <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-core</artifactId>

                      <version>4.1.10.Final</version>

              </dependency>

              <dependency>

                      <groupId>org.hibernate.javax.persistence</groupId>

                      <artifactId>hibernate-jpa-2.0-api</artifactId>

                      <version>1.0.1.Final</version>

              </dependency>

              <dependency>

                      <groupId>javax.validation</groupId>

                      <artifactId>validation-api</artifactId>

                      <version>1.1.0.CR2</version>

              </dependency>

                 

              <!-- for testing -->

             

              <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-commons-annotations</artifactId>

                      <version>3.3.0.ga</version>

                      <type>pom</type>

              </dependency>

       

       

              <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>ejb3-persistence</artifactId>

                      <version>3.3.2.Beta1</version>

              </dependency>

                     

              <!-- end of for testing -->

             

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-search</artifactId>

                  <version>4.2.0.Final</version>

              </dependency>

              <!-- Additional Analyzers: -->

              <dependency>

                 <groupId>org.hibernate</groupId>

                 <artifactId>hibernate-search-analyzers</artifactId>

                 <version>4.2.0.Final</version>

              </dependency>

             

              <dependency>

                      <groupId>org.hibernate</groupId>

                      <artifactId>hibernate-search-orm</artifactId>

                      <version>4.2.0.Final</version>

                      <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-envers</artifactId>

                  <version>4.1.9.Final</version>

                 

       

       

                  <exclusions>

                      <exclusion>

                          <groupId>dom4j</groupId>

                          <artifactId>dom4j</artifactId>

                      </exclusion>

                  </exclusions>

              </dependency>

       

       

              <dependency>

                  <groupId>org.springframework</groupId>

                  <artifactId>spring-orm</artifactId>

                  <version>3.2.0.RELEASE</version>

              </dependency>

              <dependency>

                  <groupId>javax</groupId>

                  <artifactId>javaee-api</artifactId>

                  <version>6.0</version>

                  <scope>provided</scope>

              </dependency>

       

       

      <!--        <dependency>

                      <groupId>org.apache.lucene</groupId>

                      <artifactId>lucene-snowball</artifactId>

                      <version>3.0.3</version>

              </dependency>

              <dependency>

                  <groupId>org.apache.lucene</groupId>

                  <artifactId>lucene-core</artifactId>

                  <version>4.0.0</version>

              </dependency>

             

              <dependency>

                      <groupId>org.apache.lucene</groupId>

                      <artifactId>lucene-analyzers-common</artifactId>

                      <version>4.0.0</version>

              </dependency>-->

             

              <dependency>

                  <groupId>commons-lang</groupId>

                  <artifactId>commons-lang</artifactId>

                  <version>2.6</version>

              </dependency>

              <dependency>

                  <groupId>joda-time</groupId>

                  <artifactId>joda-time</artifactId>

                  <version>2.1</version>

              </dependency>

              <dependency>

                  <groupId>org.slf4j</groupId>

                  <artifactId>slf4j-log4j12</artifactId>

                  <version>1.6.4</version>

                  <scope>compile</scope>

              </dependency>

              <dependency>

                      <groupId>org.slf4j</groupId>

                      <artifactId>slf4j-api</artifactId>

                      <version>1.6.1</version>

              </dependency>

              <dependency>

                  <groupId>log4j</groupId>

                  <artifactId>log4j</artifactId>

                  <version>1.2.16</version>

              </dependency>

              <dependency>

                      <groupId>org.javassist</groupId>

                      <artifactId>javassist</artifactId>

                      <version>3.17.1-GA</version>

              </dependency>

              <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

                  <version>4.8.1</version>

                  <scope>test</scope>

              </dependency>

               <dependency>

                  <groupId>org.easytesting</groupId>

                  <artifactId>fest-assert</artifactId>

                  <version>1.4</version>

              </dependency>

              <dependency>

                  <groupId>javassist</groupId>

                  <artifactId>javassist</artifactId>

                  <version>3.12.1.GA</version>

              </dependency>

              <dependency>

                  <groupId>javax.transaction</groupId>

                  <artifactId>jta</artifactId>

                  <version>1.1</version>

              </dependency>

              <dependency>

          <groupId>org.hibernate</groupId>

              <artifactId>hibernate-ehcache</artifactId>

              <version>4.2.0.Final</version>

          </dependency>

              <dependency>

                  <groupId>org.hibernate</groupId>

                  <artifactId>hibernate-testing</artifactId>

                  <version>4.2.0.Final</version>

                  <exclusions>

                      <exclusion>

                          <groupId>org.jboss.logging</groupId>

                          <artifactId>jboss-logging-spi</artifactId>

                      </exclusion>

      <!--                <exclusion>

                          <groupId>org.jboss.jbossts</groupId>

                          <artifactId>jbossjta</artifactId>

                      </exclusion>-->

                      <exclusion>

                          <groupId>com.experlog</groupId>

                          <artifactId>xapool</artifactId>

                      </exclusion>

                  </exclusions>

              </dependency>

       

       

       

       

          </dependencies>

       

       

          <build>

              <plugins>

                  <plugin>

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

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

                      <version>2.3.2</version>

                      <configuration>

                          <source>1.6</source>

                          <target>1.6</target>

                          <compilerArguments>

                              <endorseddirs>${endorsed.dir}</endorseddirs>

                          </compilerArguments>

                      </configuration>

                  </plugin>

                  <plugin>

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

                      <artifactId>maven-ejb-plugin</artifactId>

                      <version>2.3</version>

                      <configuration>

                          <ejbVersion>3.1</ejbVersion>

                      </configuration>

                  </plugin>

                  <plugin>

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

                      <artifactId>maven-dependency-plugin</artifactId>

                      <version>2.1</version>

                      <executions>

                          <execution>

                              <phase>validate</phase>

                              <goals>

                                  <goal>copy</goal>

                              </goals>

                              <configuration>

                                  <outputDirectory>${endorsed.dir}</outputDirectory>

                                  <silent>true</silent>

                                  <artifactItems>

                                      <artifactItem>

                                          <groupId>javax</groupId>

                                          <artifactId>javaee-endorsed-api</artifactId>

                                          <version>6.0</version>

                                          <type>jar</type>

                                      </artifactItem>

      <!--                                <artifactItem>

                                          <groupId>org.hibernate</groupId>

                                          <artifactId>hibernate-search</artifactId>

                                          <version>4.2.0.Final</version>

                                          <type>jar</type>

                                      </artifactItem>-->

                                  </artifactItems>

                              </configuration>

                          </execution>

                         

                      </executions>

                  </plugin>

              </plugins>

          </build>

       

       

      </project>

       

       

      Any suggetion is highly appreciated.

      Thanks

      Sam

        • 1. Re: Missing class with junit testing in jboss 7.1.1.Final
          Stephen Coy Master

          I think you need to get rid of hibernate-annotations.

           

          The version you're using is from an earlier hibernate version and it's content is now a part of hibernate-core.

          • 2. Re: Missing class with junit testing in jboss 7.1.1.Final
            Sam W Expert

            Thank you for your suggestion.

            I have got rid of the hibernate-annotations in pom.xml file, but the same error still persist.

            What s wrong with the following error:

             

             

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

            Test set: HibernateSearchDateTest.facade.ProductArticleFacadeTest

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

            Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.401 sec <<< FAILURE!

            HibernateSearchDateTest.facade.ProductArticleFacadeTest  Time elapsed: 0 sec  <<< ERROR!

            java.lang.NoClassDefFoundError: org/hibernate/internal/util/ClassLoaderHelper

                      at org.hibernate.ejb.Ejb3Configuration.<init>(Ejb3Configuration.java:173)

                      at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:70)

                      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)

                      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)

             

             

            Thanks

            Sam

            • 3. Re: Missing class with junit testing in jboss 7.1.1.Final
              Stephen Coy Master

              Looking further I see that you have a bit of a schamozzle of hibernate versions remaining in your pom.

               

              Since you appear to be attempting to use primarily Hibernate 4.2, have a look at Hibernate 4.2 Maven Repository Artifacts to see which primary hibernate artifacts apply to your application.

               

              I think rectifying these should work for you:

              • hibernate-core -> fix version
              • hibernate-commons-annotations -> remove
              • ejb3-persistence -> remove (superceded by hibernate-jpa-2.0-api)
              1 of 1 people found this helpful
              • 4. Re: Missing class with junit testing in jboss 7.1.1.Final
                Sam W Expert

                Hi Thank you very much for the suggestion again.

                I removed hibernate-commons-annotations and ejb3-persistence dependencies and changed hibernate-core version to 4.2.Final.

                It progress further with the following exception:

                 

                 

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

                Test set: HibernateSearchDateTest.facade.ProductArticleFacadeTest

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

                Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.621 sec <<< FAILURE!

                HibernateSearchDateTest.facade.ProductArticleFacadeTest  Time elapsed: 0 sec  <<< ERROR!

                java.lang.ExceptionInInitializerError

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

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

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

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

                          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

                          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

                          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)

                          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)

                          at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                          at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)

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

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

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

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

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

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

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

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

                          at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)

                          at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)

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

                Caused by: javax.persistence.PersistenceException: [PersistenceUnit: TestDatePU] Unable to build EntityManagerFactory

                          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:930)

                          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)

                          at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:72)

                          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)

                          at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)

                          at HibernateSearchDateTest.facade.ProductArticleFacadeTest.<clinit>(ProductArticleFacadeTest.java:26)

                          ... 22 more

                Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded

                          at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:111)

                          at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)

                          at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)

                          at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)

                          at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)

                          at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)

                          at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)

                          at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)

                          at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)

                          at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:78)

                          at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2283)

                          at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2279)

                          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1748)

                          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)

                          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920)

                          ... 27 more

                Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [com.mysql.jdbc.Driver]

                          at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:149)

                          at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:106)

                          ... 41 more

                Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver

                          at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:296)

                          at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

                          at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

                          at java.lang.Class.forName0(Native Method)

                          at java.lang.Class.forName(Class.java:247)

                          at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:146)

                          ... 42 more

                HibernateSearchDateTest.facade.ProductArticleFacadeTest  Time elapsed: 0.002 sec  <<< ERROR!

                java.lang.NoClassDefFoundError: Could not initialize class HibernateSearchDateTest.facade.ProductArticleFacadeTest

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

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

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

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

                          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

                          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

                          at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)

                          at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                          at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)

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

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

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

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

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

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

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

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

                          at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)

                          at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)

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

                 

                 

                I am wondering where should I put MySqL JDBC Driver com.mysql.jdbc.Driver in my test project?

                This is my project (ejb module) structure:

                 

                TestDate-ejb

                ----src

                ---------main

                -----------------java

                -----------------resources

                -----------------META-INF

                -------------------------------persistence.xml

                -------------------------------MANIFEST.MF

                -------------------------------jboss.xml

                 

                Thanks  a lot

                Sam

                • 5. Re: Missing class with junit testing in jboss 7.1.1.Final
                  Sam W Expert

                  I added a dependancy in my pom.xml file, it works.

                   

                  <dependency>

                                      <groupId>mysql</groupId>

                                      <artifactId>mysql-connector-java</artifactId>

                                      <version>5.1.24</version>

                            </dependency>

                   

                  Thank you very much for the help.

                  Sam