0 Replies Latest reply on Dec 10, 2012 5:07 PM by Andi Andi

    arquillian test java.lang.ClassNotFoundException: org.jboss.seam.solder.tooling.SolderAnnotations

    Andi Andi Newbie

      Hello,

       

      I'm trying to run some testing with Arquillian (version 1.0.3.Final) unfortunely it doesn't work. 

       

      1. First of all I set up my pom.xml

       

      {code:xml}

      <?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/maven-v4_0_0.xsd">

          <modelVersion>4.0.0</modelVersion>

       

      ...

       

          <dependencyManagement>

              <dependencies>

                  ...

                  <dependency>

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

                      <artifactId>arquillian-bom</artifactId>

                      <version>1.0.3.Final</version>

                      <scope>import</scope>

                      <type>pom</type>

                  </dependency>

                  ...

              </dependencies>

          </dependencyManagement>

       

          <dependencies>

             ...

             <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

                  <version>4.8.1</version>

                  <scope>test</scope>

              </dependency>

       

              <dependency>

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

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

                  <scope>test</scope>

              </dependency>

              ...

          </dependencies>

       

          <build>

          ...     

         </build>

       

          <profiles>

              <profile>

                  <id>arquillian-jbossas-managed</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.as</groupId>

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

                          <version>7.1.1.Final</version>

                          <scope>test</scope>

                      </dependency>

                  </dependencies>

              </profile>

          </profiles>

      </project>

      {code}

       

      2. Then I create the arquillian.xml

       

      {code:xml}

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

      <arquillian xmlns="http://jboss.com/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xmlns:jbossas-remote="urn:arq:org.jboss.arquillian.container.jbossas.remote_6">

       

          <!-- Uncomment to have test archives exported to the file system for inspection -->

          <engine>

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

          </engine>

       

          <!-- Example configuration for a remote JBoss AS 7 instance -->

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

              <configuration>

                  <property name="jbossHome">/home/pryzbylusky/workspace/datacheckingengine/jboss-as-7.1.1.Final</property>

                  <property name="allowConnectingToRunningServer">true</property>

              </configuration>

          </container>  

      </arquillian>

      {code}

       

      3. Then I wrote a simple test case:

       

       

      {code}

      @RunWith(Arquillian.class)

      public class TestAddRulePersistence{

       

          @Inject RuleRepository repository;

       

          @Deployment

          public static JavaArchive createTestArchive() {

              JavaArchive archive = ShrinkWrap

                                  .create(JavaArchive.class)

                                  .addPackages(true, "de.fhhannover.inform")

                                  .addPackages(true, "org.jboss.seam")

                                  .addPackages(true, "javax.faces")

                                  .addPackages(true, "org.primefaces")

                                  .addPackages(true, "org.apache.http")

                                  .addPackages(true, "org.picketlink")

                                  .addClass("org.jboss.seam.solder.tooling.SolderAnnotations")

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

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

              return archive;

          }

       

       

          @Test

          public void testGetAllRules() {   

       

          }

       

      }

      {code}

       

      4. I ran the test case as a JUnit test

       

      Unfortunely it stops with this exception:

       

      {code}

      22:32:11,364 WARN  [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.jboss.seam.solder.tooling.SolderAnnotations in Module "deployment.test.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/jboss/seam/solder/tooling/SolderAnnotations (Module "deployment.test.war:main" from Service Module Loader)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)

          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)

          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)

          at org.jboss.modules.Module.loadModuleClass(Module.java:517)

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

          at org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner.getPackagesInJar(HibernateAnnotationScanner.java:171)

          at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:489) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:851) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:596) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

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

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

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]

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

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]

      Caused by: java.lang.NoClassDefFoundError: org/jboss/logging/Annotations

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

          at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_07]

          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_07]

          at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)

          ... 20 more

      Caused by: java.lang.ClassNotFoundException: org.jboss.logging.Annotations from [Module "deployment.test.war:main" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

          ... 25 more

       

      22:32:11,376 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.persistenceunit."test.war#database": org.jboss.msc.service.StartException in service jboss.persistenceunit."test.war#database": Failed to start service

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]

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

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]

      Caused by: java.lang.RuntimeException: error trying to scan <jar-file>: vfs:/content/test.war/WEB-INF/lib/312489b6-5758-41f0-98c4-1efd7d8e0520.jar/

          at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:854)

          at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:596)

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

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          ... 3 more

      Caused by: java.lang.RuntimeException: JBAS011431: Could not load entity class 'org.jboss.seam.solder.tooling.SolderAnnotations' with PersistenceUnitInfo.getClassLoader()

          at org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner.getPackagesInJar(HibernateAnnotationScanner.java:175)

          at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:489)

          at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:851)

          ... 9 more

      Caused by: java.lang.ClassNotFoundException: org.jboss.seam.solder.tooling.SolderAnnotations from [Module "deployment.test.war:main" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

          at org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner.getPackagesInJar(HibernateAnnotationScanner.java:171)

          ... 11 more

      {code}

       

      According to my maven depencies the classes are included.

       

      So what is wrong? And do I really need to add such packages like org.primefaces or javax.faces to my test archive war by adding them in the Method addPackages?