4 Replies Latest reply on Dec 7, 2011 7:49 AM by Emil Dombagolla

    WebDAV configuration error

    Emil Dombagolla Newbie

      Hi All,

       

      I am configuring WebDav for the first time.I build the WAR file and deployed in to tomcat7.

       

      When i hit the url on browser i get the following error message.Please someone help me to solve this.

       

      Thanks

      Emil

       

       

      Error message


      1388 [http-apr-8080-exec-3] TRACE org.modeshape.repository.sequencer.SequencingService$Administrator  - Starting "Sequencing Service"
      1393 [http-apr-8080-exec-3] TRACE org.modeshape.repository.sequencer.SequencingService$Administrator  - Started "Sequencing Service"
      1395 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,106
      1401 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,878
      1407 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,091
      1413 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,306
      1415 [http-apr-8080-exec-3] TRACE org.modeshape.web.jcr.webdav.ModeShapeWebdavStore  - WebDAV getStoredObject at "//gs-repository"
      1416 [http-apr-8080-exec-3] DEBUG org.modeshape.web.jcr.webdav.ModeShapeWebdavStore  - WebDAV getStoredObject at "//gs-repository" resolved to "//gs-repository/
      "
      1429 [http-apr-8080-exec-3] ERROR net.sf.webdav.WebDavServletBean  - Exception: java.lang.IllegalArgumentException: The repositoryName argument may not be null
      or zero-length
              at org.modeshape.common.util.CheckArg.isNotZeroLength(CheckArg.java:356)
              at org.modeshape.common.util.CheckArg.isNotEmpty(CheckArg.java:369)
              at org.modeshape.jcr.JcrEngine.getRepository(JcrEngine.java:355)
              at org.modeshape.jcr.JcrEngine.getRepository(JcrEngine.java:91)
              at org.modeshape.web.jcr.spi.FactoryRepositoryProvider.getRepository(FactoryRepositoryProvider.java:71)
              at org.modeshape.web.jcr.spi.FactoryRepositoryProvider.getSession(FactoryRepositoryProvider.java:111)
              at org.modeshape.web.jcr.RepositoryFactory.getSession(RepositoryFactory.java:90)
              at org.modeshape.web.jcr.webdav.ModeShapeWebdavStore$JcrSessionTransaction.session(ModeShapeWebdavStore.java:563)
              at org.modeshape.web.jcr.webdav.ModeShapeWebdavStore$JcrSessionTransaction.nodeFor(ModeShapeWebdavStore.java:570)
              at org.modeshape.web.jcr.webdav.ModeShapeWebdavStore.nodeFor(ModeShapeWebdavStore.java:500)
              at org.modeshape.web.jcr.webdav.ModeShapeWebdavStore.getStoredObject(ModeShapeWebdavStore.java:321)
              at net.sf.webdav.methods.DoGet.folderBody(DoGet.java:141)
              at net.sf.webdav.methods.DoHead.execute(DoHead.java:153)
              at net.sf.webdav.WebDavServletBean.service(WebDavServletBean.java:129)
              at org.modeshape.web.jcr.webdav.ModeShapeWebdavServlet.service(ModeShapeWebdavServlet.java:125)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
              at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
              at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
              at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
              at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1824)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:662)
      
      
      

       

      WEB.XML

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
                xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
                version="3.0">
      
      
                <display-name>ModeShape JCR RESTful Interface</display-name>
      
      
                <!-- 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:/modeshape-config.xml</param-value>
      
      
                </context-param>
      
      
                <!-- This parameter provides the fully-qualified name of a class that implements 
                          the o.m.w.jcr.webdav.ContentMapper interface. If no value is provided for 
                          this parameter, o.m.w.jcr.webdav.DefaultContentMapper will be used. -->
      
      
                <context-param>
      
      
                          <param-name>org.modeshape.web.jcr.webdav.CONTENT_MAPPER_CLASS_NAME</param-name>
      
      
                          <param-value>org.modeshape.web.jcr.webdav.DefaultContentMapper</param-value>
      
      
                </context-param>
      
      
      
      
                <!-- Nodes with any of the primary node types in this comma-delimited list 
                          will be treated by the WebDAV implementation as content nodes. The value 
                          below is the default value for this parameter. That is, if this init parameter 
                          is omitted, the value below will be used by default. -->
      
      
                <context-param>
      
      
                          <param-name>org.modeshape.web.jcr.webdav.CONTENT_PRIMARY_TYPE_NAMES</param-name>
      
      
                          <param-value>nt:resource, mode:resource</param-value>
      
      
                </context-param>
      
      
      
      
      
      
                <!-- Nodes with any of the primary node types in this comma-delimited list 
                          will be treated by the WebDAV implementation as resource (file) nodes. The 
                          value below is the default value for this parameter. That is, if this init 
                          parameter is omitted, the value below will be used by default. -->
      
      
                <context-param>
      
      
                          <param-name>org.modeshape.web.jcr.webdav.RESOURCE_PRIMARY_TYPE_NAMES</param-name>
      
      
                          <param-value>nt:file</param-value>
      
      
                </context-param>
      
      
      
      
      
      
                <!-- Each folder created through the WebDAV servlet will be created as a 
                          node with the primary node type below. The value below is the default value 
                          for this parameter. That is, if this init parameter is omitted, the value 
                          below will be used by default. -->
      
      
                <context-param>
      
      
                          <param-name>org.modeshape.web.jcr.webdav.NEW_FOLDER_PRIMARY_TYPE_NAME</param-name>
      
      
                          <param-value>nt:folder</param-value>
      
      
                </context-param>
      
      
      
      
      
      
                <!-- Each resource (file created through the WebDAV servlet will be created 
                          as a node with the primary node type below. The value below is the default 
                          value for this parameter. That is, if this init parameter is omitted, the 
                          value below will be used by default. -->
      
      
                <context-param>
      
      
                          <param-name>
      
      
                                    org.modeshape.web.jcr.webdav.NEW_RESOURCE_PRIMARY_TYPE_NAME
      
      
                          </param-name>
      
      
                          <param-value>nt:file</param-value>
      
      
                </context-param>
      
      
      
      
      
      
                <!-- Content created through the WebDAV servlet will be created as a node 
                          with the primary node type below. The value below is the default value for 
                          this parameter. That is, if this init parameter is omitted, the value below 
                          will be used by default. -->
      
      
                <context-param>
      
      
                          <param-name>
      
      
                                    org.modeshape.web.jcr.webdav.NEW_CONTENT_PRIMARY_TYPE_NAME
      
      
                          </param-name>
      
      
                          <param-value>nt:resource</param-value>
      
      
                </context-param>
      
      
                <!-- This optional parameter provides the name of the o.m.w.j.webdav.RequestResolver 
                          implementation class. The provided value must be the name of a class that 
                          implements the RequestResolver interface and has a public, no-arg constructor. 
                          If no value is provided, o.m.w.j.webdav.MultiRepositoryRequestResolver will 
                          be used. -->
      
      
                <context-param>
      
      
                          <param-name>org.modeshape.web.jcr.webdav.REQUEST_RESOLVER_CLASS_NAME</param-name>
      
      
                          <param-value>org.modeshape.web.jcr.webdav.MultiRepositoryRequestResolver</param-value>
      
      
                </context-param>
      
      
                <!-- Required parameter for ModeShape WebDAV - should not be modified -->
      
      
                <listener>
      
      
                          <listener-class>org.modeshape.web.jcr.ModeShapeJcrDeployer</listener-class>
      
      
                </listener>
      
      
      
      
      
      
                <!-- Required WebDAV servlet - should not be modified -->
      
      
                <servlet>
      
      
                          <servlet-name>WebDAV</servlet-name>
      
      
                          <servlet-class>org.modeshape.web.jcr.webdav.ModeShapeWebdavServlet</servlet-class>
      
      
      
      
      
      
                          <!-- The webdav library requires this parameter to be present, but does 
                                    not use it. -->
      
      
                          <init-param>
      
      
                                    <param-name>rootpath</param-name>
      
      
                                    <param-value>.</param-value>
      
      
                          </init-param>
      
      
                </servlet>
      
      
      
      
      
      
                <!-- Required parameter for ModeShape WebDAV - should not be modified -->
      
      
                <servlet-mapping>
      
      
                          <servlet-name>WebDAV</servlet-name>
      
      
                          <url-pattern>/*</url-pattern>
      
      
                </servlet-mapping>
      
      
                <!-- The ModeShape WebDAV implementation leverages the HTTP credentials 
                          to for authentication and authorization within the JCR repository. Unless 
                          the repository provides for anonymous access, it makes no sense to try to 
                          log into the JCR repository without credentials, so this constraint helps 
                          lock down the repository. This should generally not be modified. -->
      
      
                <security-constraint>
      
      
                          <display-name>ModeShape WebDAV</display-name>
      
      
                          <web-resource-collection>
      
      
                                    <web-resource-name>WebDAV</web-resource-name>
      
      
                                    <url-pattern>/*</url-pattern>
      
      
                          </web-resource-collection>
      
      
                          <auth-constraint>
      
      
                                    <!-- A user must be assigned this role to connect to any JCR repository, 
                                              in addition to needing the READONLY or READWRITE roles to actually read or 
                                              modify the data. This is not used internally, so another role could be substituted 
                                              here. -->
      
      
                                    <role-name>connect</role-name>
      
      
                          </auth-constraint>
      
      
                </security-constraint>
      
      
      
      
      
      
                <!-- Any auth-method will work for ModeShape. BASIC is used this example 
                          for simplicity. -->
      
      
                <login-config>
      
      
                          <auth-method>BASIC</auth-method>
      
      
                </login-config>
      
      
      
      
      
      
                <!-- This must match the role-name in the auth-constraint above. -->
      
      
                <security-role>
      
      
                          <role-name>connect</role-name>
      
      
                </security-role>
      
      
      </web-app>
      
      

       

       

      Repository Configuration File

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      
      <configuration xmlns:mode="http://www.modeshape.org/1.0"
                xmlns:jcr="http://www.jcp.org/jcr/1.0">
      
      
                <mode:repositories>
      
      
                          <mode:repository jcr:name="gs-repository" mode:source="MyDB">
      
      
                                    <mode:options jcr:primaryType="mode:options">
      
      
                                              <mode:option jcr:name="jaasLoginConfigName" mode:value="modeshape-jcr" />
      
      
                                    </mode:options>
      
      
                                    <mode:descriptors>
      
      
                                              <myDescriptor mode:value="foo" />
      
      
                                    </mode:descriptors>
      
      
                          </mode:repository>
      
      
                </mode:repositories>
      
      
                <mode:sources jcr:primaryType="nt:unstructured">
      
      
                          <mode:source jcr:name="MyDB"
                                    mode:classname="org.modeshape.connector.store.jpa.JpaSource"
      
      
                                    mode:model="Simple" mode:dialect="org.hibernate.dialect.MySQLDialect"
      
      
                                    mode:driverClassName="com.mysql.jdbc.Driver" mode:username="root"
      
      
                                    mode:password="root"
      
      
                                    mode:url="jdbc:mysql://localhost:3306/modeshape-db?autoReconnect=true"
      
      
                                    mode:maximumConnectionsInPool="1" mode:referentialIntegrityEnforced="true"
      
      
                                    mode:largeValueSizeInBytes="10000" mode:retryLimit="3"
      
      
                                    mode:compressData="false" mode:predefinedWorkspaceNames="workspace1"
      
      
                                    mode:showSql="true" mode:defaultWorkspaceName="workspace1" />
      
      
                </mode:sources>
      
      
                <mode:mimeTypeDetectors>
      
      
                          <mode:mimeTypeDetector jcr:name="Detector">
      
      
                                    <mode:description>Standard extension-based MIME type detector
                                    </mode:description>
      
      
                                    <mode:classname>org.modeshape.graph.mimetype.ExtensionBasedMimeTypeDetector
                                    </mode:classname>
      
      
                                    <mode:classpath></mode:classpath>
      
      
                                    <mode:classpath></mode:classpath>
      
      
                          </mode:mimeTypeDetector>
      
      
                </mode:mimeTypeDetectors>
      
      
      </configuration>
      
      
        • 1. Re: WebDAV configuration error
          Randall Hauch Master

          A couple of things I've noticed. First, the "mode:mimeTypeDetectors" fragment in the configuration file is not needed, as the extension detector is the default. Secondly, you're using the "org.hibernate.dialect.MySQLDialect", which is the wrong one if you're using MySQL with InnoDB. (Neither of these is the cause of the exception.)

           

          I don't recall seeing the exception before, but I'll look into it in about an hour and get back to you.

          • 2. Re: WebDAV configuration error
            Randall Hauch Master

            Based upon the stack trace, our code found a path within the request but not a repository name, and that caused the repository name to be assumed as an empty string. There are situations where this is the proper assumption, but obviously not in this case.

             

            Please provide the URL that you used, so I can figure out if the URL is wrong or if the code is wrong.

             

            Thanks!

            • 3. Re: WebDAV configuration error
              Emil Dombagolla Newbie

              Hi Randall,

               

              I get the above error , when i hit the browser with following URL, as follows

               

               

              http://localhost:8080/modeshape-web-jcr-webdav-war-0.0.1-SNAPSHOT

               

               

              And if i used URL as the following ,

               

               

              http://localhost:8080/modeshape-web-jcr-webdav-war-0.0.1-SNAPSHOT/WebDAV

               

              Log infomation printed as follows , but the browser displays nothing instead of  "HTTP Status 404 - /modeshape-web-jcr-webdav-war-0.0.1-SNAPSHOT/WebDAV"

               

               

              pe.org/1.0}sources/{}MyDB in configuration repository ModeShape Configuration Repository in workspace
              1154 [http-apr-8080-exec-3] TRACE org.modeshape.repository.RepositoryService  - Setting property defaultWorkspaceName to workspace1 on source at /{http://www.mo
              deshape.org/1.0}sources/{}MyDB in configuration repository ModeShape Configuration Repository in workspace
              1154 [http-apr-8080-exec-3] TRACE org.modeshape.repository.RepositoryService  - Setting property predefinedWorkspaceNames to [workspace1] on source at /{http://
              www.modeshape.org/1.0}sources/{}MyDB in configuration repository ModeShape Configuration Repository in workspace
              1154 [http-apr-8080-exec-3] TRACE org.modeshape.repository.RepositoryService  - Setting property password to root on source at /{http://www.modeshape.org/1.0}so
              urces/{}MyDB in configuration repository ModeShape Configuration Repository in workspace
              1154 [http-apr-8080-exec-3] TRACE org.modeshape.repository.RepositoryService$Administrator  - Started "Repository Service"
              1154 [http-apr-8080-exec-3] TRACE org.modeshape.repository.sequencer.SequencingService$Administrator  - Starting "Sequencing Service"
              1164 [http-apr-8080-exec-3] TRACE org.modeshape.repository.sequencer.SequencingService$Administrator  - Started "Sequencing Service"
              1174 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,185
              1174 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,637
              1184 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,075
              1184 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,227
              1184 [http-apr-8080-exec-3] TRACE org.modeshape.web.jcr.webdav.ModeShapeWebdavStore  - WebDAV getStoredObject at "/WebDAV"
              1184 [http-apr-8080-exec-3] DEBUG org.modeshape.web.jcr.webdav.ModeShapeWebdavStore  - WebDAV getStoredObject at "/WebDAV" resolved to "/WebDAV/nullnull"
              1194 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,084
              1194 [http-apr-8080-exec-3] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,175
              33388 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - -----------
              33388 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - WebdavServlet
               request: methodName = GET
              33388 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - time: 1323221810370
              33388 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - path: /modeshape-web-jcr-webdav-war-0.0.1-SNAPSHOT/WebDAV
              33388 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - -----------
              33388 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: host localhost:8080
              33388 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: connection keep-alive
              33388 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: cache-control no-cache
              33398 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: authorization Basic ZW1pbDoxMjM=
              33398 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: pragma no-cache
              33398 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: user-agent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Geck
              o) Chrome/15.0.874.121 Safari/535.2
              33398 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
              33398 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: accept-encoding gzip,deflate,sdch
              33398 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: accept-language en-US,en;q=0.8
              33398 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - header: accept-charset ISO-8859-1,utf-8;q=0.7,*;q=0.3
              33398 [http-apr-8080-exec-7] TRACE net.sf.webdav.WebDavServletBean  - attribute: org.apache.catalina.ASYNC_SUPPORTED false
              33398 [http-apr-8080-exec-7] TRACE net.sf.webdav.methods.DoHead  - -- net.sf.webdav.methods.DoGet
              33398 [http-apr-8080-exec-7] TRACE org.modeshape.web.jcr.webdav.ModeShapeWebdavStore  - WebDAV getStoredObject at "/WebDAV"
              33408 [http-apr-8080-exec-7] DEBUG org.modeshape.web.jcr.webdav.ModeShapeWebdavStore  - WebDAV getStoredObject at "/WebDAV" resolved to "/WebDAV/nullnull"
              33408 [http-apr-8080-exec-7] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,083
              33408 [http-apr-8080-exec-7] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,161
              33408 [http-apr-8080-exec-7] TRACE org.modeshape.web.jcr.webdav.ModeShapeWebdavStore  - WebDAV getStoredObject at "/WebDAV"
              33408 [http-apr-8080-exec-7] DEBUG org.modeshape.web.jcr.webdav.ModeShapeWebdavStore  - WebDAV getStoredObject at "/WebDAV" resolved to "/WebDAV/nullnull"
              33418 [http-apr-8080-exec-7] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,086
              33418 [http-apr-8080-exec-7] TRACE org.modeshape.graph.connector.base.Connection  - MapRepositoryConnection.execute(...) took 00:00:00.000,159
              
              

               

              Thanks you so much for your helps. and issues you higlighed on configurations areas(Mysql and the MIME type).Please help me to get solve this.

               

              Emil

              • 4. Re: WebDAV configuration error
                Emil Dombagolla Newbie

                Hi Randall,

                 

                Finally its working. as you gussed the issue was my URL. i was referring to 9.1 section of the documenation. which is not showing how to give the access url.  Thanks for your guidline and the time you spend on this.

                 

                Correct URL.

                http://localhost:8080/modeshape-web-jcr-webdav-war-0.0.1-SNAPSHOT/gs-repository/workspace1

                 

                 

                One more question ? do we have spring configurations for modeshape. Is it possible to inject as a service in to my code?

                 

                Thank you so much.

                Emil