7 Replies Latest reply on Mar 15, 2012 2:05 PM by tdtappe

    Testing persistence example

    tdtappe

      I successfully managed to run the Getting Started example (http://arqpreview-alrubinger.rhcloud.com/guides/getting_started/).

      Now I try to do some persistence testing (http://arqpreview-alrubinger.rhcloud.com/guides/testing_java_persistence/index.html). But I can't get it to work.

      I get the following exception: java.lang.ClassNotFoundException: org.jboss.util.id.SerialVersion (using the glassfish container).

      Removing the javaee-6.0 dependency I don't get the exception any longer but run into a NPE.

       

      I used the attached pom.

       

      I also tried other versions of arquillian and other containers - without success.

       

      Any idea what's wrong here?

       

      --Heiko

        • 1. Re: Testing persistence example
          tdtappe

          BTW, running the test from within Eclipse I do get the exception:

           

          java.lang.IllegalArgumentException: ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.

          • 2. Re: Testing persistence example
            aslak

            got the NullPointerException stack trace?

            • 3. Re: Testing persistence example
              tdtappe

              Oh, stupid me... I should have given some info about the NPE. Here we go...

               

              The NPE occurs because of injected fields being null (UserTransaction utx, EntityManager em):

               

              java.lang.NullPointerException

                  at org.arquillian.example.GamePersistenceTest.clearDatabase(GamePersistenceTest.java:56)

                  at org.arquillian.example.GamePersistenceTest.preparePersistenceTest(GamePersistenceTest.java:50)

              ...

              • 4. Re: Testing persistence example
                aslak

                I just updated the Arquillian-Showcase to fix a bug in the source related to the same / similar example with GlassFish

                 

                If you try the jpa example there:

                 

                git clone git://github.com/arquillian/arquillian-showcase.git

                cd arquillian-showcase

                 

                mvn clean install -Parq-glassfish-embedded -f jpa/pom.xml

                 

                If you figure out what you got wrong in your setup by following the guide, compared to the showcase.. Please let me know so we can fix the guide..

                 

                 

                 

                https://github.com/arquillian/arquillian-showcase/commit/750910f12d00fdf1347eec63b0ea734cfe6b69d6

                • 5. Re: Testing persistence example
                  tdtappe

                  On first attempt I run into

                   

                  [ERROR] Failed to execute goal on project arquillian-showcase-jpa: Could not resolve dependencies for project org.jboss.arquillian.showcase:arquillian-showcase-jpa:jar:1.0.0-SNAPSHOT:

                  Failure to find org.jboss.arquillian.showcase:container-bom-glassfish-embedded-3.1:pom:1.0.0-SNAPSHOT in http://nightcrawler.transdata.net:55555/archiva/repository/snapshots/

                  was cached in the local repository, resolution will not be reattempted until the update interval of snapshots has elapsed or updates are forced -> [Help1]

                   

                  Which repository contains the missing dependency?

                  • 6. Re: Testing persistence example
                    aslak

                    Oh yea, sorry.. they are in the same project.. do:

                     

                    mvn clean install -f container-boms/pom.xml

                    • 7. Re: Testing persistence example
                      tdtappe

                      Ok, had to install parent first because of:

                       

                      [ERROR] Failed to execute goal on project arquillian-showcase-jpa: Could not resolve dependencies for project org.jboss.arquillian.showcase:arquillian-showcase-jpa:jar:1.0.0-SNAPSHOT:

                      Failed to collect dependencies for [org.hibernate:hibernate-jpamodelgen:

                      jar:1.1.1.Final (provided),

                      junit:junit:jar:4.8.1 (test),

                      org.jboss.arquillian.junit:arquillian-junit-container:jar:1.0.0.CR7 (compile),

                      org.jboss.arquillian.protocol:arquillian-protocol-servlet:jar:1.0.0.CR7 (compile),

                      org.jboss.arquillian.showcase:container-bom-glassfish-embedded-3.1:pom:1.0.0-SNAPSHOT (test)]:

                      Failed to read artifact descriptor for org.jboss.arquillian.showcase:

                      container-bom-glassfish-embedded-3.1:pom:1.0.0-SNAPSHOT:

                      Could not find artifact org.jboss.arquillian.showcase:arquillian-showcase-parent:pom:1.0.0-SNAPSHOT in snapshots (http://nightcrawler.transdata.net:55555/archiva/repository/snapshots/) -> [Help 1]

                       

                      After that I could install container-boms and finally successfully run the jpa tests!

                       

                      Now I will have a closer look at what's different between my jpa tests and yours.

                      Thanks a lot so far, Aslak - I will report back...

                       

                      --Heiko