1 2 Previous Next 24 Replies Latest reply on Feb 11, 2011 10:57 AM by bonomat

    Beginner Problem on running a simple test

    bonomat

      Hi all,

       

      i am new to arquillian and i want to write a simple test out of an example i've found on this page.

      but i have problems to run them.

      in intellij i get follwing error when runing the test as junit test or with maven clean package

       

      org.jboss.arquillian.impl.event.FiredEventException: org.jboss.arquillian.spi.LifecycleException: Could not connect to container

      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.beforeSuite(EventTestRunnerAdaptor.java:68)

                at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:89)

      ....

      aused by: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

                at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)

      ...

       

      the dependencies i am using:

       

           <dependency>
                  <groupId>org.jboss.arquillian</groupId>
                  <artifactId>arquillian-junit</artifactId>
                  <version>1.0.0.Alpha4</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.arquillian.container</groupId>
                  <artifactId>arquillian-jbossas-remote-6</artifactId>
                  <version>1.0.0.Alpha4</version>
                  <scope>test</scope>
              </dependency>
      

       

      my test:

      @RunWith(Arquillian.class)
      public class ExmapleClassTest {
      ...
       @Deployment
          public static JavaArchive createTestArchive() {
              return ShrinkWrap.create(JavaArchive.class, "test.jar")
                      .addClasses(ExmapleClass.class)
                      .addManifestResource(
                              EmptyAsset.INSTANCE,
                              ArchivePaths.create("beans.xml"));
      } 
      

      and the jndi.properties:

       

      java.naming.factory.initial=org.jboss.naming.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=jnp://localhost:1099
      

       

       

      and i have a jboss 6 as running on my localhost.

      is there an obvious mistake i made?

      If you need more information please call.

      thx and kind regards

      philipp

        • 1. Beginner Problem on running a simple test
          aslak
          • 2. Re: Beginner Problem on running a simple test
            bonomat

            thx for the help, i got it working having a jboss running,

            as next step i wanted to have an imbedded jboss, but i get following error after exectuting : mvn clean install:

            org.jboss.arquillian.impl.event.FiredEventException: org.jboss.arquillian.spi.LifecycleException: Could not start container

                      at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)

                      at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)

            .....

            Caused by: org.jboss.arquillian.spi.LifecycleException: Could not start container

                      at org.jboss.arquillian.container.jbossas.embedded_6.JBossASEmbeddedContainer.start(JBossASEmbeddedContainer.java:66)

            .....

            Caused by: org.jboss.bootstrap.api.config.InvalidConfigurationException: Could not get a connection to the jboss.lib.url: file:/workspace/my-project/lib

                      at org.jboss.bootstrap.impl.as.config.JBossASBasedConfigurationValidator.require(JBossASBasedConfigurationValidator.java:217)

            Caused by: java.io.FileNotFoundException: /workspace/my-project/lib (No such file or directory)

                      at java.io.FileInputStream.open(Native Method)

                      at java.io.FileInputStream.<init>(FileInputStream.java:106)

                      at java.io.FileInputStream.<init>(FileInputStream.java:66)

             

            my arquillian.xml:

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

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

                        xmlns:jboss="urn:arq:org.jboss.arquillian.container.jbossas.embedded_6">

              <jboss:container>

                <jboss:profile>jbossas-embedded-6</jboss:profile>

                <jboss:bindaddress>localhost</jboss:bindaddress>

                <jboss:httpport>8081</jboss:httpport>

              </jboss:container>

            </arquillian>

             

            and jndi.properties:

            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

            java.naming.provider.url=jnp://localhost:1099

             

            thx for help

            regards philipp

            • 3. Re: Beginner Problem on running a simple test
              aslak

              JBoss AS Embedded needs a bit more setup. Have a look at this: https://github.com/akquinet/arquillian-javamagazin/

              See the jbossas-embedded-6 profile in the pom.

              • 4. Re: Beginner Problem on running a simple test
                bonomat

                thank you for that, the example is running fine using the embedded profile,

                but if i copy this profile to my pom i get following error after executing mvn clean test -Pjbossas-embedded-6:

                 

                [INFO] --- maven-surefire-plugin:2.6:test (default-test) @ rdv4m-webapp ---

                [INFO] Surefire report directory: /home/bonomat/workspace/my-project/target/surefire-reports

                Usage: java [-options] class [args...]

                           (to execute a class)

                   or  java [-options] -jar jarfile [args...]

                           (to execute a jar file)

                 

                 

                where options include:

                    -d32          use a 32-bit data model if available

                 

                 

                    -d64          use a 64-bit data model if available

                    -server            to select the "server" VM

                                  The default VM is server.

                                 

                    -cp <class search path of directories and zip/jar files>

                    -classpath <class search path of directories and zip/jar files>

                                  A : separated list of directories, JAR archives,

                                  and ZIP archives to search for class files.

                    -D<name>=<value>

                                  set a system property

                    -verbose[:class|gc|jni]

                                  enable verbose output

                    -version      print product version and exit

                    -version:<value>

                                  require the specified version to run

                    -showversion  print product version and continue

                    -jre-restrict-search | -jre-no-restrict-search

                                  include/exclude user private JREs in the version search

                    -? -help      print this help message

                 

                    -X            print help on non-standard options

                    -ea[:<packagename>...|:<classname>]

                    -enableassertions[:<packagename>...|:<classname>]

                                  enable assertions

                    -da[:<packagename>...|:<classname>]

                    -disableassertions[:<packagename>...|:<classname>]

                                  disable assertions

                    -esa | -enablesystemassertions

                                  enable system assertions

                    -dsa | -disablesystemassertions

                                  disable system assertions

                    -agentlib:<libname>[=<options>]

                                  load native agent library <libname>, e.g. -agentlib:hprof

                                    see also, -agentlib:jdwp=help and -agentlib:hprof=help

                    -agentpath:<pathname>[=<options>]

                                  load native agent library by full pathname

                    -javaagent:<jarpath>[=<options>]

                                  load Java programming language agent, see java.lang.instrument

                    -splash:<imagepath>

                                  show splash screen with specified image

                /bin/sh: -Djava.util.logging.manager=org.jboss.logmanager.LogManager: not found

                /bin/sh: -Djava.endorsed.dirs=/home/bonomat/jboss-6.0.0.Final/lib/endorsed: not found

                /bin/sh: -Djboss.boot.server.log.dir=/home/bonomat/jboss-6.0.0.Final: not found

                /bin/sh: -Dorg.jboss.reflect.spi.TypeInfoFactory=org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory: not found

                 

                 

                the folder exists, do you know what i am doing wrong?

                • 5. Re: Beginner Problem on running a simple test
                  aslak

                  can you paste your pom here?

                  • 6. Re: Beginner Problem on running a simple test
                    bonomat

                    Thx for the hint between the lines :-D

                    the error was in the pom file:

                     

                    <argLine>-Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true [****]</argLine>

                     

                    there was a break in this line. :-D

                    thank you,

                    • 7. Re: Beginner Problem on running a simple test
                      aslak

                      hehe, that was what i was suspecting.. 

                      • 8. Re: Beginner Problem on running a simple test
                        bonomat

                        just one more question: how do i solve the "address in use" problem when i have another jboss running?

                        • 9. Re: Beginner Problem on running a simple test
                          aslak

                          You can use -Djboss.service.binding.set=ports-01

                           

                          This will offset all ports by 100

                          • 10. Re: Beginner Problem on running a simple test
                            bonomat

                            thanks for your help,

                            the embedded jboss is running fine, but now i have some problems running it on a remote jboss:

                             

                             

                            org.jboss.arquillian.impl.event.FiredEventException: java.lang.IllegalArgumentException: Pack must be specified

                                      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.beforeClass(EventTestRunnerAdaptor.java:96)

                                      at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:162)

                                      at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:186)

                            .....

                            Caused by: java.lang.IllegalArgumentException: Pack must be specified

                                      at org.jboss.shrinkwrap.impl.base.Validate.notNull(Validate.java:44)

                                      at org.jboss.shrinkwrap.impl.base.container.ContainerBase.addPackage(ContainerBase.java:945)

                                      at org.jboss.jsfunit.arquillian.JSFUnitApplicationArchiveProcessor.process(JSFUnitApplicationArchiveProcessor.java:42)

                                      at org.jboss.arquillian.impl.ClientDeploymentGenerator.applyApplicationProcessors(ClientDeploymentGenerator.java:85)

                             

                            ****HelloEJBIT  Time elapsed: 0.002 sec  <<< ERROR!

                            org.jboss.arquillian.impl.event.FiredEventException: java.lang.IllegalStateException: No org.jboss.shrinkwrap.api.Archive found in context

                                      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.afterClass(EventTestRunnerAdaptor.java:108)

                                      at org.jboss.arquillian.junit.Arquillian$3$2.evaluate(Arquillian.java:190)

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

                                      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)

                                      at org.apache.maven.surefire.Surefire.run(Surefire.java:180)

                                      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: No org.jboss.shrinkwrap.api.Archive found in context

                                      at org.jboss.arquillian.impl.Validate.stateNotNull(Validate.java:75)

                                      at org.jboss.arquillian.impl.handler.ContainerUndeployer.callback(ContainerUndeployer.java:58)

                                      at org.jboss.arquillian.impl.handler.ContainerUndeployer.callback(ContainerUndeployer.java:47)

                                      at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)

                                      ... 17 more

                            any idea why this is happening?

                            my remote profile looks like this:

                            <profile>

                                        <id>jbossas-remote-6</id>

                                        <dependencies>

                                            <dependency>

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

                                                <artifactId>arquillian-jbossas-remote-6</artifactId>

                                                <version>${arquillian.version}</version>

                                            </dependency>

                                            <dependency>

                                                <groupId>org.jboss.jbossas</groupId>

                                                <artifactId>jboss-as-client</artifactId>

                                                <version>${jboss.version}</version>

                                                <type>pom</type>

                                            </dependency>

                                            <dependency>

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

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

                                                <version>1.0.0.Beta4</version>

                                                <type>pom</type>

                                                <scope>provided</scope>

                                            </dependency>

                                        </dependencies>             

                                           <build>

                                               <testResources>

                                                   <testResource>

                                                       <directory>src/test/resources-jbossremote</directory>

                                                   </testResource>

                                               </testResources>                  

                              <plugins>

                                   <plugin>

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

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

                                        <configuration>

                                        <includes>

                                         <include>**/*IT.java</include>

                                        </includes>

                                         </configuration>

                              </plugin>

                              </plugins>

                              </build>

                            </profile>

                             

                            • 11. Re: Beginner Problem on running a simple test
                              aslak

                              Looking at the stacktrace, it seems you have JSFUnit integration activated/added in your project.  But some package (Pack) it is trying to package up during the dpeloy process is not found, so it fails. Have you added JSFUnit integration witout the JSFUnit libs?

                               

                              -aslak-

                              • 12. Re: Beginner Problem on running a simple test
                                bonomat

                                sorry, got it :-) the webarchive wasn't named correctly. it has to be test.war.

                                • 13. Re: Beginner Problem on running a simple test
                                  aslak

                                  aa, the integration is trying to add a package without it being loaded in the classloader yet, resulting in it being null.

                                   

                                  http://anonsvn.jboss.org/repos/jsfunit/tags/2.0.0.Beta1/jboss-jsfunit-arquillian/src/main/java/org/jboss/jsfunit/arquillian/JSFUnitApplicationArchiveProcessor.java

                                   

                                  You can refere to any of the classes in org.jboss.jsfunit.cdi in your @Deployment method to force a load as a work around, i'll forward this to Stan.

                                  • 14. Re: Beginner Problem on running a simple test
                                    ssilvert

                                    Thanks for the heads up Aslak.  This is fixed for the next JSFUnit version. 

                                     

                                    Workaround is documented here: https://issues.jboss.org/browse/JSFUNIT-269

                                     

                                    Stan

                                    1 2 Previous Next