6 Replies Latest reply: Apr 25, 2012 10:56 AM by Randall Hauch RSS

Several issues with Modeshape 3.x + Jboss AS 7

Michael Westerngate Newbie

Hi!

 

I've checked out the ModeShape 3.x branch (today) and it has built just fine.

Then I've extracted the contents of modeshape-3.0-SNAPSHOT-jbossas-7-dist.zip and manually moved each file/folder to the appropriate folder in my jboss as 7.0.13.Final installation.

First I've discovered is that modeshape defines a security domain for the rest service called modeshape-rest or something which doesn't exist in jboss so he fails to deploy. I've changed it to the "other" security domain and now it deploys.

 

Next, when trying to access localhost/modeshape-rest and after http credentials I've got exceptions that slf4j LoggerFactory couldn't be found. So I've added an dependencies into the rest war's Manifest manually which now looks like this: Dependencies: javax.jcr, org.modeshape.jcr.api services, org.modeshape services, org.slf4j --> shouldn't the org.slf4j dependency be added during the maven build?

 

Now accessing the rest service url again brings up another error I cannot figure why it happens maybe you can help in getting modeshape 3.x running fine on AS 7 (did I probably forget something??). Here's the stack trace of the current error:

 

10:23:12,285 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/modeshape-rest].[Resteasy]] (http--127.0.0.1-8080-4) Servlet.service() for servlet Resteasy threw exception: org.jboss.resteasy.spi.UnhandledException: java.util.ServiceConfigurationError: javax.jcr.RepositoryFactory: Provider org.modeshape.jcr.JcrRepositoryFactory could not be instantiated: java.lang.NoClassDefFoundError: Could not initialize class org.modeshape.jcr.JcrRepositoryFactory

          at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar:]

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) [jbossweb-7.0.13.Final.jar:]

          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

          at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_29]

Caused by: java.util.ServiceConfigurationError: javax.jcr.RepositoryFactory: Provider org.modeshape.jcr.JcrRepositoryFactory could not be instantiated: java.lang.NoClassDefFoundError: Could not initialize class org.modeshape.jcr.JcrRepositoryFactory

          at java.util.ServiceLoader.fail(ServiceLoader.java:207) [classes.jar:1.6.0_29]

          at java.util.ServiceLoader.access$100(ServiceLoader.java:164) [classes.jar:1.6.0_29]

          at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353) [classes.jar:1.6.0_29]

          at java.util.ServiceLoader$1.next(ServiceLoader.java:421) [classes.jar:1.6.0_29]

          at org.modeshape.web.jcr.RepositoryManager.getJcrRepositoryNames(RepositoryManager.java:148) [modeshape-web-jcr-3.0-SNAPSHOT.jar:3.0-SNAPSHOT]

          at org.modeshape.web.jcr.rest.ServerHandler.getRepositories(ServerHandler.java:42) [modeshape-web-jcr-rest-3.0-SNAPSHOT.jar:3.0-SNAPSHOT]

          at org.modeshape.web.jcr.rest.JcrResources.getRepositories(JcrResources.java:169) [modeshape-web-jcr-rest-3.0-SNAPSHOT.jar:3.0-SNAPSHOT]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_29]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_29]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_29]

          at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_29]

          at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.2.Final.jar:]

          at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.2.Final.jar:]

          ... 20 more

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.modeshape.jcr.JcrRepositoryFactory

          at java.lang.Class.forName0(Native Method) [classes.jar:1.6.0_29]

          at java.lang.Class.forName(Class.java:247) [classes.jar:1.6.0_29]

          at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345) [classes.jar:1.6.0_29]

          ... 33 more

 

 

 

thank you so much!

Alex

  • 1. Re: Several issues with Modeshape 3.x + Jboss AS 7
    Randall Hauch Master

    I'm actively working on getting ModeShape running on AS 7.1.1.Final (see MODE-1435, MODE-1437, and MODE-1440). I'm working on a local development branch, and actually ran into and already way past the issues you mention above (which ultimately are caused by the repository trying to create its own Infinispan CacheContainer rather than use one of those available via the Infinispan subsystem in AS7). I've made pretty good progress, and am hopefully (knock on wood) not far from getting it working. When I do, I'll merge the changes and we'll release 3.0.0.Alpha4.

     

    Best regards,

     

    Randall

  • 2. Re: Several issues with Modeshape 3.x + Jboss AS 7
    Michael Westerngate Newbie

    Aaaahh.. okay perfect to know that I am not too dumb for it :-)

    Looking forward to enjoiy modeshape on AS 7 hopefully right soon...

     

    Alex

  • 3. Re: Several issues with Modeshape 3.x + Jboss AS 7
    Michael Westerngate Newbie

    hi,

     

    Sorry to bother again but is there any update yet on this topic?

    Just curious  as MODE-1435 was set to resolved and then reopened. However when trying the latest version, deploying works fine though I get the same message like in the ticket trying to access the rest service:

     

    11:07:36,774 SCHWERWIEGEND [org.modeshape.jcr.JcrRepositoryFactory] (http--127.0.0.1-8080-1) The 'sample' repository in the ModeShape engine in JNDI at 'jcr/local' is not running or has been shutdown

    11:07:36,845 ERROR [stderr] (http--127.0.0.1-8080-1) javax.jcr.RepositoryException: Error while starting 'sample' repository: Unable to load component metadata!

    11:07:36,846 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:566)

    11:07:36,847 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:138)

    11:07:36,848 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.web.jcr.RepositoryManager.getSession(RepositoryManager.java:140)

    11:07:36,848 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.web.jcr.rest.AbstractHandler.getSession(AbstractHandler.java:39)

    11:07:36,849 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.web.jcr.rest.ServerHandler.getRepositories(ServerHandler.java:57)

    11:07:36,850 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.web.jcr.rest.JcrResources.getRepositories(JcrResources.java:169)

    11:07:36,851 ERROR [stderr] (http--127.0.0.1-8080-1)           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

     

    Anything I can do about that besides waiting? :-)

     

    thanks!!

  • 4. Re: Several issues with Modeshape 3.x + Jboss AS 7
    Randall Hauch Master

    Sorry to bother again but is there any update yet on this topic?

    Just curious  as MODE-1435 was set to resolved and then reopened. However when trying the latest version, deploying works fine though I get the same message like in the ticket trying to access the rest service:

    I've been working on this for the last week (or more), changing the AS7 subsystem quite significantly to add more support for other configurations. The REST service is problematic, since it relies upon the ModeShape engine (rather than the repository instances deployed by AS7) to find the right repository. And AS7's delayed deployment model is causing the repositories to not be deployed when they're needed, so we're still working out the kinks there. (Note: most apps will look up the repository instance in JNDI or use the JCR RepositoryFactory style access, so the REST service is a bit odd in that respect.)

     

    What's interesting is that I'm not even able to get the REST service to get as far as it seems you have: I get this error:

     

    No repository named 'sample' could be found in the ModeShape engine in JNDI at 'jcr/local'
    

     

    I need to write a simple web application (see MODE-1471) that looks in JNDI for a specific repository (e.g., at "jcr/local/sample") or uses the standard JCR RepositoryFactory approach to find the repository given a ModeShape URL, and then logs in, generates an HTML response based upon the node at a path obtained from the request's URL, and logs out of the session. This will allow testing the different ways of accessing a repository. I was going to kill two birds by writing this as an example in our example Git repo (at https://github.com/ModeShape/modeshape-examples).

     

    Anything I can do about that besides waiting? :-)

     

    Absolutely! I'm actually on vacation today, but it'd be really helpful if you wrote (or at least started writing) this web app! At this point, the primary thing is to find the Repository, establish a Session and a generate a simple HTML response or generate an error page if that couldn't be done. The path-based logic can be added later.

     

    If you're interested, you can either create it locally and attach the code as an attachment to MODE-1471, or you can fork our example Git repo (at https://github.com/ModeShape/modeshape-examples) and add it to the example codebase, and then create a pull-request. (See ModeShape Development Workflow for details on this process, but be sure to fork the right Git repo and use the right URL in Steps 2 and 3 of the Setup section.) Generally we prefer the pull-request route, but feel free to attach your code to the issue if you're not too familiar with Git or GitHub.

  • 5. Re: Several issues with Modeshape 3.x + Jboss AS 7
    Michael Westerngate Newbie

    Hi,

     

    I can do that. However, isn't the REST Service supposed to do exactly *that*?

    Furthermore -> will the webdav service suffer from the same issues?

     

    For the sample app -> should resteasy be used?

     

    I'd prefer attaching it to the ticket 'cuz I've got no clue on git (always used svn so far )

  • 6. Re: Several issues with Modeshape 3.x + Jboss AS 7
    Randall Hauch Master

    However, isn't the REST Service supposed to do exactly *that*?

    Furthermore -> will the webdav service suffer from the same issues?

    The REST and WebDAV services are a bit abnormal in the sense that they each are able to access multiple repositories. To do that, they directly access the ModeShape engine (which is running as a service) to discover and obtain the available repositories. Because AS7 loads services lazily, the engine doesn't see the repositories until each repository is accessed directly (via JNDI or RepositoryFactory).

     

    For the sample app -> should resteasy be used?

     

    It could, but I guess I was thinking of a very simple servlet, perhaps even with a relatively hard-coded but extremely simple HTML output.

    I'd prefer attaching it to the ticket 'cuz I've got no clue on git (always used svn so far )

    No problem. Any assistance would be appreciated!