Discussion:
"Bad Request" exception using DavEx
Niu, Xuetao
2010-03-16 16:58:56 UTC
Permalink
Hello,



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
Niu, Xuetao
2010-03-17 10:42:23 UTC
Permalink
Anybody has an idea?

-----Original Message-----
From: Niu, Xuetao
Sent: Tue 3/16/2010 5:58 PM
To: ***@jackrabbit.apache.org
Subject: "Bad Request" exception using DavEx

Hello,



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
Angela Schreiber
2010-03-17 11:18:30 UTC
Permalink
Post by Niu, Xuetao
Anybody has an idea?
sorry... you have to be more specific. what exactly
do you want to do? what kind of transient modifications
were involved?

with the given information it's not possible to help.

angela
Niu, Xuetao
2010-03-18 09:24:57 UTC
Permalink
Hello,



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
Angela Schreiber
2010-03-18 10:33:28 UTC
Permalink
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
Post by Niu, Xuetao
To explain what I did, I just called one method below and the 2nd
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
Niu, Xuetao
2010-03-18 10:43:05 UTC
Permalink
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
Post by Niu, Xuetao
To explain what I did, I just called one method below and the 2nd
public static synchronized void
createRepositoryStructure(Session
Post by Niu, Xuetao
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
Post by Niu, Xuetao
rter.java:113)
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
rter.java:49)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
positoryServiceImpl.java:457)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$2
Post by Niu, Xuetao
00(RepositoryServiceImpl.java:399)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.submit(RepositoryS
Post by Niu, Xuetao
erviceImpl.java:304)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.exec
Post by Niu, Xuetao
ute(WorkspaceManager.java:830)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.acce
Post by Niu, Xuetao
ss$500(WorkspaceManager.java:797)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.
Post by Niu, Xuetao
java:594)
at
org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(Session
Post by Niu, Xuetao
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
Post by Niu, Xuetao
va:196)
... 51 more
Caused by: org.apache.jackrabbit.webdav.DavException: Bad Request
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseExc
Post by Niu, Xuetao
eption(DavMethodBase.java:172)
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(D
Post by Niu, Xuetao
avMethodBase.java:181)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
positoryServiceImpl.java:453)
... 60 more
Thanks in advance!
Xuetao
Angela Schreiber
2010-03-18 11:18:43 UTC
Permalink
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
Post by Niu, Xuetao
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.
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
Post by Niu, Xuetao
To explain what I did, I just called one method below and the 2nd
public static synchronized void
createRepositoryStructure(Session
Post by Niu, Xuetao
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
Post by Niu, Xuetao
browser but not with JCR API
When I call Session.save(), I got the "Bad Request" exception, but if
I
Post by Niu, Xuetao
use a local repository impl, like TransientRepository, everything
works
Post by Niu, Xuetao
fine. Could you guys help me out?
Caused by: javax.jcr.RepositoryException: Bad Request
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
rter.java:113)
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
rter.java:49)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
positoryServiceImpl.java:457)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$2
Post by Niu, Xuetao
00(RepositoryServiceImpl.java:399)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.submit(RepositoryS
Post by Niu, Xuetao
erviceImpl.java:304)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.exec
Post by Niu, Xuetao
ute(WorkspaceManager.java:830)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.acce
Post by Niu, Xuetao
ss$500(WorkspaceManager.java:797)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.
Post by Niu, Xuetao
java:594)
at
org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(Session
Post by Niu, Xuetao
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
Post by Niu, Xuetao
va:196)
... 51 more
Caused by: org.apache.jackrabbit.webdav.DavException: Bad Request
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseExc
Post by Niu, Xuetao
eption(DavMethodBase.java:172)
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(D
Post by Niu, Xuetao
avMethodBase.java:181)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
positoryServiceImpl.java:453)
... 60 more
Thanks in advance!
Xuetao
Niu, Xuetao
2010-03-18 12:36:09 UTC
Permalink
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:***@day.com]
Sent: Thursday, March 18, 2010 12:19 PM
To: ***@jackrabbit.apache.org
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
Post by Niu, Xuetao
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.
Session.getNode(path)
To acquire a session, I used this: return
JcrUtils.getRepository("http://localhost:8080/jackrabbit-webapp-2.0.0/se
Post by Niu, Xuetao
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
Post by Niu, Xuetao
To explain what I did, I just called one method below and the 2nd
public static synchronized void
createRepositoryStructure(Session
Post by Niu, Xuetao
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
Post by Niu, Xuetao
browser but not with JCR API
When I call Session.save(), I got the "Bad Request" exception, but if
I
Post by Niu, Xuetao
use a local repository impl, like TransientRepository, everything
works
Post by Niu, Xuetao
fine. Could you guys help me out?
Caused by: javax.jcr.RepositoryException: Bad Request
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:113)
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:49)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:457)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$2
Post by Niu, Xuetao
Post by Niu, Xuetao
00(RepositoryServiceImpl.java:399)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.submit(RepositoryS
Post by Niu, Xuetao
Post by Niu, Xuetao
erviceImpl.java:304)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.exec
Post by Niu, Xuetao
Post by Niu, Xuetao
ute(WorkspaceManager.java:830)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.acce
Post by Niu, Xuetao
Post by Niu, Xuetao
ss$500(WorkspaceManager.java:797)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.
Post by Niu, Xuetao
Post by Niu, Xuetao
java:594)
at
org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(Session
Post by Niu, Xuetao
Post by Niu, Xuetao
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
Post by Niu, Xuetao
Post by Niu, Xuetao
va:196)
... 51 more
Caused by: org.apache.jackrabbit.webdav.DavException: Bad Request
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseExc
Post by Niu, Xuetao
Post by Niu, Xuetao
eption(DavMethodBase.java:172)
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(D
Post by Niu, Xuetao
Post by Niu, Xuetao
avMethodBase.java:181)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:453)
... 60 more
Thanks in advance!
Xuetao
Niu, Xuetao
2010-03-18 12:39:05 UTC
Permalink
This is the zipped log file. Hope the mail-server won't block it...


-----Original Message-----
From: Niu, Xuetao
Sent: Thursday, March 18, 2010 1:36 PM
To: ***@jackrabbit.apache.org
Subject: RE: "Bad Request" exception using DavEx

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:***@day.com]
Sent: Thursday, March 18, 2010 12:19 PM
To: ***@jackrabbit.apache.org
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
Post by Niu, Xuetao
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.
Session.getNode(path)
To acquire a session, I used this: return
JcrUtils.getRepository("http://localhost:8080/jackrabbit-webapp-2.0.0/se
Post by Niu, Xuetao
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
Post by Niu, Xuetao
To explain what I did, I just called one method below and the 2nd
public static synchronized void
createRepositoryStructure(Session
Post by Niu, Xuetao
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
Post by Niu, Xuetao
browser but not with JCR API
When I call Session.save(), I got the "Bad Request" exception, but if
I
Post by Niu, Xuetao
use a local repository impl, like TransientRepository, everything
works
Post by Niu, Xuetao
fine. Could you guys help me out?
Caused by: javax.jcr.RepositoryException: Bad Request
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:113)
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:49)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:457)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$2
Post by Niu, Xuetao
Post by Niu, Xuetao
00(RepositoryServiceImpl.java:399)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.submit(RepositoryS
Post by Niu, Xuetao
Post by Niu, Xuetao
erviceImpl.java:304)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.exec
Post by Niu, Xuetao
Post by Niu, Xuetao
ute(WorkspaceManager.java:830)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.acce
Post by Niu, Xuetao
Post by Niu, Xuetao
ss$500(WorkspaceManager.java:797)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.
Post by Niu, Xuetao
Post by Niu, Xuetao
java:594)
at
org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(Session
Post by Niu, Xuetao
Post by Niu, Xuetao
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
Post by Niu, Xuetao
Post by Niu, Xuetao
va:196)
... 51 more
Caused by: org.apache.jackrabbit.webdav.DavException: Bad Request
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseExc
Post by Niu, Xuetao
Post by Niu, Xuetao
eption(DavMethodBase.java:172)
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(D
Post by Niu, Xuetao
Post by Niu, Xuetao
avMethodBase.java:181)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:453)
... 60 more
Thanks in advance!
Xuetao
Niu, Xuetao
2010-03-18 12:40:46 UTC
Permalink
Sorry, cannot get the attachment through the mail server, please see the
pasted log file:

18.03.2010 13:29:50 *INFO * root: Logging initialized.
(LoggingServlet.java, line 87)
18.03.2010 13:29:50 *INFO * RepositoryStartupServlet:
RepositoryStartupServlet initializing... (RepositoryStartupServlet.java,
line 235)
18.03.2010 13:29:50 *INFO * AbstractConfig: Configuration of
BootstrapConfig (AbstractConfig.java, line 101)
18.03.2010 13:29:50 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 102)
18.03.2010 13:29:50 *INFO * AbstractConfig: jndiConfig:
***@2f729e (AbstractConfig.java, line
106)
18.03.2010 13:29:50 *INFO * AbstractConfig: rmiConfig:
***@10deb5f (AbstractConfig.java, line
106)
18.03.2010 13:29:50 *INFO * AbstractConfig: repositoryHome: rtde
(AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: repositoryConfig:
rtde/repository.xml (AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: class: class
org.apache.jackrabbit.j2ee.BootstrapConfig (AbstractConfig.java, line
106)
18.03.2010 13:29:50 *INFO * AbstractConfig: valid: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: repositoryName:
jackrabbit.repository (AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 108)
18.03.2010 13:29:50 *INFO * AbstractConfig: Configuration of JNDIConfig
(AbstractConfig.java, line 101)
18.03.2010 13:29:50 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 102)
18.03.2010 13:29:50 *INFO * AbstractConfig: jndiName:
jackrabbit.repository (AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: class: class
org.apache.jackrabbit.j2ee.JNDIConfig (AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: jndiEnv:
{java.naming.provider.url=http://www.apache.org/jackrabbit,
java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.Dum
myInitialContextFactory} (AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: valid: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: jndiEnabled: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 108)
18.03.2010 13:29:50 *INFO * AbstractConfig: Configuration of RMIConfig
(AbstractConfig.java, line 101)
18.03.2010 13:29:50 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 102)
18.03.2010 13:29:50 *INFO * AbstractConfig: rmiName:
jackrabbit.repository (AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: rmiUri:
//localhost:1099/jackrabbit.repository (AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: rmiEnabled: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: rmiPort: 1099
(AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: rmiHost: localhost
(AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: class: class
org.apache.jackrabbit.j2ee.RMIConfig (AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig: valid: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:50 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 108)
18.03.2010 13:29:50 *WARN * ConfigurationErrorHandler: Warning parsing
the configuration at line 2 using system id null:
org.xml.sax.SAXParseException: Document root element "Repository", must
match DOCTYPE root "null". (ConfigurationErrorHandler.java, line 43)
18.03.2010 13:29:50 *WARN * ConfigurationErrorHandler: Warning parsing
the configuration at line 2 using system id null:
org.xml.sax.SAXParseException: Document is invalid: no grammar found.
(ConfigurationErrorHandler.java, line 43)
18.03.2010 13:29:50 *INFO * RepositoryImpl: Starting repository...
(RepositoryImpl.java, line 304)
18.03.2010 13:29:51 *INFO * NodeTypeRegistry: no custom node type
definitions found (NodeTypeRegistry.java, line 828)
18.03.2010 13:29:51 *INFO * ConnectionRecoveryManager: Database: Oracle
/ Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
(ConnectionRecoveryManager.java, line 345)
18.03.2010 13:29:51 *INFO * ConnectionRecoveryManager: Driver: Oracle
JDBC driver / 10.2.0.1.0 (ConnectionRecoveryManager.java, line 346)
18.03.2010 13:29:51 *INFO * RepositoryImpl: initializing workspace
'default'... (RepositoryImpl.java, line 1993)
18.03.2010 13:29:51 *INFO * ConnectionRecoveryManager: Database: Oracle
/ Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
(ConnectionRecoveryManager.java, line 345)
18.03.2010 13:29:51 *INFO * ConnectionRecoveryManager: Driver: Oracle
JDBC driver / 10.2.0.1.0 (ConnectionRecoveryManager.java, line 346)
18.03.2010 13:29:51 *INFO * RepositoryImpl: workspace 'default'
initialized (RepositoryImpl.java, line 1997)
18.03.2010 13:29:51 *INFO * RepositoryImpl: Repository started
(RepositoryImpl.java, line 402)
18.03.2010 13:29:51 *INFO * RepositoryStartupServlet: Repository bound
via RMI with name: //localhost:1099/jackrabbit.repository
(RepositoryStartupServlet.java, line 562)
18.03.2010 13:29:51 *INFO * RepositoryStartupServlet: Repository bound
to JNDI with name: jackrabbit.repository (RepositoryStartupServlet.java,
line 452)
18.03.2010 13:29:51 *INFO * RepositoryStartupServlet:
RepositoryStartupServlet initialized. (RepositoryStartupServlet.java,
line 241)
18.03.2010 13:29:51 *INFO * RepositoryAccessServlet:
RepositoryAccessServlet initialized. (RepositoryAccessServlet.java, line
98)
18.03.2010 13:29:51 *INFO * SimpleWebdavServlet: resource-path-prefix =
'/repository' (SimpleWebdavServlet.java, line 158)
18.03.2010 13:29:51 *INFO * SimpleWebdavServlet: WWW-Authenticate header
= 'Basic realm="Jackrabbit Webdav Server"' (SimpleWebdavServlet.java,
line 164)
18.03.2010 13:29:53 *INFO * AbstractConfig: Configuration of
BootstrapConfig (AbstractConfig.java, line 101)
18.03.2010 13:29:53 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 102)
18.03.2010 13:29:53 *INFO * AbstractConfig: jndiConfig:
***@e41d4a (AbstractConfig.java, line
106)
18.03.2010 13:29:53 *INFO * AbstractConfig: rmiConfig:
***@3f265b (AbstractConfig.java, line
106)
18.03.2010 13:29:53 *INFO * AbstractConfig: repositoryHome: rtde
(AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: repositoryConfig:
rtde/repository.xml (AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: class: class
org.apache.jackrabbit.j2ee.BootstrapConfig (AbstractConfig.java, line
106)
18.03.2010 13:29:53 *INFO * AbstractConfig: valid: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: repositoryName:
jackrabbit.repository (AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 108)
18.03.2010 13:29:53 *INFO * AbstractConfig: Configuration of JNDIConfig
(AbstractConfig.java, line 101)
18.03.2010 13:29:53 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 102)
18.03.2010 13:29:53 *INFO * AbstractConfig: jndiName:
jackrabbit.repository (AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: class: class
org.apache.jackrabbit.j2ee.JNDIConfig (AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: jndiEnv:
{java.naming.provider.url=http://www.apache.org/jackrabbit,
java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.Dum
myInitialContextFactory} (AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: valid: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: jndiEnabled: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 108)
18.03.2010 13:29:53 *INFO * AbstractConfig: Configuration of RMIConfig
(AbstractConfig.java, line 101)
18.03.2010 13:29:53 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 102)
18.03.2010 13:29:53 *INFO * AbstractConfig: rmiName:
jackrabbit.repository (AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: rmiUri:
//localhost:1099/jackrabbit.repository (AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: rmiEnabled: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: rmiPort: 1099
(AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: rmiHost: localhost
(AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: class: class
org.apache.jackrabbit.j2ee.RMIConfig (AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig: valid: true
(AbstractConfig.java, line 106)
18.03.2010 13:29:53 *INFO * AbstractConfig:
---------------------------------------------- (AbstractConfig.java,
line 108)
18.03.2010 13:29:53 *INFO * RepositoryAccessServlet: Acquired repository
via JNDI. (RepositoryAccessServlet.java, line 207)
18.03.2010 13:29:53 *INFO * SimpleSecurityManager: init: using
Repository LoginModule configuration for Jackrabbit
(SimpleSecurityManager.java, line 137)
18.03.2010 13:29:53 *INFO * RepositoryImpl: SecurityManager = class
org.apache.jackrabbit.core.security.simple.SimpleSecurityManager
(RepositoryImpl.java, line 484)
18.03.2010 13:29:53 *WARN * AbstractLoginModule: No credentials
available -> try default (anonymous) authentication.
(AbstractLoginModule.java, line 299)
18.03.2010 13:29:55 *WARN * AbstractLoginModule: No credentials
available -> try default (anonymous) authentication.
(AbstractLoginModule.java, line 299)
18.03.2010 13:29:55 *INFO * LRUNodeIdCache: num=191/10240 hits=9769
miss=231 (LRUNodeIdCache.java, line 70)
18.03.2010 13:29:55 *INFO * LRUNodeIdCache: num=177/10240 hits=9779
miss=221 (LRUNodeIdCache.java, line 70)
18.03.2010 13:29:55 *ERROR* JsonDiffHandler: Node locked.
(JsonDiffHandler.java, line 575)
18.03.2010 13:29:55 *WARN * JcrRemotingServlet: Invalid DIFF format
(JcrRemotingServlet.java, line 336)
18.03.2010 13:29:55 *WARN * LockManagerImpl: Bad lock token: Bad check
digit. (LockManagerImpl.java, line 790)
18.03.2010 13:29:55 *WARN * LockManagerImpl: Bad lock token: Bad check
digit. (LockManagerImpl.java, line 790)

-----Original Message-----
From: Niu, Xuetao
Sent: Thursday, March 18, 2010 1:36 PM
To: ***@jackrabbit.apache.org
Subject: RE: "Bad Request" exception using DavEx

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
Niu, Xuetao
2010-03-18 13:57:01 UTC
Permalink
Hi Angela,

I don't know better ways of "unlocking" the "/" node than follows:

- shutdown Tomcat
- kill all "java" processes.
- Delete the ".lock" file and the "workspaces" folder
- Removed all sequences, triggers, tables from my oracle database. (I
use oracle bundle persistence and oracle filesystem)

Still, I get the same error... What I don't understand is why using
TransientRepository (created by JcrUtils.getRepository(Map)) doesn't
have such problem. Is the root node locked by the standalone WAR app
itself?

Thanks for helping me further.

Xuetao

P.S. I made a mistake in my email statements. What I actually did was to
make "/" lockable in the 1st step, not versionable.

-----Original Message-----
From: Angela Schreiber [mailto:***@day.com]
Sent: Thursday, March 18, 2010 1:48 PM
To: ***@jackrabbit.apache.org
Subject: Re: "Bad Request" exception using DavEx

hi Xuetao

first of all: the exception you mention below ("Node locked.
(JsonDiffHandler.java, line 575)" indicates that there has
been a lock set to that node in which case some other session
that isn't the lock owner will not be allowed to modify that
node (or even the whole subtree if the lock is deep).

so... at some point you most probably locked that node
-> unlock it first in order to make changes with another session.

i'm pretty sure that this will solve your problem.

and just as a side note:
if you want the root node to be versionable you should
use mix:versionable instead of mix:lockable.

regards
angela
Post by Niu, Xuetao
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)
- 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"/>
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-----
Sent: Thursday, March 18, 2010 12:19 PM
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
Post by Niu, Xuetao
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
Post by Niu, Xuetao
of the default workspace.
Session.getNode(path)
To acquire a session, I used this: return
JcrUtils.getRepository("http://localhost:8080/jackrabbit-webapp-2.0.0/se
Post by Niu, Xuetao
Post by Niu, Xuetao
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
Post by Niu, Xuetao
To explain what I did, I just called one method below and the 2nd
public static synchronized void
createRepositoryStructure(Session
Post by Niu, Xuetao
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
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
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
Post by Niu, Xuetao
browser but not with JCR API
When I call Session.save(), I got the "Bad Request" exception, but if
I
Post by Niu, Xuetao
use a local repository impl, like TransientRepository, everything
works
Post by Niu, Xuetao
fine. Could you guys help me out?
Caused by: javax.jcr.RepositoryException: Bad Request
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:113)
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:49)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:457)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$2
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
00(RepositoryServiceImpl.java:399)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.submit(RepositoryS
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
erviceImpl.java:304)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.exec
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
ute(WorkspaceManager.java:830)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.acce
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
ss$500(WorkspaceManager.java:797)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
java:594)
at
org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(Session
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
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
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
va:196)
... 51 more
Caused by: org.apache.jackrabbit.webdav.DavException: Bad Request
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseExc
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
eption(DavMethodBase.java:172)
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(D
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
avMethodBase.java:181)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:453)
... 60 more
Thanks in advance!
Xuetao
Niu, Xuetao
2010-03-18 14:22:30 UTC
Permalink
Hi Angela,

Could you try this? Remove an existing node, save session, and add that
node again:

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();


Node testNode = n.addNode("test");
s.save();

// remove and save
testNode.remove();
s.save()

// re-add and save
testNode = n.addNode("test");
s.save();

} finally {
s.logout();
}

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

Xuetao
Post by Niu, Xuetao
-----Original Message-----
Sent: Thursday, March 18, 2010 12:19 PM
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
Post by Niu, Xuetao
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
Post by Niu, Xuetao
of the default workspace.
Session.getNode(path)
To acquire a session, I used this: return
JcrUtils.getRepository("http://localhost:8080/jackrabbit-webapp-2.0.0/se
Post by Niu, Xuetao
Post by Niu, Xuetao
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
Post by Niu, Xuetao
To explain what I did, I just called one method below and the 2nd
public static synchronized void
createRepositoryStructure(Session
Post by Niu, Xuetao
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
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
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
Post by Niu, Xuetao
browser but not with JCR API
When I call Session.save(), I got the "Bad Request" exception, but if
I
Post by Niu, Xuetao
use a local repository impl, like TransientRepository, everything
works
Post by Niu, Xuetao
fine. Could you guys help me out?
Caused by: javax.jcr.RepositoryException: Bad Request
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:113)
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:49)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:457)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$2
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
00(RepositoryServiceImpl.java:399)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.submit(RepositoryS
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
erviceImpl.java:304)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.exec
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
ute(WorkspaceManager.java:830)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.acce
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
ss$500(WorkspaceManager.java:797)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
java:594)
at
org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(Session
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
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
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
va:196)
... 51 more
Caused by: org.apache.jackrabbit.webdav.DavException: Bad Request
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseExc
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
eption(DavMethodBase.java:172)
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(D
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
avMethodBase.java:181)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:453)
... 60 more
Thanks in advance!
Xuetao
Angela Schreiber
2010-03-18 15:21:27 UTC
Permalink
Post by Niu, Xuetao
Hi Angela,
Could you try this? Remove an existing node, save session, and add that
in the trunk it works for me. and i'm not aware of a recent
fix that would have changed that (see JIRA for the list of
recently fixed bugs [1] and [2] for the list of known issues).

if the error you see in the log is in relation to your
problem then it's for sure a lock on the root that prevents
you from updating the node.

use LockManager#unlock or Node#unlock to get rid of the
lock... if you lost the token it is written somewhere on the
filesystem (i don't recall the location by heart).

and no: adding the mixin doesn't automatically lock the
node.
and no: the root isn't locked by default.

a lock is only created if you explicitly ask for it.
have a look at JSR 170 or 283 for the details.

angela

[1] query for
components: jcr2spi, spi2dav and jcr-server,
fixversion: 2.1
[2]
http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-spi2dav/pom.xml
Niu, Xuetao
2010-03-18 15:32:42 UTC
Permalink
I tried LockManager.unlock("/") right before the session.save(), but it
throws an LockException telling "No lock present on Node with id /".

Very strange... Does it mean it hasn't been locked at all?
Post by Angela Schreiber
if you lost the token it is written somewhere on the
filesystem (i don't recall the location by heart).
- I believe it is the .lock file that I explicitly deleted.

Xuetao

-----Original Message-----
From: Angela Schreiber [mailto:***@day.com]
Sent: Thursday, March 18, 2010 4:21 PM
To: ***@jackrabbit.apache.org
Subject: Re: "Bad Request" exception using DavEx
Post by Angela Schreiber
Hi Angela,
Could you try this? Remove an existing node, save session, and add that
in the trunk it works for me. and i'm not aware of a recent
fix that would have changed that (see JIRA for the list of
recently fixed bugs [1] and [2] for the list of known issues).

if the error you see in the log is in relation to your
problem then it's for sure a lock on the root that prevents
you from updating the node.

use LockManager#unlock or Node#unlock to get rid of the
lock... if you lost the token it is written somewhere on the
filesystem (i don't recall the location by heart).

and no: adding the mixin doesn't automatically lock the
node.
and no: the root isn't locked by default.

a lock is only created if you explicitly ask for it.
have a look at JSR 170 or 283 for the details.

angela

[1] query for
components: jcr2spi, spi2dav and jcr-server,
fixversion: 2.1
[2]
http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-spi2dav/pom.
xml
Alexander Klimetschek
2010-03-18 16:21:59 UTC
Permalink
Post by Niu, Xuetao
Post by Angela Schreiber
if you lost the token it is written somewhere on the
filesystem (i don't recall the location by heart).
- I believe it is the .lock file that I explicitly deleted.
This lock file has nothing to do with JCR locking ;-) It is used by
Jackrabbit to ensure only a single running instance access the same
repository home directory and its files at the same time.

Regards,
Alex
--
Alexander Klimetschek
***@day.com
Niu, Xuetao
2010-03-18 16:25:04 UTC
Permalink
OK... but since I use database persistence and database filesystem (no
datastore is being used), and recreated the database too, I cannot
imagine where the JCR lock info can be written to...

Regards,
Xuetao
-----Original Message-----
From: Alexander Klimetschek [mailto:***@day.com]
Sent: Thursday, March 18, 2010 5:22 PM
To: ***@jackrabbit.apache.org
Subject: Re: "Bad Request" exception using DavEx
Post by Niu, Xuetao
Post by Angela Schreiber
if you lost the token it is written somewhere on the
filesystem (i don't recall the location by heart).
- I believe it is the .lock file that I explicitly deleted.
This lock file has nothing to do with JCR locking ;-) It is used by
Jackrabbit to ensure only a single running instance access the same
repository home directory and its files at the same time.

Regards,
Alex
--
Alexander Klimetschek
***@day.com
kanwalb
2018-11-08 18:06:03 UTC
Permalink
Were you able to solve this issue?



--
Sent from: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-Users-f510167.html
Angela Schreiber
2010-03-18 12:47:39 UTC
Permalink
hi Xuetao

first of all: the exception you mention below ("Node locked.
(JsonDiffHandler.java, line 575)" indicates that there has
been a lock set to that node in which case some other session
that isn't the lock owner will not be allowed to modify that
node (or even the whole subtree if the lock is deep).

so... at some point you most probably locked that node
-> unlock it first in order to make changes with another session.

i'm pretty sure that this will solve your problem.

and just as a side note:
if you want the root node to be versionable you should
use mix:versionable instead of mix:lockable.

regards
angela
Post by Niu, Xuetao
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)
- 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"/>
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-----
Sent: Thursday, March 18, 2010 12:19 PM
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
Post by Niu, Xuetao
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
Post by Niu, Xuetao
of the default workspace.
Session.getNode(path)
To acquire a session, I used this: return
JcrUtils.getRepository("http://localhost:8080/jackrabbit-webapp-2.0.0/se
Post by Niu, Xuetao
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
Post by Niu, Xuetao
To explain what I did, I just called one method below and the 2nd
public static synchronized void
createRepositoryStructure(Session
Post by Niu, Xuetao
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
Post by Niu, Xuetao
browser but not with JCR API
When I call Session.save(), I got the "Bad Request" exception, but if
I
Post by Niu, Xuetao
use a local repository impl, like TransientRepository, everything
works
Post by Niu, Xuetao
fine. Could you guys help me out?
Caused by: javax.jcr.RepositoryException: Bad Request
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:113)
at
org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConve
Post by Niu, Xuetao
Post by Niu, Xuetao
rter.java:49)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:457)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$2
Post by Niu, Xuetao
Post by Niu, Xuetao
00(RepositoryServiceImpl.java:399)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.submit(RepositoryS
Post by Niu, Xuetao
Post by Niu, Xuetao
erviceImpl.java:304)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.exec
Post by Niu, Xuetao
Post by Niu, Xuetao
ute(WorkspaceManager.java:830)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager$OperationVisitorImpl.acce
Post by Niu, Xuetao
Post by Niu, Xuetao
ss$500(WorkspaceManager.java:797)
at
org.apache.jackrabbit.jcr2spi.WorkspaceManager.execute(WorkspaceManager.
Post by Niu, Xuetao
Post by Niu, Xuetao
java:594)
at
org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.save(Session
Post by Niu, Xuetao
Post by Niu, Xuetao
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
Post by Niu, Xuetao
Post by Niu, Xuetao
va:196)
... 51 more
Caused by: org.apache.jackrabbit.webdav.DavException: Bad Request
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseExc
Post by Niu, Xuetao
Post by Niu, Xuetao
eption(DavMethodBase.java:172)
at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(D
Post by Niu, Xuetao
Post by Niu, Xuetao
avMethodBase.java:181)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(Re
Post by Niu, Xuetao
Post by Niu, Xuetao
positoryServiceImpl.java:453)
... 60 more
Thanks in advance!
Xuetao
Niu, Xuetao
2010-03-18 10:22:44 UTC
Permalink
To supplement the way I remotely access JCR API:



I followed the jackrabbit wiki:
http://wiki.apache.org/jackrabbit/RemoteAccess#DavEx to use the
following code to create remote JCR API stub:

JcrUtils.getRepository("http://localhost:8080/jackrabbit-webapp-2.0.0/se
rver");



Regards,

Xuetao



From: Niu, Xuetao
Sent: Thursday, March 18, 2010 10:25 AM
To: '***@jackrabbit.apache.org'
Subject: RE: "Bad Request" exception using DavEx



Hello,



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
Loading...