3 Replies Latest reply on Sep 17, 2013 9:54 AM by hchiorean Branched to a new discussion.

    Modeshape java application setup

    agupta_eval

      Hi,

      I am evaluation Modeshape and Jackrabbit for my company. I found that Modeshape doesn't provides any standalone server setup unlike Jackrabbit. Hence I am trying to set up the java application configuration. I downloaded the Modeshape 3.5.0 Final and used one of the examples to test it. The configuration file I am using is an empty file { } for default behavior. The code looks like this:

        ModeShapeEngine engine = new ModeShapeEngine();

        engine.start();

          Repository repository = null;

           String repositoryName = null;

           try {

              RepositoryConfiguration repo_config = RepositoryConfiguration.read("/home/apcuser/apps/modeshape-3.5.0.Final/Simplest.json");       

       

       

             org.modeshape.common.collection.Problems problems = repo_config.validate();

              if (problems.hasErrors()) {

                  System.err.println("Problems starting the engine.");

                  System.err.println(problems);

                  System.exit(-1);

              }

       

       

                      

             repository = engine.deploy(repo_config);

             repositoryName = repo_config.getName();

          } catch (Throwable e) {

             e.printStackTrace();

              System.exit(-1);

              return;

         }

       

       

         Session session = null;

          try {

              repository = engine.getRepository(repositoryName);

       

       

              session = repository.login("default");

       

       

              Node root = session.getRootNode();

               assert root != null;

       

       

               System.out.println("Found the root node in the \"" + session.getWorkspace().getName() + "\" workspace");

          } catch (RepositoryException e) {

               e.printStackTrace();

          } finally {

               if (session != null) session.logout();

               System.out.println("Shutting down engine ...");

               try {

                   engine.shutdown().get();

                   System.out.println("Success!");

              } catch (Exception e) {

                   e.printStackTrace();

             }

      }

      when I try to run this test the exception that I get is:

      java.lang.NoClassDefFoundError: org/infinispan/lifecycle/Lifecycle

        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 org.modeshape.jcr.RepositoryConfiguration.<clinit>(RepositoryConfiguration.java:761)

        at test.actiance.platform.sfab.cis.cmr.service.internal.spi2dav.ModeShapeTest.testModeShape(ModeShapeTest.java:49)

        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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)

        at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)

        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)

        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)

        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)

        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)

        at org.testng.TestRunner.privateRun(TestRunner.java:767)

        at org.testng.TestRunner.run(TestRunner.java:617)

        at org.testng.SuiteRunner.runTest(SuiteRunner.java:335)

        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:330)

        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)

        at org.testng.SuiteRunner.run(SuiteRunner.java:240)

        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)

        at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)

        at org.testng.TestNG.run(TestNG.java:1057)

        at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)

        at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)

        at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

      Caused by: java.lang.ClassNotFoundException: org.infinispan.lifecycle.Lifecycle

        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)

      Can anyone please point to me to something that I am doing wrong? Thanks and appreciate any help.

        • 1. Re: Modeshape java application setup
          hchiorean

          That exception indicates that your classpath doesn't contain all of ModeShape's required dependencies (in this case, Infinispan). You have a couple of options:

          1 of 1 people found this helpful
          • 2. Re: Modeshape java application setup
            agupta_eval

            Thanks Horian, I will try that. In the mean time I came across the RESTful access to the Modeshape that looks like the preferred approach we would want to use in our case. It looked pretty straight forward from the document to get it up and running. I downloaded AS7.1.1.Final and modeshape-3.5.0.Final-jbosseap-61-dist. I extracted the zip in the AS folder to override/merge files. I tried starting the server using: bin/standalone.sh -c=standalone-modeshape.xml but am getting this exception:

            899: JBoss AS 7.1.1.Final "Brontes" starting

            05:34:24,480 ERROR [org.jboss.as.server] JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration

              at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.as.server.ServerService.boot(ServerService.java:266) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:155) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

              at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_39]

            Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[3,1]

            Message: Unexpected element '{urn:jboss:domain:1.4}server'

              at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:108) [staxmapper-1.1.0.Final.jar:1.1.0.Final]

              at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]

              at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:133) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

              ... 3 more

             

             

            05:34:24,484 FATAL [org.jboss.as.server] JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.

            05:34:24,493 INFO  [org.jboss.as] JBAS015950: JBoss AS 7.1.1.Final "Brontes" stopped in 2ms

             

            I found a related question in the forum: https://community.jboss.org/thread/230358?start=0&tstart=0

            but I am not using back the AS7.2.0xx into 7.1.1.xx in this case as suggested to be the problem here. However the standalone-modeshape.xml for the version of Modeshape I unzipped under /standalone/configuration has the version 1.4 specified if that is a problem. Snippet of xml here:

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

             

             

            <server xmlns="urn:jboss:domain:1.4">

                <extensions>

                    <extension module="org.jboss.as.clustering.infinispan"/>

                    <extension module="org.jboss.as.configadmin"/>

            Can you please tell what I am missing here?

            • 3. Re: Modeshape java application setup
              hchiorean

              As you correctly point out, our latest kit is aligned with the XML namespaces from EAP 6.x.

               

              AS 7.1.1 has a lot of issues related to Infinispan and JGroups which is why we recommend using EAP.  AS 7.1.1 namespace's version is 1.2, so you can give it a try with <server xmlns="urn:jboss:domain:1.2">, by manually changing the XML.

              1 of 1 people found this helpful