8 Replies Latest reply on May 25, 2011 9:49 AM by rhauch

    WebDAV url syntax?

    sjahan

      Hi,

       

      This could be kind of a dumb question, but since i don't find any answer on my own...

      I get the WebDAV server WAR from the Modeshape 2.4.0 Final for JBoss AS. It deploys completely fine but i don't get it what does it expect about the URL. Whatever i type, i get a blank page as return and an exception in the server:

       

      14:38:06,125 ERROR [WebDavServletBean] Exception: java.lang.IllegalStateException: A valid JCR URL must be provided to use this method.  "null" is not a valid JCR URL.  Please consult the ModeShape Reference Guide for information on providing a valid JCR URL.

          at org.modeshape.jcr.JcrRepositoryFactory.urlFor(JcrRepositoryFactory.java:421)

          at org.modeshape.jcr.JcrRepositoryFactory.getRepositories(JcrRepositoryFactory.java:479)

          at org.modeshape.web.jcr.spi.FactoryRepositoryProvider.getJcrRepositoryNames(FactoryRepositoryProvider.java:64)

          at org.modeshape.web.jcr.RepositoryFactory.getJcrRepositoryNames(RepositoryFactory.java:94)

          at org.modeshape.web.jcr.webdav.ModeShapeWebdavStore$JcrSessionTransaction.repositoryAndWorkspaceExist(ModeShapeWebdavStore.java:695)

          at org.modeshape.web.jcr.webdav.ModeShapeWebdavStore.repositoryAndWorkspaceExist(ModeShapeWebdavStore.java:617)

          at org.modeshape.web.jcr.webdav.ModeShapeWebdavStore.getStoredObject(ModeShapeWebdavStore.java:382)

          at net.sf.webdav.methods.DoHead.execute(DoHead.java:68)

          at net.sf.webdav.WebDavServletBean.service(WebDavServletBean.java:128)

          at org.modeshape.web.jcr.webdav.ModeShapeWebdavServlet.service(ModeShapeWebdavServlet.java:110)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)

          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

          at java.lang.Thread.run(Unknown Source)

       

      I consulted the Modeshape reference guide as suggested, but as i didn't find anything in particular about URL in the WebDAV part, i tried some possible syntax but without any effect other that generating this exception. It always tells: "null" is not a valid JCR URL, whatever i type, so i guess it doesn't even read what i type and i should miss some special char or something like this...

       

      Thank you by advance for your help,

       

      SJ.

        • 1. Re: WebDAV url syntax?
          rhauch

          That stack trace looks like the webdav WAR is configured with an incorrect ModeShape URL, and we're not reporting that error very well.

           

          Unfortunately, the chapter that talks about how to configure the WebDAV application (Section 9.3.1) has an error and shows an invalid URL format in the third code fragment. That configuration parameter should be a valid URL, and thus something like the following:

           

            <context-param>
              <param-name>org.modeshape.web.jcr.CONFIG_FILE</param-name>
              <param-value>file:/path/to/configRepository.xml</param-value>
            </context-param>
          

           

          Note the "file:" URL scheme. Other URL formats are allowed as well, and these are shown in an earlier section (7.2.1) of our Reference Guide.

           

          Best regards.

          • 2. Re: WebDAV url syntax?
            sjahan

            Ok, i should be totally dumb but i tried a lot of possibilities without any success


            Even absolute path fails, my dev environment is running on Windows, so that always gets me confused because i'm quite used to Linux paths...

            Let's say my web.xml contains     <param-value>file:/configRepository.xml</param-value>

            Where am i supposed to put the configRepository.xml file?

            At the root of the WAR? At the root of my JBoss context? Maybe i'm just tired...

             

            Gotta retry it tomorrow morning, anyway, thank you for your answer and your help, once more Randall

            • 3. Re: WebDAV url syntax?
              rhauch

              For a configuration URL of "file:/configRepository.xml", your "configRepository.xml" file should be at the root of your file system. It's not a relative path, it's the full path, as if you typed it into a browser. ModeShape is, in fact, just resolving the URL (except for JNDI URLs, in which case we're just looking that up in JNDI).

               

              That's one of the disadvantages of using the file URL format. Using a "classpath" URL format is better, but isn't supported on all platforms. We probably should provide an easier way of specifying a file on the classpath.

              • 4. Re: WebDAV url syntax?
                bcarothers

                If a URL with a "file" protocol is used (e.g., file:/configRepository.xml), ModeShape will first try to resolve that resource in the filesystem and then try to resolve the configuration as a resource on the classpath.  There's no second protocol for classpath.

                • 5. Re: WebDAV url syntax?
                  sjahan

                  Well, this is kind of embarassing but it still doesn't work

                  Maybe this is because of Windows. To keep as simple as possible, i put my configuration file under the root of my data HDD. This works with my web browser "file:///D:/modeshape-repositories.xml", but doesn't work when typed in the web.xml of the webdav WAR.

                  The strange thing is that I didn't find a trace of org.modeshape.web.jcr.CONFIG_FILE in the sources, perhaps it's just about my eclipse configuration that doesn't search properly into external sources.

                  Is it normal? How can i solve this? I assume i must misunderstand something but don't know what...

                   

                  Thank you for your support,

                   

                  SJ.

                  • 6. Re: WebDAV url syntax?
                    bcarothers

                    There was a second documentation bug.  The first documentation bug, as noted before, was that it gave a configuration path instead of a configuration URL.  You've already compensated for that.

                     

                    The second documentation bug was that we did not update either the factory provider class name or the name of the parameter that it expects.  We've corrected this for the next release, but here's the way that the web.xml should read for those two parameters:

                     

                      <!--

                        This parameter provides the fully-qualified name of a class that implements

                        the o.m.web.jcr.spi.RepositoryProvider interface.  It is required

                        by the ModeShapeJcrDeployer that controls the lifecycle for the ModeShape WebDAV server.

                      -->

                      <context-param>

                        <param-name>org.modeshape.web.jcr.REPOSITORY_PROVIDER</param-name>

                        <param-value>org.modeshape.web.jcr.spi.FactoryRepositoryProvider</param-value>

                      </context-param>

                     

                      <!--

                        This parameter, specific to the FactoryRepositoryProvider implementation, specifies

                        the name of the configuration file to initialize the repository or repositories.

                        This configuration file must be on the classpath and is given as a classpath-relative

                        directory.

                      -->

                      <context-param>

                        <param-name>org.modeshape.web.jcr.JCR_URL</param-name>

                        <param-value>file:/configRepository.xml</param-value>

                      </context-param>

                     

                    Sorry for not catching this earlier. 

                    • 7. Re: WebDAV url syntax?
                      sjahan

                      This is ok, i switched the org.modeshape.web.jcr.CONFIG_FILE to org.modeshape.web.jcr.JCR_URL and it works fine, thak you very much!

                      • 8. Re: WebDAV url syntax?
                        rhauch

                        Awesome. Glad it's working.