13 Replies Latest reply on Oct 26, 2012 5:18 AM by mattil

    Problems with Arquillian Setup in an existing Ant-Project

    ugiwolf

      Hi!

       

      I'm new in this community and I have some problems with integration of arquillian in my existing project. First of all, I will give you a short summary of my used components. The frontend is Flex (4.6), the backend is implemented with Java (EJB 3). For communication between front- and backend, I use GraniteDS. For communication with my Postgresql-Database I use JPA 2.0 (Provider: eclipselink). The .WAR is deployed on a Glassfish v3 Application Server. For deployment, I use Ant and for unit testing JUnit 3. For testing the EJB components I use OpenEJB. The problem here is, that OpenEJB only supports JPA 1.0 and this is the reason, why I tried changing to Arquillian.

       

      A preferred configuration would be the use of Ant with Ivy. OpenEJB should be replaced by Arquillian and the unit testing framework should be JUnit 4.

      I reconfigured my project with settings from http://www.dimitrijwulf.de/2012/04/how-to-setup-arquillian-without-maven-to-test-ejbs-on-jboss-7-1/#comment-20

      but I got some problems:

       

      Erstellungsdatei: /Users/juergenwolfsgruber/Documents/workspace/employeemanager/build.xml

           [taskdef] Could not load definitions from resource flexTasks.tasks. It could not be found.

       

      clean:

       

      ERSTELLUNG FEHLGESCHLAGEN

      /Users/juergenwolfsgruber/Documents/workspace/employeemanager/build.xml:79: Directory does not exist: /Users/juergenwolfsgruber/Documents/workspace/employeemanager/build

       

      Gesamtzeit:280 Millisekunden

       

       

      Here are some config-Files from my project:

       

      ivy.xml:

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

      <ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">

          <info organisation="" module="employeemanager" />

          <dependencies>

          <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container" rev="1.0.0.CR7"/>

          <dependency org="org.jboss.arquillian.container" name="arquillian-glassfish-embedded-3.1" rev="1.0.0.CR3"/>

        <dependency org="org.glassfish.main.extras" name="glassfish-embedded-all" rev="3.1.2"/>

        </dependencies>

      </ivy-module>

       

      ivysettings.xml:

      <?xml version="1.0"?>

      <ivysettings>

          <settings defaultResolver="default"/>

          <resolvers>

              <chain name="default">

                  <ibiblio name="maven2" m2compatible="true"/>

                  <ibiblio name="jboss-public" m2compatible="true" checksums=""root="http://repository.jboss.org/nexus/content/groups/public"/>

                  <ibiblio name="maven2-repository.dev.java.net" m2compatible="true"root="http://download.java.net/maven/glassfish/"/>

              </chain>

          </resolvers>

      </ivysettings>

       

      and build.xml:

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

      <project name="employeemanager" default="deploy" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">

       

        <!-- Modify FLEX_HOME/JBOSS_HOME properties to reflect your environment -->

          <property name="FLEX_HOME" value="/Applications/Adobe Flash Builder 4 Plug-in/sdks/4.1.0"/>

          <property name="GLASSFISH_HOME"value="/Users/juergenwolfsgruber/glassfish3/glassfish/domains/domain1/autodeploy"/>

       

        <!-- ====================================================================== -->

          <!-- Build environment properties                                           -->

          <!-- ====================================================================== -->

       

          <property file="${user.home}/build.properties"/>

          <property file="build.properties"/>

       

          <property name="project.build.finalName" value="employeemanager-SNAPSHOT"/>

          <property name="project.build.directory" value="target"/>

          <property name="project.build.outputDirectory" value="${project.build.directory}/classes"/>

          <property name="project.source.directory" value="java"/>

          <property name="project.resource.directory" value="resources"/>

          <property name="project.build.testOutputDirectory" value="${project.build.directory}/test-classes"/>

          <property name="project.testSource.directory" value="ejbTest"/>

          <property name="project.testResource.directory" value="resources"/>

          <property name="project.test.reportsOutputDirectory" value="${project.build.directory}/test-results"/>

          <property name="project.test.useFile" value="true"/>

       

          <property name="maven.repo.central" value="http://repo1.maven.org/maven2"/>

          <property name="maven.repo.jboss-public" value="https://repository.jboss.org/nexus/content/groups/public"/>

          <property name="maven.repo.local" value="${user.home}/.m2/repository"/>

          <property name="maven.settings.offline" value="false"/>

          <property name="maven.settings.interactiveMode" value="true"/>

       

          <property name="ivy.install.version" value="2.2.0-rc1"/>

          <property name="ivy.jar.dir" value="${basedir}/.ivy"/>

          <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>

       

        <!-- Declare Flex Ant tasks (such as mxmlc used below) -->

        <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

       

          <!-- ====================================================================== -->

          <!-- Ivy bootstrap targets                                                  -->

          <!-- ====================================================================== -->

       

          <target name="init-ivy">

              <available property="ivy.installed" value="true" file="${ivy.jar.file}" type="file"/>

          </target>

       

          <target name="download-ivy" depends="init-ivy" unless="ivy.installed">

              <mkdir dir="${ivy.jar.dir}"/>

              <echo message="Installing ivy..."/>

              <get src="${maven.repo.central}/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"

                   dest="${ivy.jar.file}"/>

          </target>

       

          <target name="load-ivy" depends="init-ivy,download-ivy">

              <path id="ivy.lib.path">

                  <fileset dir="${ivy.jar.dir}" includes="*.jar"/>

              </path>

              <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"classpathref="ivy.lib.path"/>

              <ivy:settings file="${basedir}/ivysettings.xml"/>

          </target>

       

          <target name="clean-ivy" depends="load-ivy">

              <ivy:cleancache/>

          </target>

       

          <!-- ====================================================================== -->

          <!-- Defining classpaths                                                    -->

          <!-- ====================================================================== -->

       

          <target name="init" depends="load-ivy">

          </target>

       

          <!-- ====================================================================== -->

          <!-- Cleaning up target                                                     -->

          <!-- ====================================================================== -->

       

          <target name="clean" description="Clean the output directory">

              <delete dir="${project.build.directory}"/>

          <delete includeemptydirs="true">

        <fileset dir="build" defaultexcludes="false">

        <include name="*"/>

        </fileset>

        </delete>

          </target>

       

          <!-- ====================================================================== -->

          <!-- Compilation target                                                     -->

          <!-- ====================================================================== -->

       

          <target name="compile" depends="init" description="Compile the code">

              <ivy:resolve conf="compile-only"/>

              <ivy:cachepath pathid="build.classpath" conf="compile-only"/>

              <mkdir dir="${project.build.outputDirectory}"/>

              <javac destdir="${project.build.outputDirectory}"

                       nowarn="true"

                       debug="true"

                       optimize="true"

                       deprecation="false"

                       target="1.6"

                       verbose="false"

                       fork="true"

                       source="1.6">

                  <src>

                      <pathelement location="${project.source.directory}"/>

                  </src>

                  <classpath refid="build.classpath"/>

              </javac>

          </target>

       

          <!-- ====================================================================== -->

          <!-- Test compilation target                                                -->

          <!-- ====================================================================== -->

       

          <target name="compile-tests"

                    depends="compile"

                    description="Compile the test code"

                    unless="maven.test.skip">

              <ivy:resolve conf="test"/>

              <ivy:cachepath pathid="build.test.classpath" conf="test"/>

              <mkdir dir="${project.build.testOutputDirectory}"/>

              <javac destdir="${project.build.testOutputDirectory}"

                       nowarn="true"

                       debug="true"

                       optimize="true"

                       deprecation="false"

                       target="1.6"

                       verbose="false"

                       fork="true"

                       source="1.6">

                  <src>

                      <pathelement location="${project.testSource.directory}"/>

                  </src>

                  <classpath>

                      <path refid="build.classpath"/>

                      <path refid="build.test.classpath"/>

                      <pathelement location="${project.build.outputDirectory}"/>

                  </classpath>

              </javac>

              <copy todir="${project.build.testOutputDirectory}">

                  <fileset dir="${project.testResource.directory}"/>

              </copy>

          </target>

       

          <!-- ====================================================================== -->

          <!-- Test targets                                                           -->

          <!-- ====================================================================== -->

       

          <target name="test"

                    depends="test-weld-embedded"

                    description="Run the test cases (default)"/>

       

          <target name="test-weld-embedded"

                    depends="compile-tests"

                    description="Run the test cases on Weld Embedded">

              <mkdir dir="${project.test.reportsOutputDirectory}"/>

              <ivy:resolve conf="test-weld-embedded"/>

              <ivy:cachepath pathid="build.test.classpath.weld-embedded" conf="test-weld-embedded"/>

              <junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">

                  <sysproperty key="basedir" value="."/>

                  <formatter type="xml"/>

                  <formatter type="plain" usefile="${project.test.useFile}"/>

                  <classpath>

                      <path refid="build.test.classpath.weld-embedded"/>

                      <pathelement location="${project.build.outputDirectory}"/>

                      <pathelement location="${project.build.testOutputDirectory}"/>

                  </classpath>

                  <batchtest todir="${project.test.reportsOutputDirectory}" unless="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/Test*.java"/>

                          <include name="**/*Test.java"/>

                          <include name="**/*TestCase.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

                  <batchtest todir="${project.test.reportsOutputDirectory}" if="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/${test}.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

              </junit>

          </target>

       

          <target name="test-jbossas6-remote"

                    depends="compile-tests"

                    description="Run the test cases on a remote JBoss AS 6 instance">

              <mkdir dir="${project.test.reportsOutputDirectory}"/>

              <ivy:resolve conf="test-jbossas6-remote"/>

              <ivy:cachepath pathid="build.test.classpath.jbossas6-remote" conf="test-jbossas6-remote"/>

              <junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">

                  <sysproperty key="basedir" value="."/>

                  <formatter type="xml"/>

                  <formatter type="plain" usefile="${project.test.useFile}"/>

                  <classpath>

                      <path refid="build.test.classpath.jbossas6-remote"/>

                      <pathelement location="${project.build.outputDirectory}"/>

                      <pathelement location="${project.build.testOutputDirectory}"/>

                  </classpath>

                  <batchtest todir="${project.test.reportsOutputDirectory}" unless="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/Test*.java"/>

                          <include name="**/*Test.java"/>

                          <include name="**/*TestCase.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

                  <batchtest todir="${project.test.reportsOutputDirectory}" if="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/${test}.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

              </junit>

          </target>

       

          <target name="test-jbossas7-managed"

                    depends="compile-tests"

                    description="Run the test cases on a managed JBoss AS 7 instance">

              <mkdir dir="${project.test.reportsOutputDirectory}"/>

              <ivy:resolve conf="test-jbossas7-managed"/>

              <ivy:cachepath pathid="build.test.classpath.jbossas7-managed" conf="test-jbossas7-managed"/>

              <junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">

                  <sysproperty key="basedir" value="."/>

                  <formatter type="xml"/>

                  <formatter type="plain" usefile="${project.test.useFile}"/>

                  <classpath>

                      <path refid="build.test.classpath.jbossas7-managed"/>

                      <pathelement location="${project.build.outputDirectory}"/>

                      <pathelement location="${project.build.testOutputDirectory}"/>

                  </classpath>

                  <batchtest todir="${project.test.reportsOutputDirectory}" unless="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/Test*.java"/>

                          <include name="**/*Test.java"/>

                          <include name="**/*TestCase.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

                  <batchtest todir="${project.test.reportsOutputDirectory}" if="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/${test}.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

              </junit>

          </target>

       

          <target name="test-jbossas7-remote"

                    depends="compile-tests"

                    description="Run the test cases on a remote JBoss AS 7 instance">

              <mkdir dir="${project.test.reportsOutputDirectory}"/>

              <ivy:resolve conf="test-jbossas7-remote"/>

              <ivy:cachepath pathid="build.test.classpath.jbossas7-remote" conf="test-jbossas7-remote"/>

              <junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">

                  <sysproperty key="basedir" value="."/>

                  <formatter type="xml"/>

                  <formatter type="plain" usefile="${project.test.useFile}"/>

                  <classpath>

                      <path refid="build.test.classpath.jbossas7-remote"/>

                      <pathelement location="${project.build.outputDirectory}"/>

                      <pathelement location="${project.build.testOutputDirectory}"/>

                  </classpath>

                  <batchtest todir="${project.test.reportsOutputDirectory}" unless="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/Test*.java"/>

                          <include name="**/*Test.java"/>

                          <include name="**/*TestCase.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

                  <batchtest todir="${project.test.reportsOutputDirectory}" if="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/${test}.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

              </junit>

          </target>

       

          <target name="test-glassfish-embedded"

                    depends="compile-tests"

                    description="Run the test cases on Embedded GlassFish">

              <mkdir dir="${project.test.reportsOutputDirectory}"/>

              <ivy:resolve conf="test-glassfish-embedded"/>

              <ivy:cachepath pathid="build.test.classpath.glassfish-embedded" conf="test-glassfish-embedded"/>

              <junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">

                  <sysproperty key="basedir" value="."/>

                  <formatter type="xml"/>

                  <formatter type="plain" usefile="${project.test.useFile}"/>

                  <classpath>

                      <path refid="build.test.classpath.glassfish-embedded"/>

                      <pathelement location="${project.build.outputDirectory}"/>

                      <pathelement location="${project.build.testOutputDirectory}"/>

                  </classpath>

                  <batchtest todir="${project.test.reportsOutputDirectory}" unless="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/Test*.java"/>

                          <include name="**/*Test.java"/>

                          <include name="**/*TestCase.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

                  <batchtest todir="${project.test.reportsOutputDirectory}" if="test">

                      <fileset dir="${project.testSource.directory}">

                          <include name="**/${test}.java"/>

                          <exclude name="**/*Abstract*Test.java"/>

                      </fileset>

                  </batchtest>

              </junit>

          </target>

       

          <!-- ====================================================================== -->

          <!-- Package target                                                         -->

          <!-- ====================================================================== -->

       

          <target name="package" depends="compile,test" description="Package the application">

              <jar jarfile="${project.build.directory}/${project.build.finalName}.jar"

                    compress="true"

                    index="false"

                    basedir="${project.build.outputDirectory}"

                    excludes="**/package.html"/>

          </target>

       

          <!-- ====================================================================== -->

          <!-- A convenience target for the artifact type created by this project     -->

          <!-- ====================================================================== -->

       

          <target name="jar" depends="package" description="Builds the jar for the application"/>

       

          <!-- ====================================================================== -->

          <!-- Dependency reports                                                     -->

          <!-- ====================================================================== -->

       

          <target name="dependency-report" depends="init">

              <ivy:resolve conf="test-weld-embedded"/>

              <ivy:report todir="${project.build.directory}/dependency-reports/test-weld-embedded" conf="test-weld-embedded"/>

              <ivy:resolve conf="test-jbossas6-remote"/>

              <ivy:report todir="${project.build.directory}/dependency-reports/test-jbossas6-remote" conf="test-jbossas6-remote"/>

              <ivy:resolve conf="test-jbossas7-managed"/>

              <ivy:report todir="${project.build.directory}/dependency-reports/test-jbossas7-managed" conf="test-jbossas7-managed"/>

              <ivy:resolve conf="test-jbossas7-remote"/>

              <ivy:report todir="${project.build.directory}/dependency-reports/test-jbossas7-remote" conf="test-jbossas7-remote"/>

              <ivy:resolve conf="test-glassfish-embedded"/>

              <ivy:report todir="${project.build.directory}/dependency-reports/test-glassfish-embedded" conf="test-glassfish-embedded"/>

          </target>

       

          <!-- ====================================================================== -->

          <!-- Help target                                                            -->

          <!-- ====================================================================== -->

       

          <target name="help">

              <echo message="Please run: $ant -projecthelp"/>

          </target>

       

        <!-- Build an ear suitable for JBoss -->

          <target name="ear" depends="clean">

              <mkdir dir="build"/>

              <jar destfile="build/employeemanager.jar">

                  <fileset dir="bin" includes="**/*.class" excludes="**/Test*.class"/>

                  <zipfileset file="resources/META-INF/graniteDS/persistence.xml" prefix="META-INF" />

              <zipfileset file="resources/META-INF/graniteDS/services-config.properties" prefix="META-INF" />

              <zipfileset file="resources/META-INF/graniteDS/log4j.properties"/>

              </jar>

              <war destfile="build/employeemanager.war" webxml="resources/META-INF/graniteDS/web.xml">

                  <zipfileset file="resources/META-INF/graniteDS/services-config.xml" prefix="WEB-INF/flex" />

                  <zipfileset file="resources/META-INF/graniteDS/granite-config.xml" prefix="WEB-INF/granite" />

              <zipfileset file="resources/META-INF/graniteDS/persistence.xml" prefix="WEB-INF/classes/META-INF" />

              <zipfileset file="resources/META-INF/graniteDS/services-config.properties" prefix="WEB-INF/classes/META-INF" />

              <fileset dir="bin-debug" includes="Main.swf"/>

              <fileset dir="bin-debug" includes="playerProductInstall.swf"/>

              <fileset dir="bin-debug" includes="Main.html"/>

              <fileset dir="bin-debug" includes="swfobject.js"/>

              </war>

              <ear destfile="build/employeemanager.ear" appxml="resources/META-INF/graniteDS/application.xml">

                  <fileset dir="build" includes="*.jar,*.war"/>

                  <zipfileset dir="lib/java" includes="granite.jar" prefix="lib" />

              <zipfileset dir="lib/java" includes="granite-eclipselink.jar" prefix="lib" />

                  <zipfileset dir="lib/java" includes="eclipselink.jar" prefix="lib" />

              </ear>

          </target>

       

          <!-- Deploy the ear in Glassfish -->

          <target name="deploy" depends="ear">

              <copy todir="${GLASSFISH_HOME}" file="build/employeemanager.ear"/>

          </target>

       

      </project>

       

      It's clear for me, that the error message is not hard to understand. My problem is, that I don't know, whether my configurations are correct or if there are some other restrictions, knowing problems, ... with my used components in project.

       

      I would be deeply grateful for constructive tipps.

       

      Thanks,

       

      Jürgen

        • 1. Re: Problems with Arquillian Setup in an existing Ant-Project
          robert.panzer

          Hi,

           

          it looks like the build/ dir does not exist.

          Maybe you should try change line 79 from

              <delete includeemptydirs="true">

          to

              <delete includeemptydirs="true" failonerror="false">

           

          Kind regards,

          Robert

          • 2. Re: Problems with Arquillian Setup in an existing Ant-Project
            ugiwolf

            Hello,

             

            thank you Robert for this tipp. I think, this will be helpful for creating the missing directories. Maybe that my problem description is too general (sorry ), so I wanna try formulating my problems stepwise.

             

            First of all, I try to implement arquillian in my project as described here: http://www.dimitrijwulf.de/2012/04/how-to-setup-arquillian-without-maven-to-test-ejbs-on-jboss-7-1/#comment-20

             

            I have installed the eclipse-plugin ivyDE do resolve dependencies defined in ivy.xml:

             

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

            <ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">

                <info organisation="com.myproject"

                module="myproject"

                revision="1.0.0-SNAPSHOT"/>

                <dependencies>

                <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container" rev="1.0.1.Final"/>

                <dependency org="org.jboss.arquillian.container" name="arquillian-glassfish-embedded-3.1" rev="1.0.0.CR3"/>

              <dependency org="org.glassfish.extras" name="glassfish-embedded-all" rev="3.1.1"/>       

                </dependencies>   

            </ivy-module>

             

            ivysettings.xml:

             

            <?xml version="1.0"?>

            <ivysettings>

                <settings defaultResolver="default"/>

                <resolvers>

                    <chain name="default">

                        <ibiblio name="maven2" m2compatible="true"/>

                        <ibiblio name="jboss-public" m2compatible="true" checksums="" root="http://repository.jboss.org/nexus/content/groups/public"/>

                        <ibiblio name="glassfish" m2compatible="true" root="http://download.java.net/maven/glassfish" />          

                    </chain>

                </resolvers>

            </ivysettings>

             

             

            Instead of JBoss AS7.1, I use the Glassfish Server Open Source Edition 3. I added the Glassfish Server Runtime to my project  and start "Add Ivy Library ..".

             

            After several minutes of downloading the dependency libraries I got a long error message:

             

            Some projects fail to be resolved

            Impossible to resolve dependencies of com.myproject#myproject;1.0.0-SNAPSHOT

            download failed: org.glassfish.security#inmemory.jacc.provider;3.1.1!inmemory.jacc.provider.hk2-jar

            download failed: org.glassfish.admingui#glassfish-osgi-console-plugin;3.1.1!glassfish-osgi-console-plugin.hk2-jar

            unresolved dependency: org.eclipse.persistence#org.eclipse.persistence.asm;2.3.0: not found

            download failed: org.glassfish.fighterfish#osgi-ejb-container;1.0.0!osgi-ejb-container.hk2-jar

            download failed: org.glassfish.cluster#gms-bootstrap;3.1.1!gms-bootstrap.hk2-jar

            download failed: org.jboss.weld#weld-osgi-bundle;1.1.1.Final!weld-osgi-bundle.jar

            download failed: org.glassfish.persistence.cmp#cmp-generator-database;3.1.1!cmp-generator-database.hk2-jar

            download failed: org.glassfish.web#web-core;3.1.1!web-core.hk2-jar

            download failed: org.glassfish.jdbc#templates;3.1.1!templates.distribution-fragment

            unresolved dependency: org.eclipse.persistence#org.eclipse.persistence.jpa;2.3.0: not found

            download failed: org.glassfish.ha#ha-shoal-cache-bootstrap;3.1.1!ha-shoal-cache-bootstrap.hk2-jar

            download failed: org.glassfish.extras#appserv-rt-frag;3.1.1!appserv-rt-frag.distribution-fragment

            download failed: org.glassfish.deployment#sun-as-jsr88-dm-frag;3.1.1!sun-as-jsr88-dm-frag.distribution-fragment

            download failed: org.glassfish.extras#glassfish-embedded-shell-frag;3.1.1!glassfish-embedded-shell-frag.distribution-fragment

             

            ....

             

            the list is very long!

             

            Starting the "Add Ivy Library ..." with this ivy.xml,

             

             

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

            <ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">

                 <info organisation="org.blog" module="testbean" />

                      <dependencies>

                           <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container" rev="1.0.0.CR7" />

                           <dependency org="org.jboss.as" name="jboss-as-arquillian-container-managed" rev="7.1.0.Final" />

                           <dependency org="javax.enterprise" name="cdi-api" rev="1.0-SP4" />

                      </dependencies>

            </ivy-module>

            the download runs without errors and without problems.

             

            I am not sure, if this is the correct discussion group for this point, but I hope, that somebody can help me with this problem.

             

            LG

             

            Jürgen

            • 3. Re: Problems with Arquillian Setup in an existing Ant-Project
              robert.panzer

              Hi,

               

              I do not have any knowledge about glassfish, but I get ivy loading lots of artefacts as well with this ivy.xml.

              I think it would be sufficient to use this dependency if you do not have any compile time dependencies on glassfish in your code:

              <dependency org="org.glassfish.extras" name="glassfish-embedded-all" rev="3.1.1" conf="test->default(*)"/>

              Then ivy only loads the glassfish-embedded-all artefact.

               

              Kind regards,

              Robert

              1 of 1 people found this helpful
              • 4. Re: Problems with Arquillian Setup in an existing Ant-Project
                ugiwolf

                Hello,

                 

                thank you Robert for the tipp! After some further problems with missing dependencies (shrinkwrap), I would like to post my correct running ivy.xml:

                 

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

                <ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">

                    <info organisation="com.myproject"

                    module="myproject"

                    revision="1.0.0-SNAPSHOT"/>

                    <configurations>

                    <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>

                     <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>

                     <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>

                     <conf name="compile-only" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths." extends="compile"/>

                     <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>

                     <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>

                     <conf name="test" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="runtime"/> 

                  </configurations>

                   

                    <dependencies>

                    <dependency org="org.glassfish.extras" name="glassfish-embedded-all" rev="3.1.1" conf="test->default(*)"/> 

                    <dependency org="org.jboss.arquillian.container" name="arquillian-glassfish-embedded-3.1" rev="1.0.0.CR3" conf="test->default(*)"/>           

                  <dependency org="org.glassfish.extras" name="glassfish-embedded-all" rev="3.1.1" conf="test->default(*)"/>

                  <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container" rev="1.0.1.Final" conf="test->default(*)"/>

                  <dependency org="org.jboss.shrinkwrap" name="shrinkwrap-api" rev="1.0.1"/>

                  <dependency org="org.jboss.shrinkwrap" name="shrinkwrap-impl-base" rev="1.0.1"/>

                  <dependency org="org.jboss.shrinkwrap.descriptors" name="shrinkwrap-descriptors-api" rev="0.1.7"/>

                  <dependency org="org.jboss.shrinkwrap.descriptors" name="shrinkwrap-descriptors-spi" rev="2.0.0-alpha-3"/>

                  <dependency org="org.jboss.shrinkwrap.descriptors" name="shrinkwrap-descriptors-api-base" rev="2.0.0-alpha-3"/>

                    </dependencies>   

                </ivy-module>

                 

                So, now I tried creating a simple unit test on an existing .war file.

                 

                package com.myproject.testcase;

                 

                import java.io.File;

                import java.util.Date;

                 

                import javax.ejb.EJB;

                 

                import junit.framework.Assert;

                 

                import org.jboss.arquillian.container.test.api.Deployment;

                import org.jboss.arquillian.junit.Arquillian;

                import org.jboss.shrinkwrap.api.ShrinkWrap;

                import org.jboss.shrinkwrap.api.spec.WebArchive;

                import org.junit.Test;

                import org.junit.runner.RunWith;

                 

                import com.myproject.domain.TestService;

                 

                 

                @RunWith(Arquillian.class)

                public class MyProjectArquillianTest {

                 

                  @Deployment

                          public static WebArchive createTestArchive() {

                                         return ShrinkWrap.createFromZipFile(WebArchive.class, new File("build/myproject.war"));

                          }

                 

                  @EJB

                          private TestService testService;

                 

                  @Test

                          public void saveTestEntityCall() throws Exception { 

                                         Assert.assertTrue(testService.doAnything());

                          }

                }

                 

                When I start running the unit test, I got the following error message:

                 

                java.lang.RuntimeException: Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor see cause.

                          at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:170)

                          at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)

                          at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:93)

                          at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                          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.reflect.InvocationTargetException

                          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.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)

                          ... 8 more

                 

                I checked the loaded dependencies for the mentioned class, org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.

                LittleSnapper.png
                To my mind that should be correct. Or not?? Thanks to the community for helping me.
                Best regards,
                Jürgen

                • 5. Re: Problems with Arquillian Setup in an existing Ant-Project
                  ugiwolf

                  Does anyone have an idea for my problem?

                   

                  Best regards,

                  Jürgen

                  • 6. Re: Problems with Arquillian Setup in an existing Ant-Project
                    ugiwolf

                    I have tried different things like adding an arquillian.xml to my project, adding glassfish-resources.xml, trying different dependency-Versions in my ivy.xml and so on. I always got the same error.

                     

                    java.lang.RuntimeException: Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor see cause.

                              at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:170)

                              at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)

                              at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:93)

                              at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                              at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                              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.reflect.InvocationTargetException

                              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.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)

                              ... 8 more

                    Caused by: java.lang.NoSuchMethodError: org.jboss.shrinkwrap.descriptor.spi.DescriptorImporterBase.fromStream(Ljava/io/InputStream;Z)Lorg/jboss/shrinkwrap/descriptor/api/Descriptor;

                              at org.jboss.shrinkwrap.descriptor.spi.DescriptorImporterBase.fromStream(DescriptorImporterBase.java:155)

                              at org.jboss.shrinkwrap.descriptor.spi.DescriptorImporterBase.from(DescriptorImporterBase.java:182)

                              at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:54)

                              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.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                              at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                              at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

                              at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

                              at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:261)

                              at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:56)

                              ... 13 more

                     

                    Could this be a bug in arquillian/shrinkwrap??

                     

                    Best regards,

                     

                    Jürgen

                    • 7. Re: Problems with Arquillian Setup in an existing Ant-Project
                      ugiwolf

                      Thanks for help! I think, there is no answer for my problem.

                       

                      Best regards,

                       

                      Jürgen

                      • 8. Re: Problems with Arquillian Setup in an existing Ant-Project
                        jmnarloch

                        Hi

                         

                        I think that your problem is caused by the fact that Glassfish container depends on Arquillian Core 1.0.0.CR7 (https://repository.jboss.org/nexus/service/local/repositories/releases/content/org/jboss/arquillian/arquillian-parent/1.0.0.CR7/arquillian-parent-1.0.0.CR7.pom) and shinkwrap in version 1.0.0. The may got this exception due the changes made in shinkwrap API in version 2.0.0. Could please try checking the tests with thoose shinkwrap archives?

                        • 9. Re: Problems with Arquillian Setup in an existing Ant-Project
                          jmnarloch

                          BTW. Maybe you will find usefull the pom.xml from the Arquillian Gettings Started https://github.com/arquillian/arquillian-examples/blob/master/arquillian-tutorial/pom.xml is has settings for embedded Glassfish V3.

                          • 10. Re: Problems with Arquillian Setup in an existing Ant-Project
                            ugiwolf

                            Hello Jakub!

                             

                            Sorry for my late reply and thanks for your answer! I will try it.

                             

                            Best regards,

                             

                            Jürgen

                            • 11. Re: Problems with Arquillian Setup in an existing Ant-Project
                              ugiwolf

                              Hello Jakub!

                               

                              I have tested your regards, but I had no success. Here is a screenshot of my ivy dependencies:

                               

                              LittleSnapper.png

                               

                              and a copy of my current ivy.xml:

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

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

                              <ivy-module

                               

                              version="2.0" xmlns:m="http://ant.apache.org/ivy/maven"

                              >

                               

                              <info organisation="com.meddoso"

                               

                              module=

                              "meddoso"

                               

                              revision="1.0.0-SNAPSHOT"

                              />

                               

                              <configurations>

                               

                              <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"

                              />

                                  

                              <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"

                              />

                                  

                              <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."

                              />

                                  

                              <conf name="compile-only" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths." extends="compile"

                              />

                                  

                              <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."

                              />

                                  

                              <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"

                              />

                                  

                              <conf name="test" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="runtime"/>

                               

                               

                              </configurations>

                               

                               

                              <dependencies>

                               

                              <dependency org="junit" name="junit" rev="4.8.2" conf="test->default(*)"

                              />

                               

                              <dependency org="org.glassfish.main.extras" name="glassfish-embedded-all" rev="3.1.2" conf="provided->default(*)"

                              />

                               

                              <dependency org="org.jboss.arquillian.container" name="arquillian-glassfish-embedded-3.1" rev="1.0.0.CR3" conf="test->default(*)"/>

                                

                               

                              <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container" rev="1.0.0.CR7" conf="test->default(*)"

                              />

                               

                              <dependency org="org.jboss.shrinkwrap" name="shrinkwrap-api" rev="1.0.0-cr-1"/>

                               

                              <dependency org="org.jboss.shrinkwrap.descriptors" name="shrinkwrap-descriptors-api" rev="0.1.7"

                              />

                               

                              <dependency org="org.jboss.shrinkwrap.descriptors" name="shrinkwrap-descriptors-spi" rev="2.0.0-alpha-3"/>

                               

                              </dependencies>

                               

                              </ivy-module>

                               

                               

                              The error message is always the same:

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                              java.lang.RuntimeException

                               

                               

                              : Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor see cause.

                              at org.jboss.arquillian.test.spi.SecurityActions.newInstance(

                               

                              SecurityActions.java:170

                              )

                              at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(

                               

                              TestRunnerAdaptorBuilder.java:52

                              )

                              at org.jboss.arquillian.junit.Arquillian.run(

                               

                              Arquillian.java:93

                              )

                              at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(

                               

                              JUnit4TestReference.java:50

                              )

                              at org.eclipse.jdt.internal.junit.runner.TestExecution.run(

                               

                              TestExecution.java:38

                              )

                              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(

                               

                              RemoteTestRunner.java:467

                              )

                              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.reflect.InvocationTargetException

                              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.jboss.arquillian.test.spi.SecurityActions.newInstance(

                               

                              SecurityActions.java:166

                              )

                              ... 8 more

                              Caused by: java.lang.NoSuchMethodError: org.jboss.shrinkwrap.descriptor.spi.DescriptorImporterBase.fromStream(Ljava/io/InputStream;Z)Lorg/jboss/shrinkwrap/descriptor/api/Descriptor;

                              at org.jboss.shrinkwrap.descriptor.spi.DescriptorImporterBase.fromStream(

                               

                              DescriptorImporterBase.java:155

                              )

                              at org.jboss.shrinkwrap.descriptor.spi.DescriptorImporterBase.from(

                               

                              DescriptorImporterBase.java:182

                              )

                              at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(

                               

                              ConfigurationRegistrar.java:54

                              )

                              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.core.impl.ObserverImpl.invoke(

                               

                              ObserverImpl.java:90

                              )

                              at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(

                               

                              EventContextImpl.java:99

                              )

                              at org.jboss.arquillian.core.impl.EventContextImpl.proceed(

                               

                              EventContextImpl.java:81

                              )

                              at org.jboss.arquillian.core.impl.ManagerImpl.fire(

                               

                              ManagerImpl.java:134

                              )

                              at org.jboss.arquillian.core.impl.ManagerImpl.fire(

                               

                              ManagerImpl.java:114

                              )

                              at org.jboss.arquillian.core.impl.ManagerImpl.start(

                               

                              ManagerImpl.java:260

                              )

                              at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(

                               

                              EventTestRunnerAdaptor.java:56

                              )

                              ... 13 more

                               

                               

                               

                              Best regards,

                               

                              Jürgen

                              • 12. Re: Problems with Arquillian Setup in an existing Ant-Project
                                mattil

                                shrinkwrap-descriptors-spi 2.0.0 with DescriptorImporterBase class and shrinkwrap-descriptors-api-base with DescriptorImporter interface are incompatible with shrinkwrap-descriptors-api 0.1.7 DescriptorImporter interface because the latter lacks the fromStream method.

                                • 13. Re: Problems with Arquillian Setup in an existing Ant-Project
                                  mattil

                                  A working solution seems to be to exclude shrinkwrap-descriptors-api in ivy.xml:



                                  <exclude org="org.jboss.shrinkwrap.descriptors" module="shrinkwrap-descriptors-api" />