9 Replies Latest reply on Feb 18, 2012 7:14 AM by jobame

    Dependencies for Arquillian with tomcat 7

    jobame

      Hello,

       

      trying to get into Arquillian by implementing the example from the reference documentation (http://docs.jboss.org/arquillian/reference/latest/en-US/html_single/) using tomcat7. However, with my configuration I get the below error (bottom of this posting) which indicates (http://shrubbery.mynetgear.net/c/display/W/Troubleshooting+Arquillian) that I am using the wrong dependencies. However, how can I find out which dependencies are wrong?

       

      I am attaching a sample project ready to be imported into eclipse which does show the error to this post (to run: mvn test -Ptomcat-managed-7 or via Eclipse > Run as > JUnit Test)

       

      I am as well not fully understanding the meaning of the tomcatHome-Variable ("Optional location of a Tomcat installation to link against"). Does the value of this variable need to be configured in the pom or elsewhere? How does Arquillian find the server to run the test on?

       

      Here is my configuration:

       

      pom.xml

       

      <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>
      <groupId>org.test</groupId>
      <artifactId>sample</artifactId>
      <packaging>war</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>sample</name>

      <properties>
        <myfaces.version>2.1.3</myfaces.version>
        <arquillian.version.junit>1.0.0.Alpha5</arquillian.version.junit>
        <arquillian.version.tomcat>1.0.0.CR2</arquillian.version.tomcat>
        <version.tomcat>6.0.35</version.tomcat>
      </properties>

      <repositories>
        <repository>
         <id>java.net</id>
         <url>http://download.java.net/maven/2</url>
        </repository>
        <repository>
         <id>JBoss repository</id>
         <url>http://repository.jboss.org/nexus/content/groups/public/</url>
         <releases>
          <enabled>true</enabled>
         </releases>
         <snapshots>
          <enabled>true</enabled>
         </snapshots>
        </repository>
        <repository>
         <id>jboss-public-repository-group</id>
         <name>JBoss Public Maven Repository Group</name>
         <url>https://repository.jboss.org/nexus/content/groups/public</url>
         <layout>default</layout>
         <releases>
          <enabled>true</enabled>
          <updatePolicy>never</updatePolicy>
         </releases>
         <snapshots>
          <enabled>true</enabled>
          <updatePolicy>never</updatePolicy>
         </snapshots>
        </repository>
      </repositories>

      <profiles>
        <profile>
         <id>myfaces</id>
         <activation>
          <activeByDefault>true</activeByDefault>
         </activation>
         <dependencies>
          <dependency>
           <groupId>org.apache.myfaces.core</groupId>
           <artifactId>myfaces-api</artifactId>
           <version>${myfaces.version}</version>
           <scope>compile</scope>
          </dependency>
          <dependency>
          <dependency>
           <groupId>org.apache.myfaces.core</groupId>
           <artifactId>myfaces-impl</artifactId>
           <version>${myfaces.version}</version>
           <scope>compile</scope>
          </dependency>
         </dependencies>
        </profile>
        <profile>
         <id>tomcat-managed-7</id>
         <dependencies>
          <dependency>
           <groupId>org.jboss.arquillian.container</groupId>
           <artifactId>arquillian-tomcat-managed-7</artifactId>
           <version>${arquillian.version.tomcat}</version>
          </dependency>
         </dependencies>
        </profile>
      </profiles>

      <dependencies>
        <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.8.2</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>org.jboss.arquillian</groupId>
         <artifactId>arquillian-junit</artifactId>
         <version>${arquillian.version.junit}</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>org.apache.tomcat</groupId>
         <artifactId>catalina</artifactId>
         <version>${version.tomcat}</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>org.apache.tomcat</groupId>
         <artifactId>coyote</artifactId>
         <version>${version.tomcat}</version>
         <scope>provided</scope>
        </dependency>
        <dependency>
         <groupId>org.apache.tomcat</groupId>
         <artifactId>jasper</artifactId>
         <version>${version.tomcat}</version>
         <scope>provided</scope>
        </dependency>
        <!-- Weld servlet, EL and JSP required for testing CDI injections -->
        <dependency>
         <groupId>org.jboss.weld.servlet</groupId>
         <artifactId>weld-servlet</artifactId>
         <version>1.0.1-Final</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>org.glassfish.web</groupId>
         <artifactId>el-impl</artifactId>
         <version>2.2</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>javax.servlet.jsp</groupId>
         <artifactId>jsp-api</artifactId>
         <version>2.2</version>
         <scope>test</scope>
        </dependency>
        <dependency>
         <groupId>log4j</groupId>
         <artifactId>log4j</artifactId>
         <version>1.2.14</version>
         <scope>compile</scope>
        </dependency>
        <dependency>
         <groupId>commons-logging</groupId>
         <artifactId>commons-logging</artifactId>
         <version>1.1.1</version>
        </dependency>
        <dependency>
         <groupId>org.apache.myfaces.orchestra</groupId>
         <artifactId>myfaces-orchestra-core20</artifactId>
         <version>1.4</version>
        </dependency>
        <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
         <version>2.5</version>
         <scope>provided</scope>
        </dependency>
        <dependency>
         <groupId>javax.el</groupId>
         <artifactId>el-api</artifactId>
         <version>1.0</version>
         <scope>provided</scope>
        </dependency>
        <dependency>
         <groupId>org.jboss.el</groupId>
         <artifactId>jboss-el</artifactId>
         <version>2.0.1.GA</version>
         <scope>compile</scope>
         <exclusions>
          <exclusion>
           <groupId>javax.el</groupId>
           <artifactId>el-api</artifactId>
          </exclusion>
         </exclusions>
        </dependency>
        <dependency>
         <groupId>commons-el</groupId>
         <artifactId>commons-el</artifactId>
         <version>1.0</version>
        </dependency>
      </dependencies>

      <build>
        <finalName>sample</finalName>
        <defaultGoal>install</defaultGoal>
        <pluginManagement>
         <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>
            <encoding>ISO-8859-1</encoding>
           </configuration>
          </plugin>
          <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-eclipse-plugin</artifactId>
           <version>2.8</version>
           <configuration>
            <wtpversion>1.5</wtpversion>
            <downloadSources>true</downloadSources>
           </configuration>
          </plugin>
          <plugin>
           <groupId>org.apache.tomcat.maven</groupId>
           <artifactId>tomcat7-maven-plugin</artifactId>
           <version>2.0-beta-1</version>
           <configuration>
            <server>mytomcathtml</server>
            <url>http://localhost:8080/manager/html</url>
            <path>/${project.artifactId}</path>
           </configuration>
          </plugin>
         </plugins>
        </pluginManagement>
      </build>

      </project>


      arquillian.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://jboss.org/schema/arquillian
              http://jboss.org/schema/arquillian/arquillian-1.0.xsd">
      <engine>
        <property name="deploymentExportPath">target/</property>
      </engine>

      <container qualifier="tomcat" default="true">
        <configuration>
         <property name="tomcatHome">target/tomcat-managed-7</property>
         <property name="bindHttpPort">8080</property>
         <property name="workDir">work</property>
         <property name="unpackArchive">true</property>
        </configuration>
      </container>
      </arquillian>

       

      Exception being thrown by test run


      java.lang.NoClassDefFoundError: org/jboss/shrinkwrap/descriptor/impl/base/NodeProviderImplBase
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
      at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
      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)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at org.jboss.shrinkwrap.descriptor.api.DescriptorConstructionInfo.<init>(DescriptorConstructionInfo.java:69)
      at org.jboss.shrinkwrap.descriptor.api.DescriptorInstantiator.getDescriptorConstructionInfoForUserView(DescriptorInstantiator.java:275)
      at org.jboss.shrinkwrap.descriptor.api.DescriptorInstantiator.createImporterFromUserView(DescriptorInstantiator.java:178)
      at org.jboss.shrinkwrap.descriptor.api.Descriptors.importAs(Descriptors.java:108)
      at org.jboss.shrinkwrap.descriptor.api.Descriptors.importAs(Descriptors.java:85)
      at org.jboss.arquillian.impl.bootstrap.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:50)
      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.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)
      at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)
      at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)
      at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)
      at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)
      at org.jboss.arquillian.impl.core.ManagerImpl.<init>(ManagerImpl.java:91)
      at org.jboss.arquillian.impl.core.ManagerBuilder.create(ManagerBuilder.java:74)
      at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:97)
      at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:67)
      at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:82)
      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.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.lang.ClassNotFoundException: org.jboss.shrinkwrap.descriptor.impl.base.NodeProviderImplBase
      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)
      ... 52 more

      Regards,

      Mike

        • 1. Re: Dependencies for Arquillian with tomcat 7
          bmajsak

          You are using really old version (Alpha5). Please try following structure:

           

           

          {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/xsd/maven-4.0.0.xsd">

               ...

              <repositories>

                  <repository>

                      <id>jboss-public-repository</id>

                      <name>JBoss Public Repository</name>

                      <url>http://repository.jboss.org/nexus/content/groups/public</url>

                  </repository>

              </repositories>

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

                          </configuration>

                      </plugin>

                  </plugins>

              </build>

              <dependencyManagement>

                  <dependencies>

                      <dependency>

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

                          <artifactId>arquillian-bom</artifactId>

                          <version>1.0.0.CR7</version>

                          <scope>import</scope>

                          <type>pom</type>

                      </dependency>

                  </dependencies>

              </dependencyManagement>

              <dependencies>

                 ...

                  <dependency>

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

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

                      <scope>test</scope>

                  </dependency>

              </dependencies>

               ....

          </project>

          {code}

           

           

          Or you can also have a look at the examples in arquillian-showcase.

          1 of 1 people found this helpful
          • 2. Re: Dependencies for Arquillian with tomcat 7
            bmajsak

            Containers documentation can be found here.

             

            Let me know if it helps

            1 of 1 people found this helpful
            • 3. Re: Dependencies for Arquillian with tomcat 7
              jobame

              Hello,

               

              many thanks. I did as you told and additionally had to set the catalinaHome property in Arquillian configuration. Now tomcat 7 tries to start but fails due to:

               

              java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
              at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
              at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
              at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
              at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
              at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
              at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
              at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043)
              at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
              at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)
              at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
              at java.util.concurrent.FutureTask.run(FutureTask.java:138)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:662)

               

              It doesn't make a difference whether I run the test via "mvn test -Ptomcat-managed-7" or via Eclipse > Run as > JUnit. It seems the libraries are just not included when deploying to tomcat.

               

              In Eclipse under the project's

              • properties > Maven: the profile is entered and the flag "resolve dependencies..." is not checked
              • properties > Java Build Path > Libraries: the Maven Dependencies are listed

               

              It seems this is a tomcat related issue but what can I do to proceed? I tried as well some fancy stuff like http://javatoj2ee.wordpress.com/2011/07/01/java-lang-classnotfoundexception-javax-faces-webapp-facesservlet/ but I am running out of ideas. Help would be much appreciated! I do attach the updated POM and arquillian.xml again at the bottom of this post.

               

              Btw: a good container reference https://docs.jboss.org/author/display/ARQ/Complete+Container+Reference

               

              Regards,

               

              Michael

               

              pom.xml

               

              <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>
              <groupId>org.test</groupId>
              <artifactId>sample</artifactId>
              <packaging>war</packaging>
              <version>1.0-SNAPSHOT</version>
              <name>sample</name>

              <properties>
                <myfaces.version>2.1.3</myfaces.version>
                <arquillian.version.junit>1.0.0.Alpha5</arquillian.version.junit>
                <arquillian.version.tomcat>1.0.0.CR2</arquillian.version.tomcat>
                <version.tomcat>6.0.35</version.tomcat>
              </properties>

              <repositories>
                <repository>
                 <id>java.net</id>
                 <url>http://download.java.net/maven/2</url>
                </repository>
                <repository>
                 <id>JBoss repository</id>
                 <url>http://repository.jboss.org/nexus/content/groups/public/</url>
                 <releases>
                  <enabled>true</enabled>
                 </releases>
                 <snapshots>
                  <enabled>true</enabled>
                 </snapshots>
                </repository>
                <repository>
                 <id>jboss-public-repository-group</id>
                 <name>JBoss Public Maven Repository Group</name>
                 <url>https://repository.jboss.org/nexus/content/groups/public</url>
                 <layout>default</layout>
                 <releases>
                  <enabled>true</enabled>
                  <updatePolicy>never</updatePolicy>
                 </releases>
                 <snapshots>
                  <enabled>true</enabled>
                  <updatePolicy>never</updatePolicy>
                 </snapshots>
                </repository>
                <repository>
                 <id>jboss-public-repository</id>
                 <name>JBoss Public Repository</name>
                 <url>http://repository.jboss.org/nexus/content/groups/public</url>
                </repository>

              </repositories>

              <profiles>
                <profile>
                 <id>tomcat-managed-7</id>
                 <dependencies>
                  <dependency>
                   <groupId>org.jboss.arquillian.container</groupId>
                   <artifactId>arquillian-tomcat-managed-7</artifactId>
                   <version>${arquillian.version.tomcat}</version>
                  </dependency>
                  <dependency>
                   <groupId>org.apache.myfaces.core</groupId>
                   <artifactId>myfaces-api</artifactId>
                   <version>${myfaces.version}</version>
                   <scope>compile</scope>
                  </dependency>
                  <dependency>
                   <groupId>org.apache.myfaces.core</groupId>
                   <artifactId>myfaces-impl</artifactId>
                   <version>${myfaces.version}</version>
                   <scope>compile</scope>
                  </dependency>
                 </dependencies>
                </profile>
              </profiles>

              <dependencyManagement>
                <dependencies>
                 <dependency>
                  <groupId>org.jboss.arquillian</groupId>
                  <artifactId>arquillian-bom</artifactId>
                  <version>1.0.0.CR7</version>
                  <scope>import</scope>
                  <type>pom</type>
                 </dependency>
                </dependencies>
              </dependencyManagement>

              <dependencies>
                <dependency>
                 <groupId>org.jboss.arquillian.junit</groupId>
                 <artifactId>arquillian-junit-container</artifactId>
                 <scope>test</scope>
                </dependency>
                <dependency>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>4.8.2</version>
                 <scope>test</scope>
                </dependency>
                <dependency>
                 <groupId>org.jboss.arquillian</groupId>
                 <artifactId>arquillian-junit</artifactId>
                 <version>${arquillian.version.junit}</version>
                 <scope>test</scope>
                </dependency>
                <dependency>
                 <groupId>org.apache.tomcat</groupId>
                 <artifactId>catalina</artifactId>
                 <version>${version.tomcat}</version>
                 <scope>test</scope>
                </dependency>
                <dependency>
                 <groupId>org.apache.tomcat</groupId>
                 <artifactId>coyote</artifactId>
                 <version>${version.tomcat}</version>
                 <scope>provided</scope>
                </dependency>
                <dependency>
                 <groupId>org.apache.tomcat</groupId>
                 <artifactId>jasper</artifactId>
                 <version>${version.tomcat}</version>
                 <scope>provided</scope>
                </dependency>
                <!-- Weld servlet, EL and JSP required for testing CDI injections -->
                <dependency>
                 <groupId>org.jboss.weld.servlet</groupId>
                 <artifactId>weld-servlet</artifactId>
                 <version>1.0.1-Final</version>
                 <scope>test</scope>
                </dependency>
                <dependency>
                 <groupId>org.glassfish.web</groupId>
                 <artifactId>el-impl</artifactId>
                 <version>2.2</version>
                 <scope>test</scope>
                </dependency>
                <dependency>
                 <groupId>javax.servlet.jsp</groupId>
                 <artifactId>jsp-api</artifactId>
                 <version>2.2</version>
                 <scope>test</scope>
                </dependency>
                <dependency>
                 <groupId>log4j</groupId>
                 <artifactId>log4j</artifactId>
                 <version>1.2.14</version>
                 <scope>compile</scope>
                </dependency>
                <dependency>
                 <groupId>commons-logging</groupId>
                 <artifactId>commons-logging</artifactId>
                 <version>1.1.1</version>
                </dependency>
                <dependency>
                 <groupId>org.apache.myfaces.orchestra</groupId>
                 <artifactId>myfaces-orchestra-core20</artifactId>
                 <version>1.4</version>
                </dependency>
                <dependency>
                 <groupId>javax.servlet</groupId>
                 <artifactId>servlet-api</artifactId>
                 <version>2.5</version>
                 <scope>provided</scope>
                </dependency>
                <dependency>
                 <groupId>javax.el</groupId>
                 <artifactId>el-api</artifactId>
                 <version>1.0</version>
                 <scope>provided</scope>
                </dependency>
                <dependency>
                 <groupId>org.jboss.el</groupId>
                 <artifactId>jboss-el</artifactId>
                 <version>2.0.1.GA</version>
                 <scope>compile</scope>
                 <exclusions>
                  <exclusion>
                   <groupId>javax.el</groupId>
                   <artifactId>el-api</artifactId>
                  </exclusion>
                 </exclusions>
                </dependency>
                <dependency>
                 <groupId>commons-el</groupId>
                 <artifactId>commons-el</artifactId>
                 <version>1.0</version>
                </dependency>
              </dependencies>

              <build>
                <finalName>sample</finalName>
                <defaultGoal>install</defaultGoal>
                <pluginManagement>
                 <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>
                    <encoding>ISO-8859-1</encoding>
                   </configuration>
                  </plugin>
                  <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-eclipse-plugin</artifactId>
                   <version>2.8</version>
                   <configuration>
                    <wtpversion>1.5</wtpversion>
                    <downloadSources>true</downloadSources>
                   </configuration>
                  </plugin>
                  <plugin>
                   <groupId>org.apache.tomcat.maven</groupId>
                   <artifactId>tomcat7-maven-plugin</artifactId>
                   <version>2.0-beta-1</version>
                   <configuration>
                    <server>mytomcathtml</server>
                    <url>http://localhost:8080/manager/html</url>
                    <path>/${project.artifactId}</path>
                   </configuration>
                  </plugin>
                 </plugins>
                </pluginManagement>
              </build>

              </project>

               

              arquillian.xml

               

              <?xml version="1.0" encoding="UTF-8"?>
              <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://jboss.org/schema/arquillian
                      http://jboss.org/schema/arquillian/arquillian-1.0.xsd">
              <engine>
                <property name="deploymentExportPath">targeta/</property>
              </engine>

              <container qualifier="tomcat" default="true">
                <configuration>
                 <property name="tomcatHome">target/tomcat-managed-7</property>
                 <property name="catalinaHome">c:/Programme/xampp/xampp/tomcat/</property>
                 <property name="bindHttpPort">8080</property>
                 <property name="workDir">work</property>
                 <property name="unpackArchive">true</property>
                </configuration>

               

              </container>
              </arquillian>

              • 4. Re: Dependencies for Arquillian with tomcat 7
                bmajsak

                How does you test packaging method (@Deployment) look like? Maybe you simply need to add all required libs to your WAR - using for instance Maven Resolver (for details how to use it please have a look here or here).

                • 5. Re: Dependencies for Arquillian with tomcat 7
                  jobame

                  All of a sudden it is working. I cannot say what exactly was the cause. However, the configuration in arquillian.xml definitely was contributing to the failure. Here the updated version

                   

                  <?xml version="1.0" encoding="UTF-8"?>
                  <arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://jboss.org/schema/arquillian
                          http://jboss.org/schema/arquillian/arquillian-1.0.xsd">
                  <engine>
                    <property name="deploymentExportPath">target/</property>
                  </engine>

                  <!-- Config example for tomcat6 see https://docs.jboss.org/author/display/ARQ/Tomcat+6.0+-+Managed -->
                  <container qualifier="tomcat" default="true">
                    <configuration>
                     <property name="catalinaHome">c:/Programme/xampp/xampp/tomcat/</property>
                     <property name="bindHttpPort">8080</property>
                     <property name="bindAddress">localhost</property>
                     <property name="workDir">work</property>
                     <property name="user">test</property>
                     <property name="pass">test</property>
                     <property name="serverConfig">server.xml</property>
                    </configuration>
                  </container>
                  </arquillian>

                   

                  (Hopefully) one last question: I followed the example from http://docs.jboss.org/arquillian/reference/latest/en-US/html_single/#d0e451 (section 3.2). However, the inject doesn't work (it throws a NPE on the testConvert-Methods - variable "converter" is null). In the meantime I updated my pom and added

                   

                  <dependency>
                     <groupId>javax.enterprise</groupId>
                     <artifactId>cdi-api</artifactId>
                     <version>1.0-SP1</version> 
                  </dependency>

                   

                  What else is missing to make the inject work?

                  • 6. Re: Dependencies for Arquillian with tomcat 7
                    bmajsak

                    Tomcat does not support CDI out of the box, please have a look here: http://docs.jboss.org/weld/reference/1.0.0/en-US/html/environments.html#d0e4998

                     

                    Hope that helps.

                     

                    Cheers,

                    Bartosz

                    • 7. Re: Dependencies for Arquillian with tomcat 7
                      jobame

                      Couldn't make CDI work on tomcat 7 - even without Arquillian. I really wound me up for almost two days. Then I found the posting http://weblogs.java.net/blog/cayhorstmann/archive/2009/12/29/jsf-20-and-tomcat which made me think about switching to Glassfish or JBoss. Since I tried and started to dislike Glassfish already a couple of months ago I am now switching to JBoss. Installation and quickstarts worked fine. My own application, although, cannot be deployed due to the below error. However, I opened a new thread for it: https://community.jboss.org/thread/195409

                       

                      Thanks for your help, Bartosz!

                       

                      08:45:36,103 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.persistenceunit."jatpresent.war#jatPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."jatpresent.war#jatPU": 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$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
                      Caused by: java.lang.UnsupportedOperationException: The application must supply JDBC connections
                      at org.hibernate.service.jdbc.connections.internal.UserSuppliedConnectionProviderImpl.getConnection(UserSuppliedConnectionProviderImpl.java:62)
                      at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
                      at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:146)
                      at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:460)
                      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
                      at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
                      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
                      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
                      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
                      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

                      08:45:36,400 INFO  [org.jboss.as.server] (management-handler-threads - 7) JBAS015870: Deploy of deployment "jatpresent.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"jatpresent.war#jatPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"jatpresent.war#jatPU\": Failed to start service"}}

                      • 8. Re: Dependencies for Arquillian with tomcat 7
                        aslak

                        Looks like you have a persistence.xml that is not setup to use the Contianer provided Datasources..

                         

                        Can you post the content of your persistence.xml ?

                         

                        "UserSuppliedConnectionProvider: The application must supply JDBC connections"

                         


                         

                         


                        • 9. Re: Dependencies for Arquillian with tomcat 7
                          jobame

                          Since I thought that this new problem is not an arquillian related problem I opened a new posting at https://community.jboss.org/thread/195409. I just added my persistence.xml there. Answers much appreciated!