我正在尝试重命名 Jackrabbit 中的节点,但它失败了,如下所示。给定节点“/fooNode”,我希望将其重命名为“/fooNodeRenamed”。
我的客户端是一个基于JavaDavexClient的简单 Java 程序,在 Debian Wheezy 上使用 Apache Jackrabbit 2.6.2 和 Oracle Java 1.7.0_25。
这是代码:
import javax.jcr.Credentials;
import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Workspace;
import javax.jcr.SimpleCredentials;
import javax.jcr.version.*;
import ch.liip.jcr.davex.DavexClient;
public class Client
{
public static void main(String[] args)
{
try {
// Config
String url = "http://localhost:8080/jackrabbit/server/";
String sourceWorkspaceName = "test-preview";
// Setup
DavexClient Client = new DavexClient(url);
Repository repo = Client.getRepository();
Credentials sc = new SimpleCredentials("admin", "admin".toCharArray());
Session sourceSession = repo.login(sc, sourceWorkspaceName);
// Create a node
Node fooNode = sourceSession.getRootNode().addNode("fooNode");
sourceSession.save();
// Rename the node - GIVES EXCEPTION
sourceSession.move("/fooNode", "/fooNodeMoved");
// This line is never reached
sourceSession.save();
} catch (RepositoryException e) {
e.printStackTrace();
}
}
}
每次运行上述操作之前,我都会清除工作区。这是一个例外:
javax.jcr.RepositoryException: Internal Server Error
at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:120)
at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:51)
at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:45)
at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.isGranted(RepositoryServiceImpl.java:904)
at org.apache.jackrabbit.jcr2spi.WorkspaceManager.canRead(WorkspaceManager.java:695)
at org.apache.jackrabbit.jcr2spi.state.ItemStateValidator.checkIsWritable(ItemStateValidator.java:199)
at org.apache.jackrabbit.jcr2spi.state.ItemStateValidator.checkRemoveItem(ItemStateValidator.java:431)
at org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.visit(SessionItemStateManager.java:282)
at org.apache.jackrabbit.jcr2spi.operation.Move.accept(Move.java:89)
at org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.execute(SessionItemStateManager.java:215)
at org.apache.jackrabbit.jcr2spi.SessionImpl.move(SessionImpl.java:323)
at Client.main(Client.java:32)
Caused by: org.apache.jackrabbit.webdav.DavException: Internal Server Error
at org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseException(DavMethodBase.java:165)
at org.apache.jackrabbit.webdav.client.methods.DavMethodBase.checkSuccess(DavMethodBase.java:174)
at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.isGranted(RepositoryServiceImpl.java:876)
... 8 more
知道有什么问题吗?是我的代码有问题还是环境有问题?