Hi Angela,

Thanks for your help. What I was trying to do, functionally, is to 
1) make "/" versionable, 
2) register namespace for "rtde:" if not registered yet for each
session, 
3) remove "/rtde:root" if exists
4) save session
5) create "/rtde:root" 
6) save session (this gives exception)

To answer your questions:

- I create every node as "nt:unstructured".
- Each node is not set as referenceable.
- I just deployed the standalone WAR of jackrabbit2.0.0 into tomcat6,
without specific configuration for the DavEx repo, except for the
repository.xml file attached. 
- I am not aware of how to do any security settings, so probably they
are default. Do I set it in the repository.xml ? If so, I have <param
name="anonymousId" value="anonymous"/>
- A simple log file is attached, the only ERROR is: JsonDiffHandler:
Node locked. (JsonDiffHandler.java, line 575), and I did delete the
.lock file and the "workspaces" folder before starting Tomcat.

Thanks again!
Xuetao

-----Original Message-----
From: Angela Schreiber [mailto:[email protected]] 
Sent: Thursday, March 18, 2010 12:19 PM
To: [email protected]
Subject: Re: "Bad Request" exception using DavEx

hi

not sure if properly understood what your problem is.
from your description i created a simple test-case as follows
and run it on my jackrabbit trunk (jcr2dav -> conformancetest)...
that worked...

public void testSimple() throws Exception {
         Session s = getHelper().getRepository().login(new 
SimpleCredentials("", new char[0]), null);
         try {
             Node n = s.getRootNode();
             n.addMixin("mix:lockable");
             s.save();

             n.addNode("test");
             s.save();
         } finally {
             s.logout();
         }

         Session ss = getHelper().getReadOnlySession();
         try {
             assertTrue(ss.nodeExists("/test"));
         } finally {
             ss.logout();
         }
     }

do you use specific node types to create your nodes?
are your nodes referenceable? (there were bugs with ref.
nodes that i fixed just recently)...

how is the server side config of your davex repo? specially
the security config... do you use the trivial configuration
that allow any non-anonymous user to write?

did you check the log files? any entry that would allow to
get some more information?

regards
angela



Niu, Xuetao wrote:
> Hi Angela,
> 
> - The getRootNode() returns "/" of the default workspace
> - The getRtdeRootNode() returns "/rtde:root" of the default workspace
> - The addNode(root, RTDE_ROOT_NAME) adds "rtde:root" under the "/"
node
> of the default workspace.
> 
> To get a node from the default workspace, I used this:
> Session.getNode(path)
> 
> To acquire a session, I used this: return
>
JcrUtils.getRepository("http://localhost:8080/jackrabbit-webapp-2.0.0/se
> rver").login(new SimpleCredentials("", new char[0]), null);
> 
> Let me know if you need more info.
> 
> Many Thanks!
> 
> Xuetao
> 
> 
> hi xuetao
> 
> and what exactly does getRtdeRootNode(s) and getRootNode(s)
> and addNode(root, RTDE_ROOT_NAME)?
> 
> please try to narrow down the problem so we can see what
> you are doing... otherwise it's not possible to help you.
> at least not for me.
> 
> thanks
> angela
> 
>> To explain what I did, I just called one method below and the 2nd
>> "save()" gives the exception I pasted beneath:
>>
>>  
>>
>>       public static synchronized void
> createRepositoryStructure(Session
>> s, boolean removeExisting) {
>>
>>  
>>
>>             try {
>>
>>                   getRootNode(s).addMixin(MIXIN_LOCKABLE);
>>
>>                   s.save();
>>
>>             } catch (RepositoryException e) {
>>
>>                   throw e;
>>
>>             }
>>
>>  
>>
>>             try {
>>
>>                   Node node = getRtdeRootNode(s);
>>
>>                   if (node != null) {
>>
>>                         if (removeExisting) {
>>
>>                               node.remove();
>>
>>                               s.save();
>>
>>                         } else {
>>
>>                               return;
>>
>>                         }
>>
>>                   }
>>
>>                   Node root = getRootNode(s);
>>
>>                   Node rtdeRoot = addNode(root, RTDE_ROOT_NAME);
>>
>>                   addNode(rtdeRoot, TENANTS_ROOT_NAME);
>>
>>  
>>
>>                   // the following save action produced the exception
>>
>>  
>>
>>                   s.save();
>>
>>  
>>
>>             } catch (RepositoryException e) {
>>
>>                   throw new e;
>>
>>             }
>>
>>  
>>
>>       }
>>
>>  
>>
>>  
>>
>> I am using DavEx to remotely connecting to a repository at
>> http://localhost:8080/jackrabbit-webapp-2.0.0/server which works in
> web
>> browser but not with JCR API
>>
>>  
>>
>> When I call Session.save(), I got the "Bad Request" exception, but if
> I
>> use a local repository impl, like TransientRepository, everything
> works
>> fine. Could you guys help me out?
>>
>>  
>>
>> Caused by: javax.jcr.RepositoryException: Bad Request
>>
>>                 at
>>
>
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
>> rter.java:113)
>>
>>                 at
>>
>
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
>> rter.java:49)
>>
>>                 at
>>
>
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
>> positoryServiceImpl.java:457)
>>
>>                 at
>>
>
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$2
>> 00(RepositoryServiceImpl.java:399)
>>
>>                 at
>>
>
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.submit(RepositoryS
>> erviceImpl.java:304)
>>
>>                 at
>>
>
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.exec
>> ute(WorkspaceManager.java:830)
>>
>>                 at
>>
>
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.acce
>> ss$500(WorkspaceManager.java:797)
>>
>>                 at
>>
>
org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.
>> java:594)
>>
>>                 at
>>
>
org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(Session
>> ItemStateManager.java:139)
>>
>>                 at
>> org.apache.jackrabbit.jcr2spi.ItemImpl.save(ItemImpl.java:246)
>>
>>                 at
>> org.apache.jackrabbit.jcr2spi.SessionImpl.save(SessionImpl.java:328)
>>
>>                 at
>>
>
com.fiserv.repository.jcr.JCRUtils.createRepositoryStructure(JCRUtils.ja
>> va:196)
>>
>>                 ... 51 more
>>
>> Caused by: org.apache.jackrabbit.webdav.DavException: Bad Request
>>
>>                 at
>>
>
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseExc
>> eption(DavMethodBase.java:172)
>>
>>                 at
>>
>
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(D
>> avMethodBase.java:181)
>>
>>                 at
>>
>
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
>> positoryServiceImpl.java:453)
>>
>>                 ... 60 more
>>
>>  
>>
>> Thanks in advance!
>>
>> Xuetao
>>
>>  
>>
>>
> 
> 

<?xml version="1.0" encoding="UTF-8"?>
<Repository>
    <!--
        virtual file system where the repository stores global state
        (e.g. registered namespaces, custom node types, etc.)
    -->
    
        <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
           <param name="driver" value="oracle.jdbc.OracleDriver"/>
			<param name="url" value="jdbc:oracle:thin:@localhost:1521:xxx"/>
			<param name="user" value="blabla"/>
			<param name="password" value="blabla"/>
			<param name="schema" value="oracle"/>
			<param name="schemaObjectPrefix" value="test_"/>
        </FileSystem>
    <!-- 
        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
       		<param name="path" value="${rep.home}/repository"/>
  		</FileSystem>
  	 -->
	<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
        	<param name="driver" value="oracle.jdbc.OracleDriver"/>
			<param name="url" value="jdbc:oracle:thin:@localhost:1521:xxx"/>
			<param name="user" value="blabla"/>
			<param name="password" value="blabla"/>
			<param name="schema" value="oracle"/>
        	<param name="externalBLOBs" value="false"/>
        	<param name="schemaObjectPrefix" value="test_"/>
        </PersistenceManager>
    <!--
        security configuration
    -->
    <Security appName="Jackrabbit">
        <!--
            access manager:
            class: FQN of class implementing the AccessManager interface
        -->
        <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
            <!-- <param name="config" value="${rep.home}/access.xml"/> -->
        </AccessManager>

        <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
           <!-- anonymous user name ('anonymous' is the default value) -->
           <param name="anonymousId" value="anonymous"/>
           <!--
              default user name to be used instead of the anonymous user
              when no login credentials are provided (unset by default)
           -->
           <!-- <param name="defaultUserId" value="superuser"/> -->
        </LoginModule>
    </Security>

    <!--
        location of workspaces root directory and name of default workspace
    -->
    <Workspaces defaultWorkspace="default" rootPath="${rep.home}/workspaces"/>
    <!--
        workspace configuration template:
        used to create the initial workspace if there's no workspace yet
    -->
    <Workspace name="${wsp.name}">
        <!--
            virtual file system of the workspace:
            class: FQN of class implementing the FileSystem interface
        -->
        <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
           <param name="driver" value="oracle.jdbc.OracleDriver"/>
			<param name="url" value="jdbc:oracle:thin:@localhost:1521:xxx"/>
			<param name="user" value="blabla"/>
			<param name="password" value="blabla"/>
			<param name="schema" value="oracle"/>
			<param name="schemaObjectPrefix" value="test_ws_"/>
        </FileSystem>
    <!-- 
        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
       		<param name="path" value="${rep.home}/repository"/>
  		</FileSystem>
  	 -->	
        <!--
            persistence manager of the workspace:
            class: FQN of class implementing the PersistenceManager interface
        -->
        <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
        	<param name="driver" value="oracle.jdbc.OracleDriver"/>
			<param name="url" value="jdbc:oracle:thin:@localhost:1521:xxx"/>
			<param name="user" value="blabla"/>
			<param name="password" value="blabla"/>
			<param name="schema" value="oracle"/>
        	<param name="externalBLOBs" value="false"/>
        	<param name="schemaObjectPrefix" value="test_ws_"/>
        </PersistenceManager>
       
    </Workspace>

    <!--
        Configures the versioning
    -->
    <Versioning rootPath="${rep.home}/version">
        <!--
            Configures the filesystem to use for versioning for the respective
            persistence manager
        -->
        <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
           <param name="driver" value="oracle.jdbc.OracleDriver"/>
			<param name="url" value="jdbc:oracle:thin:@localhost:1521:xxx"/>
			<param name="user" value="blabla"/>
			<param name="password" value="blabla"/>
			<param name="schema" value="oracle"/>
			<param name="schemaObjectPrefix" value="test_version_"/>
        </FileSystem>
    <!-- 
        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
       		<param name="path" value="${rep.home}/repository"/>
  		</FileSystem>
  	 -->	
        <!--
            Configures the persistence manager to be used for persisting version state.
            Please note that the current versioning implementation is based on
            a 'normal' persistence manager, but this could change in future
            implementations.
        -->
        <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
        	<param name="driver" value="oracle.jdbc.OracleDriver"/>
			<param name="url" value="jdbc:oracle:thin:@localhost:1521:xxx"/>
			<param name="user" value="blabla"/>
			<param name="password" value="blabla"/>
			<param name="schema" value="oracle"/>
        	<param name="externalBLOBs" value="false"/>
        	<param name="schemaObjectPrefix" value="test_version_"/>
        </PersistenceManager>
    </Versioning>

</Repository>

Reply via email to