10 Replies Latest reply: Jan 28, 2011 3:28 AM by Craig Greenhalgh RSS

    Seam Solder Beta1 and Arquillian Alpha4

    Ove Ranheim Novice

      Hi,

       

      I've upgraded to Seam Solder 3 / JBoss 6 CR1, which works fine.

       

      When I run my JUnit test cases with Arquillian 1.0.0.Alpha4, I get "ClassNotFoundException: org.jboss.weld.exceptions.UnsatisfiedResolutionException":

       

       

      shouldAddUserRoles(eris.services.test.model.UserDomainTest)  Time elapsed: 0.067 sec  <<< ERROR!
      org.jboss.arquillian.impl.event.FiredEventException: java.lang.IllegalStateException: Error launching test eris.services.test.model.UserDomainTest public void eris.services.test.model.UserDomainTest.shouldAddUserRoles() throws java.lang.Exception
           at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)
           at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
           at org.jboss.arquillian.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:157)
           at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:244)
           at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:207)
           at org.jboss.arquillian.junit.Arquillian$5$1.evaluate(Arquillian.java:225)
           at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)
           at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:221)
           at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
           at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
           at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
           at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
           at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
           at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
           at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
           at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:163)
           at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:186)
           at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)
           at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:182)
           at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
           at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)
           at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
           at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
           at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)
           at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
           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.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
           at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
      Caused by: java.lang.IllegalStateException: Error launching test eris.services.test.model.UserDomainTest public void eris.services.test.model.UserDomainTest.shouldAddUserRoles() throws java.lang.Exception
           at org.jboss.arquillian.protocol.servlet_3.ServletMethodExecutor.invoke(ServletMethodExecutor.java:61)
           at org.jboss.arquillian.impl.handler.ContainerTestExecuter.callback(ContainerTestExecuter.java:50)
           at org.jboss.arquillian.impl.handler.ContainerTestExecuter.callback(ContainerTestExecuter.java:40)
           at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
           ... 30 more
      Caused by: java.lang.ClassNotFoundException: org.jboss.weld.exceptions.UnsatisfiedResolutionException
           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:307)
           at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
           at java.lang.Class.forName0(Native Method)
           at java.lang.Class.forName(Class.java:247)
           at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:603)
           at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)
           at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
           at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
           at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
           at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
           at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
           at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
           at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
           at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
           at org.jboss.arquillian.protocol.servlet_3.ServletMethodExecutor.execute(ServletMethodExecutor.java:88)
           at org.jboss.arquillian.protocol.servlet_3.ServletMethodExecutor.invoke(ServletMethodExecutor.java:57)
           ... 33 more
      

       

       

      Are Aqruillian-JUnit and JSFUnit in sync with Solder?

       

      Ove

        • 2. Re: Seam Solder Beta1 and Arquillian Alpha4
          Ove Ranheim Novice

          Awesome Aslak!

           

          That fixed the issue for my jboss-remote-6 profile (weld-core 1.1.0.Beta1), so my tests are running again :-)

           

          I've also configured an embedded profile, so I can perform integration testing on my Bamboo server. After upgrading to JBoss 6 CR1 (from M4), the logmanager fails (using jboss logger 3.0.0.Beta4).

           

           

          Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.326 sec <<< FAILURE!
          initializationError(eris.services.test.model.GenreDomainTest)  Time elapsed: 0.002 sec  <<< ERROR!
          java.lang.NoSuchMethodError: org.jboss.logmanager.LogContext.getAttachment(Ljava/lang/String;Lorg/jboss/logmanager/Logger$AttachmentKey;)Ljava/lang/Object;
                  at org.jboss.logging.JBossLogManagerProvider.doGetLogger(JBossLogManagerProvider.java:52)
                  at org.jboss.logging.JBossLogManagerProvider.getLogger(JBossLogManagerProvider.java:47)
                  at org.jboss.logging.Logger.getLogger(Logger.java:2164)
                  at org.jboss.logging.Logger.getLogger(Logger.java:2189)
                  at org.jboss.jbossas.servermanager.Server.(Server.java:65)
                  at org.jboss.arquillian.container.jbossas.managed_6.JBossASLocalContainer.createAndConfigureServer(JBossASLocalContainer.java:236)
                  at org.jboss.arquillian.container.jbossas.managed_6.JBossASLocalContainer.createAndConfigureServerManager(JBossASLocalContainer.java:230)
                  at org.jboss.arquillian.container.jbossas.managed_6.JBossASLocalContainer.setup(JBossASLocalContainer.java:64)
                  at org.jboss.arquillian.impl.handler.ContainerCreator.callback(ContainerCreator.java:56)
                  at org.jboss.arquillian.impl.handler.ContainerCreator.callback(ContainerCreator.java:46)
                  at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
                  at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
                  at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)
                  at org.jboss.arquillian.junit.Arquillian.(Arquillian.java:89)
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
          

           

           

           

          The embedded test maven-surefire-plugin is configured with argLine:

           

           

          -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djava.endorsed.dirs=${project.build.directory}/jboss-${version.jboss_60}/lib/endorsed -Djboss.home=${project.build.directory}/jboss-${version.jboss_60} -Djboss.boot.server.log.dir=${project.build.directory}/jboss-${version.jboss_60} -Dorg.jboss.reflect.spi.TypeInfoFactory=org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory

           

           

          Any idea why I get NoSuchMethodException for LogContext.getAttachment? Is there a new LogManager between M4 and CR1?

           

          If I remove the java.util.logging.manager stmt, the test suite succeedes.

           

          Ha en riktig God Jul!

           

          Ove

          • 3. Re: Seam Solder Beta1 and Arquillian Alpha4
            Aslak Knutsen Master

            hmm, looks like you are mixing a Managed and a Embedded configuration.. Can you paste the whole profile xml snippet?

             

            God jul

             

            -aslak-

            • 4. Re: Seam Solder Beta1 and Arquillian Alpha4
              Ove Ranheim Novice

              Here's the xml snippet: http://pastebin.com/mwsaw3Kt

               

              Cheers,

              Ove

              • 5. Re: Seam Solder Beta1 and Arquillian Alpha4
                Aslak Knutsen Master

                Look at the JBoss 6 Managed docs for how to setup a managed container, a jboss server started in a different vm, but start/stop controilled.

                 

                http://docs.jboss.org/arquillian/reference/latest/en-US/html_single/#container.jbossas-managed-6.configuration

                • 6. Re: Seam Solder Beta1 and Arquillian Alpha4
                  Dan Allen Master

                  While on this topic, keep in mind that if you want to use Weld Embedded container with Weld 1.1 and Seam Solder, I recommend using the Weld Embedded container from the Weld distribution:

                   

                  <dependency>
                     <groupId>org.jboss.weld.arquillian.container</groupId>
                     <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
                     <version>1.0.0.CR1</version>
                     <scope>test</scope>
                  </dependency>
                  

                   

                  Pay close attention to the groupId. Granted, this is a temporary recommendation until Arquillian enters beta. Eventually the idea is that Weld will use a standard version of Arquillian. But for now, it will get you by in a pinch.

                  • 7. Re: Seam Solder Beta1 and Arquillian Alpha4
                    Ove Ranheim Novice

                    Hi Dan,

                     

                    My jbossas-managed-6 profile works almost fine, but fails when configuring the LogManager. I followed the docs as pointed out by Aslak.

                     

                    The weld-ee-embedded profile is intriguing and definately speeds up my testing. Again, I'm getting a failure on Logger injection. See exception log below.

                     

                    Profile configuration is as follows:

                     

                    • Weld Core is on the classpath
                    • Seam Solder, Faces, International, REST and Remoting (all latest version)
                    • Weld embedded with version 1.1.0.Beta1 (same as weld-core version and for Seam Solder Beta1)
                    • org.slf4j:slf-simple:1.5.10
                    • org.jboss.logging:jboss-logging:3.0.0.Beta4

                     

                    My test case:

                     

                     

                    @RunWith(Arquillian.class)
                    public class MessengerTest extends WarTestProfile {
                    
                         @Deployment
                         public static Archive createTestArchive() {
                              return resolveEntityServerArtifacts(ShrinkWrap
                                        .create(WebArchive.class, "test.war")
                                        .addClasses(PartsDatabase.class, PartsRepositoryProducer.class)
                                        .addWebResource("test-persistence.xml", "classes/META-INF/persistence.xml")
                                        .addWebResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")));
                         }
                         
                         @Inject
                         Logger log;
                         
                         @Inject
                         @PartsDatabase
                         EntityManager em;
                         
                         @Test
                         public void testMe() throws Exception {
                              Assert.assertNotNull(em);
                         }
                         
                    }

                     

                     

                    Causing failure on Logger injection:

                     

                    -------------------------------------------------------------------------------
                    Test set: eris.services.test.model.MessengerTest
                    -------------------------------------------------------------------------------
                    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.628 sec <<< FAILURE!
                    testMe(eris.services.test.model.MessengerTest)  Time elapsed: 0.04 sec  <<< ERROR!
                    org.jboss.arquillian.impl.event.FiredEventException: java.lang.RuntimeException: Could not inject members
                         at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)
                         at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
                         at org.jboss.arquillian.impl.EventTestRunnerAdaptor.before(EventTestRunnerAdaptor.java:127)
                         at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:206)
                         at org.jboss.arquillian.junit.Arquillian$5$1.evaluate(Arquillian.java:225)
                         at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)
                         at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:221)
                         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
                         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
                         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
                         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
                         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
                         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
                         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
                         at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:163)
                         at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:186)
                         at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)
                         at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:182)
                         at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
                         at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)
                         at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
                         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
                         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)
                         at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
                         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.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
                         at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
                    Caused by: java.lang.RuntimeException: Could not inject members
                         at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectClass(CDIInjectionEnricher.java:103)
                         at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.enrich(CDIInjectionEnricher.java:52)
                         at org.jboss.arquillian.impl.handler.TestCaseEnricher.callback(TestCaseEnricher.java:42)
                         at org.jboss.arquillian.impl.handler.TestCaseEnricher.callback(TestCaseEnricher.java:32)
                         at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
                         ... 29 more
                    Caused by: java.lang.NullPointerException
                         at org.jboss.seam.solder.log.LoggerProducers.produceLog(LoggerProducers.java:75)
                         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.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
                         at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
                         at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
                         at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
                         at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:198)
                         at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:170)
                         at org.jboss.weld.bean.ProducerMethod$1.produce(ProducerMethod.java:144)
                         at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:360)
                         at org.jboss.weld.context.DependentContext.get(DependentContext.java:62)
                         at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:660)
                         at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:734)
                         at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:757)
                         at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118)
                         at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:840)
                         at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:852)
                         at org.jboss.weld.manager.SimpleInjectionTarget$1.proceed(SimpleInjectionTarget.java:122)
                         at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:54)
                         at org.jboss.weld.manager.SimpleInjectionTarget.inject(SimpleInjectionTarget.java:116)
                         at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectNonContextualInstance(CDIInjectionEnricher.java:113)
                         at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectClass(CDIInjectionEnricher.java:93)
                         ... 33 more
                    
                    

                     

                     

                     

                    Ove

                    • 8. Re: Seam Solder Beta1 and Arquillian Alpha4
                      Dan Allen Master

                      You (and Arquillian) discovered a bug in Solder. See SOLDER-63. This is now fixed in Solder HEAD. Thanks!

                       

                      As a workaround, you have to put the logger injection on a CDI bean. You can either add it to the bean you are testing, or use a helper bean that logs messages for the test.

                      • 9. Re: Seam Solder Beta1 and Arquillian Alpha4
                        Ove Ranheim Novice

                        Hi Dan,

                         

                        Thanks for clarifying this and the workaround should work fine for the time being.

                         

                        It's good to see how each module of the Seam 3 stack being pulled together. I really appreciate the quaility and all the hard work from the JBoss Team, in particular making XML Config, Faces, International, Remoting, REST, Catch, Security and Arquillian/JSFUnit; compliant with Seam Solder.

                         

                        Kudos to you guys!

                         

                        Happy new year!

                         

                        Ove

                        • 10. Re: Seam Solder Beta1 and Arquillian Alpha4
                          Craig Greenhalgh Newbie

                          Hi when i deploy to a remote instance of jbossas 6 M4 I get the same error;

                           

                          WeldBootstrapBean state=Create: java.lang.NoSuchMethodError: org.jboss.logmanager.LogContext.getAttachment(Ljava/lang/String;Lorg/jboss/logmanager/Logger$AttachmentKey;)Ljava/lang/Object;

                           

                          Do you know what dependcies I'm missing?

                           

                          It is currently using jboss logoing 3.0.0 Beta4

                           

                          Thanks for your help

                           

                          Craig