4 Replies Latest reply on May 12, 2010 7:22 PM by meetoblivion

    Rest Server binding issue?

    meetoblivion

      I'm attempting to run mode shape rest server on glassfish.  This comes with the metro/jersey stack w/ JAX-RS support.  Since you're using jax-rs annotations I figure it should work.

       

      Then I got an error:

       

      An error has occurred
      Exception while loading the app : java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: com.sun.jersey.api.container.ContainerException: A root resource, class org.modeshape.web.jcr.rest.JcrResources, has a non-unique URI template /
      Looking at the various resources in this package, it seems like every resource is mapped to /.  I believe this is not valid.  Thoughts?
        • 1. Re: Rest Server binding issue?
          bcarothers

          I definitely see what you're getting at.  The trouble is that the canonical solution of mapping a Resource class to a URL pattern and providing a @Path annotation at the class level doesn't work with RESTEasy.  I'm not sure which (if any) implementation is wrong, but I'll put in a patch that moves all of the path-handling back into a single resource, but then delegates the processing out to some stateless POJOs.  I'm pretty confident that's not what the JAX-RS spec team intended, but it has the virtue of working in both implementations and not putting all of our business logic in the same class.

           

          I'll check that in as soon as I can get back into SVN.  Thanks for testing this on Jersey and catching this.

          • 2. Re: Rest Server binding issue?
            meetoblivion

            Brian, did you have a chance to take a look? JcrResources looks different now, but it's still not binding correctly.

             

            An error has occurred
            Exception while loading the app : java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: com.sun.jersey.api.container.ContainerException: A root resource, class org.modeshape.web.jcr.rest.JcrResources, has a non-unique URI template /
            Another note/request - is it possible to build against the plain jax-rs api instead of rest easy directly?
            • 3. Re: Rest Server binding issue?
              bcarothers

              Do you have a local source copy, and, if so, could you please try deleting line 150 (@Path("/") in web/

              modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/JcrResources.java? 
              I think this will work, but I hate to commit it on a hunch.  I'm also at least 8 hours away from being able to commit anything.
              Thanks!
              • 4. Re: Rest Server binding issue?
                meetoblivion

                no luck, error remains.  tried removing the class level as well, no luck.

                 

                the issue in part seems to be the resteasy dependencies themselves, which is why i had asked about compiling against JAX-RS instead of resteasy.