3 Replies Latest reply on Dec 2, 2014 8:07 AM by hchiorean

    java.lang.NoClassDefFoundError: org/modeshape/common/junit/SkipTestRule

    nimit.agrawal

      Hi

       

      I am trying to upgrade my system from modeshape 3.7.0.Final to 4.0.0.Final

      And i am getting java.lang.NoClassDefFoundError: org/modeshape/common/junit/SkipTestRule.

       

      In my Junit testcases I was using org.modeshape.test.ModeShapeSingleUseTest. This class is internally refering to org/modeshape/common/junit/SkipTestRule.

      modeshape3.7.0-Final referred modeshape-common-3.7.0.FINAL which contained this class.

      Similarly modeshape 4.0.0.FINAl is referring to modeshape-common-4.0.0.FINAL . However Modeshape-common-4.0.0.FINAL is not having SkipTestRule class.

       

      similarly :

      <groupId>ch.qos.logback</groupId>

        <artifactId>logback-classic</artifactId>

       

      is also removed from :

      <groupId>org.modeshape.bom</groupId>

      <artifactId>modeshape-bom-embedded</artifactId>

       

       

      Please suggest how to deal with this. Thanks in advance.

        • 1. Re: java.lang.NoClassDefFoundError: org/modeshape/common/junit/SkipTestRule
          hchiorean

          This class is part of the modeshape-common test-jar artifact: https://repository.jboss.org/nexus/service/local/repositories/central/content/org/modeshape/modeshape-common/4.0.0.Final…

          This should be transitively resolved starting from the modeshape-unit-test artifact, but it's not thanks to this: https://jira.codehaus.org/browse/MNG-1378

          We will fix this for 4.1, but in the meantime you'll have to manually set up this dependency in your project:

          <dependency>

            <groupId>org.modeshape</groupId>

            <artifactId>modeshape-common</artifactId>

            <version>4.0.0.Final</version>

            <classifier>tests</classifier>

          </dependency>

           

           

          • 2. Re: java.lang.NoClassDefFoundError: org/modeshape/common/junit/SkipTestRule
            nimit.agrawal

            Thanks Horia.

            This solved the problem for SkipTestRule. However now I am getting.

            java.lang.NoClassDefFoundError: Could not initialize class org.modeshape.jcr.RepositoryConfiguration

              at org.modeshape.jcr.SingleUseAbstractTest.createRepositoryConfiguration(SingleUseAbstractTest.java:139)

              at org.modeshape.jcr.SingleUseAbstractTest.startRepository(SingleUseAbstractTest.java:71)

              at org.modeshape.jcr.SingleUseAbstractTest.beforeEach(SingleUseAbstractTest.java:96)

              at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:606)

              at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)

              at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

              at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)

              at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)

              at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

              at org.junit.rules.RunRules.evaluate(RunRules.java:20)

              at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)

              at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

              at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

              at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

              at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

              at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

              at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

              at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

              at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)

              at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)

              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)

              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)

              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)

              at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)

              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)

              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

             

            RepositoryConfiguration is there as well as the required constructor.

             

            My Pom has following dependencies:

            parent :

            <dependencyManagement>

                    <dependencies>

                        <dependency>

                            <groupId>org.modeshape</groupId>

                            <artifactId>modeshape-web-explorer-war</artifactId>

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

                            <type>war</type>

                        </dependency>

                        <dependency>

                            <groupId>org.modeshape.bom</groupId>

                            <artifactId>modeshape-bom-embedded</artifactId>

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

                            <type>pom</type>

                            <scope>import</scope>

                        </dependency>

                    </dependencies>

                </dependencyManagement>

            Then the child module where i am getting errors in unit test cases:

             

            <dependencies>

                    <!-- <dependency>

                        <groupId>ch.qos.logback</groupId>

                        <artifactId>logback-classic</artifactId>

                        <scope>test</scope>

                        <version>0.9.29</version>

                    </dependency> -->

                    <!-- Can be removed after 4.1 -->

                  <dependency>

                       <groupId>org.modeshape</groupId>

                     <artifactId>modeshape-common</artifactId>

                     <classifier>tests</classifier>

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

                   </dependency>

                   <dependency>

                        <groupId>org.modeshape</groupId>

                        <artifactId>modeshape-jcr-api</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>org.modeshape</groupId>

                        <artifactId>modeshape-jcr</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>org.modeshape</groupId>

                        <artifactId>modeshape-common</artifactId>

                    </dependency>

                    <!--This examples uses Infinispan's JDBC cache store, which requires C3P0 and a JDBC database driver -->

                    <dependency>

                        <groupId>org.infinispan</groupId>

                        <artifactId>infinispan-cachestore-jdbc</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>org.modeshape</groupId>

                        <artifactId>modeshape-unit-test</artifactId>

                        <scope>test</scope>

                        <type>jar</type>

                    </dependency>

                </dependencies>

            • 3. Re: java.lang.NoClassDefFoundError: org/modeshape/common/junit/SkipTestRule
              hchiorean

              any more information in the stack trace ? From what you pasted above I have no idea what the problem might be.

              Also, in similar fashion to modeshape-common:tests, make sure you add infinispan-core:tests to your CP:

               

              <dependency>
                <groupId>org.infinispan</groupId>
                <artifactId>infinispan-core</artifactId>

                <version>6.0.2.Final</version>
                <scope>test</scope>
                <type>test-jar</type>
              </dependency>