1 2 3 4 5 Previous Next 62 Replies Latest reply: May 3, 2012 8:55 AM by Stelian Niculescu Go to original post RSS
      • 15. Re: Arquillian testing with JBoss
        Patrick T Newbie

        Ok. After fixing some other errors in my own code, I get a new error message. I found some issues on this topic here, but I couldn't find any solution or information about being fixed, cause it seems to be a bug in the container. This is the surefire-report I get now:

         

         

        -------------------------------------------------------------------------------
        Test set: test.testV4_2.AppTest
        -------------------------------------------------------------------------------
        Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 22.363 sec <<< FAILURE!
        testSayHello(test.testV4_2.AppTest)  Time elapsed: 0.355 sec  <<< ERROR!
        java.lang.NullPointerException
            at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:88)
            at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:77)
            at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:85)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
            at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
            at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
            at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
            at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
            at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
            at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:33)
            at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
            at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65)
            at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160)
            at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126)
            at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
            at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            at java.lang.Thread.run(Thread.java:662)
        
        

         

        This happend after I changed my deploy-file from a .war-file to a .ear-file. Maybe this gives a clue.

         

        Patrick

        • 16. Re: Arquillian testing with JBoss
          Aslak Knutsen Master

          You're mixing some versions. Some how you get a Alpha5 or similar version of Arq Core in there..

          • 17. Re: Arquillian testing with JBoss
            Patrick T Newbie

            Hm. Can't see any in the pom.xml. It looks like this right now:

             

             

            <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>
            
                <groupId>test</groupId>
                <artifactId>testV4-2</artifactId>
                <version>0.0.1-SNAPSHOT</version>
                <packaging>jar</packaging>
            
                <name>testV4-2</name>
                <url>http://maven.apache.org</url>
            
                <repositories>
                    <repository>
                        <id>jboss-public-repository-group</id>
                        <name>JBoss Public Maven Repository Group</name>
                        <url>https://repository.jboss.org/nexus/content/repositories/public</url>
                        <layout>default</layout>
                        <releases>
                            <enabled>true</enabled>
                            <updatePolicy>never</updatePolicy>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                            <updatePolicy>never</updatePolicy>
                        </snapshots>
                    </repository>
                </repositories>
                
                <pluginRepositories>
                    <pluginRepository>
                        <id>jboss-public-repository-group</id>
                        <name>JBoss Public Maven Repository Group</name>
                        <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
                        <layout>default</layout>
                        <releases>
                            <enabled>true</enabled>
                            <updatePolicy>never</updatePolicy>
                        </releases>
                        <snapshots>
                            <enabled>false</enabled>
                            <updatePolicy>never</updatePolicy>
                        </snapshots>
                    </pluginRepository>
                </pluginRepositories>
            
                <properties>
                    <version.junit>4.8.1</version.junit>
                    <version.arquillian>1.0.0.Alpha4</version.arquillian>
                    <version.dep-manager>1.0.0.CR6</version.dep-manager>
            <!--         <version.container>1.0.0.CR2</version.container> -->
                    <version.container>1.0.0.Final-SNAPSHOT</version.container>        
                     <version.client>4.2.3.GA</version.client>
                    <version.dom4j>1.6.1</version.dom4j>
                    <version.server-manager>1.0.3.GA</version.server-manager>
                    <version.ejb_api>3.0</version.ejb_api>
                    <version.log-manager>1.2.0.GA</version.log-manager>
                    <version.javaee>1.0.0.Final</version.javaee>
                    
                    <jboss.home>C:/Jboss/jboss-as</jboss.home>
                </properties>
                
                <dependencyManagement>
                    <dependencies>
                        <dependency>
                            <groupId>org.jboss.arquillian</groupId>
                            <artifactId>arquillian-bom</artifactId>
                            <version>${version.dep-manager}</version>
                            <scope>import</scope>
                            <type>pom</type>
                        </dependency>
                    </dependencies>
                </dependencyManagement>
                
                <dependencies>
            <!--         <dependency> -->
            <!--             <groupId>org.jboss.spec</groupId> -->
            <!--             <artifactId>jboss-javaee-6.0</artifactId> -->
            <!--             <version>${version.javaee}</version> -->
            <!--             <type>pom</type> -->
            <!--             <scope>provided</scope> -->
            <!--         </dependency> -->
                
                    <dependency>
                        <groupId>org.jboss.arquillian.junit</groupId>
                        <artifactId>arquillian-junit-container</artifactId>
                        <scope>test</scope>
                    </dependency>
                    
                    <dependency>
                        <groupId>org.jboss.arquillian</groupId>
                        <artifactId>arquillian-junit</artifactId>
                        <version>${version.arquillian}</version>
                    </dependency>
                        
                    <dependency>
                        <groupId>javax.ejb</groupId>
                        <artifactId>ejb-api</artifactId>
                        <version>${version.ejb_api}</version>
                        <scope>provided</scope>
                    </dependency>
                    
                    <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>${version.junit}</version>
                        <scope>test</scope>
                    </dependency>        
                    
                    <dependency>
                        <groupId>org.jboss.jbossas</groupId>
                        <artifactId>jboss-server-manager</artifactId>
                        <version>${version.server-manager}</version>
                        <scope>test</scope>
                    </dependency>
                            
                    <dependency>
                        <groupId>dom4j</groupId>
                        <artifactId>dom4j</artifactId>
                        <version>${version.dom4j}</version>
                        <scope>provided</scope>
                    </dependency>
                    
                    <dependency>
                        <groupId>org.jboss.client</groupId>
                         <artifactId>jmx-invoker-adaptor-client</artifactId>
                          <version>4.2.2.GA</version>
                          <scope>provided</scope>
                    </dependency>
                        
                    <dependency>
                          <groupId>org.jboss.logmanager</groupId>
                          <artifactId>jboss-logmanager</artifactId>
                          <version>${version.log-manager}</version>
                          <scope>provided</scope>
                    </dependency>        
                </dependencies>
                
                <profiles>
                    <profile>
                        <id>jboss-managed-4</id>
                        
                        <activation>
                            <activeByDefault>true</activeByDefault>
                        </activation>
                        
                        <dependencies>
                            <dependency>
                                <groupId>org.jboss.client</groupId>
                                 <artifactId>jbossall-client</artifactId>
                                  <version>${version.client}</version>
                                  <scope>provided</scope>
                            </dependency>
                            <dependency>
                                <groupId>org.jboss.arquillian.container</groupId>
                                <artifactId>arquillian-jbossas-managed-4.2</artifactId>
                                <version>${version.container}</version>
                                <scope>test</scope>
                            </dependency>
                        </dependencies>
                        
                    </profile>
                </profiles>
            
                <build>
                    <plugins>
                    
                        <plugin>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <version>2.3.2</version>
                            
                            <configuration>                
                                <source>1.6</source>
                                <target>1.6</target>
                            </configuration>
                        </plugin>
                    
                        <plugin>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <version>2.6</version>
                
                            <configuration>
                                <additionalClasspathElements>
                                    <additionalClasspathElement>${jboss.home}/client/jboss-ejb3-client.jar</additionalClasspathElement>
                                    <additionalClasspathElement>${jboss.home}/server/default/deploy/jbossweb.sar</additionalClasspathElement>
                                </additionalClasspathElements>
                
                                <trimStackTrace>false</trimStackTrace>
                                <printSummary>true</printSummary>
                                
                                <argLine>-Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djava.endorsed.dirs=${jboss.home}/lib/endorsed -Djboss.home=${jboss.home} -Djboss.boot.server.log.dir=${jboss.home} -Dorg.jboss.reflect.spi.TypeInfoFactory=org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory -Djava.rmi.server.hostname</argLine>
                            </configuration>
                           
                        </plugin>
                    </plugins>
                </build>
            
            </project>
            

             

            The only extra dependency I added should be the logmanager. Maybe it's this?

            • 18. Re: Arquillian testing with JBoss
              Aslak Knutsen Master

              remove this

               

                      <dependency>
                          <groupId>org.jboss.arquillian</groupId>
                          <artifactId>arquillian-junit</artifactId>
                          <version>${version.arquillian}</version>
                      </dependency>

              • 19. Re: Arquillian testing with JBoss
                Patrick T Newbie

                Alright. I did remove the dependency. But the error still remains the same. Maybe there's another wrong version or dep. I don't know of?

                • 20. Re: Arquillian testing with JBoss
                  Aslak Knutsen Master

                  When i remove the arquillian-junit artifact it runs ok here.

                   

                  I get a deployment error if i just change the Archive type to EnterpriseArchive: "cannot obtain module type", which is due to missing application.xml (required in ee4)

                   

                  But adding application.xml and adding the TestClass manually(arquillian won't auto add the testclass to a multi module archive) to the War I see no issues.. ?

                  • 21. Re: Arquillian testing with JBoss
                    Patrick T Newbie

                    Hi again and sorry for the late response. It's quite possible that I build my ear file in a wrong way, since this is the first time I have to work with these. I already added an application.xml but maybe something is missing in there, so I simply show you the code. But I'm not sure if the error I get can be caused by this.

                     

                     


                    @Deployment

                    public static EnterpriseArchive createTestArchive()

                    {



                    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test.jar")




                    .addClasses(App.class, AppLocal.class, AppTest.class);





                    EnterpriseArchive arch = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")




                    .addAsModule(jar)




                    .setApplicationXML(new File("./application.xml"));






                    return arch;

                    }

                     

                    My application.xml looks like this:

                     

                    <?xml version="1.0" encoding="UTF-8"?>
                    <application xmlns="http://java.sun.com/xml/ns/javaee"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4"
                        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_4.xsd">
                    
                        <application-name>test-app</application-name>
                    
                        <module>
                            <ejb>test.jar</ejb>
                        </module>
                    
                    </application>
                    

                     

                    The error I get still says:

                    java.lang.NullPointerException
                        at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:88)
                        at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:77)
                        at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:85)
                    ....
                    
                    • 22. Re: Arquillian testing with JBoss
                      Aslak Knutsen Master

                      Your packaging shouldn't cuase this. (unless you magically manage to package up some old arquillian libs)

                       

                      The DeployableTestBuilder class does not exist any more, and only existed pre Alpha5. You still hvae some mixup of version somewhere..

                       

                      You can try mvn dependency:tree and see what the gives you(tho it will lie in some cases since that plugin doesn't really use the same resolving lib as Maven Core, using mvn -X should show you the real dependencies)

                       

                      Hopefully you see where the Alpha5 dependency come from.

                      • 23. Re: Arquillian testing with JBoss
                        Patrick T Newbie

                        Thanks for your answer. I'm not sure what exactly happend, but after maven posted me the dep. tree and after starting eclipse again the error changed. Couldn't find any alpha5 dep in the tree btw, but I sort of get the feeling, that something did not update properly after changing from Alpha5 to 1.0.0.CR7 version in my local repository. I'm not sure, but I guess the new error that occurs is caused by my packaging or an jndi-issue since I get a NPE in my testcase.

                         

                        java.lang.NullPointerException

                            at test.testV4_2.AppTest.testSayHello(AppTest.java:45)

                            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)

                        ...

                         

                        ...is what it says.

                        • 24. Re: Arquillian testing with JBoss
                          Aslak Knutsen Master

                          That's the @EJB injection i assume..

                           

                          The automatic injection is based on naming standard since there is no simple way of getting a mapping between the EJB Interface and the JNDI name. If you specify the @EJB.mappedName tho, it should work.

                          • 25. Re: Arquillian testing with JBoss
                            Patrick T Newbie

                            You're right. I simply wrote the jndi name wrong. Everything works now. Thanks for all the help, I really appreciate that Now I have to migrate everything to java 1.5 and most work is done.

                             

                            Thanks again!

                             

                            Patrick

                            • 26. Re: Arquillian testing with JBoss
                              Aslak Knutsen Master

                              Excellent! Have fun

                              • 27. Re: Arquillian testing with JBoss
                                Patrick T Newbie

                                Hm. Is Arquillian still ment to work under 1.5? Cause I get a NoSuchMethodError that shows explicit java-1.6-code in the container and I couldn't find any documentation about which version is min. requirement, just an issue that due to shrinkwrap it didn't work in 1.5 for a while.

                                • 28. Re: Arquillian testing with JBoss
                                  Aslak Knutsen Master

                                  hmm, it should... It's not currently compiled on JDK 1.5 tho, compiled on 1.6 with target 1.5.. so there might be some illegal api usage in there. Which exception are you getting (where)?

                                  • 29. Re: Arquillian testing with JBoss
                                    Patrick T Newbie

                                    this one:

                                     

                                    Caused by: java.lang.NoSuchMethodError: java.lang.String.isEmpty()Z

                                        at org.jboss.arquillian.container.jbossas.managed_4_2.JBossASConfiguration.<init>(JBossASConfiguration.java:61)