jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabián Mandelbaum <fmandelb...@gmail.com>
Subject Cannot store file nodes anymore after the switch from JR1.6.x to JR2.2.4
Date Fri, 04 Mar 2011 18:30:57 GMT
Hello,

I'm in the process of switching all my code to JCR2.0 and JackRabbit
2.2.4. When my webapp receives a file, it tries to store it on JCR
with the following code:

if (session.itemExists(path)) {
            fnode = session.getNode(path);
            rnode = fnode.getNode(Node.JCR_CONTENT);
            vm.checkout(rnode.getPath()); // Mark the node R/W <--
This is where the exception is thrown if the file exists
        } else {
            fnode = ((Node)session.getItem(PATH +
folder)).addNode(fname, "nt:file"); // NOI18N <-- This is where the
exception is thrown if the file doesn't exist
            rnode = fnode.addNode(Node.JCR_CONTENT, "nt:resource"); // NOI18N
            rnode.addMixin("mix:versionable"); // NOI18N
            fnode.addMixin("mix:lockable"); // NOI18N
        }
// Set the rest of the properties (lastModified, mimeType, etc.) and
binary (data) stream here.

path holds the absolute path (/full/path/to/the/to/be/nt_file/node) of
the file node to be added.

This code, and the equivalent JCR2 code with the addNode line replaced by:

fnode = session.getNode(PATH + folder).addNode(fname, "nt:file");

throws an AccessDeniedException. I can add other node types
(basically, nt:unstructured and nt:folder) without problems, with the
same code I've used with JCR1, I'm only getting this exception so far
when trying to add nt:file nodes.

I'm using the standard (gotten from a run of
jackrabbit-standalone-2.2.4.jar) repository.xml configuration file,
with the H2 DB instead of Derby.

This is a stack trace excerpt from the 1st case, where the file already exists:

avax.jcr.AccessDeniedException: Access denied
	at org.apache.jackrabbit.core.security.simple.SimpleAccessManager.checkPermission(SimpleAccessManager.java:140)
	at org.apache.jackrabbit.core.ItemValidator.checkCondition(ItemValidator.java:293)
	at org.apache.jackrabbit.core.ItemValidator.checkModify(ItemValidator.java:248)
	at org.apache.jackrabbit.core.VersionManagerImpl.getNodeState(VersionManagerImpl.java:633)
	at org.apache.jackrabbit.core.VersionManagerImpl.getNodeState(VersionManagerImpl.java:618)
	at org.apache.jackrabbit.core.VersionManagerImpl.access$000(VersionManagerImpl.java:72)
	at org.apache.jackrabbit.core.VersionManagerImpl$2.perform(VersionManagerImpl.java:137)
	at org.apache.jackrabbit.core.VersionManagerImpl$2.perform(VersionManagerImpl.java:134)
	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
	at org.apache.jackrabbit.core.VersionManagerImpl.perform(VersionManagerImpl.java:95)
	at org.apache.jackrabbit.core.VersionManagerImpl.checkout(VersionManagerImpl.java:134)
	at com.calenco.storage.dao.ContentDAO.store(ContentDAO.java:174)

(174 is the line of the vm.checkout() call)

and this is a stack trace from the 2nd case, where the file doesn't exist yet:

javax.jcr.AccessDeniedException: Access denied
	at org.apache.jackrabbit.core.security.simple.SimpleAccessManager.checkPermission(SimpleAccessManager.java:140)
	at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1266)
	at org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:111)
	at org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:37)
	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
	at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
	at org.apache.jackrabbit.core.NodeImpl.addNodeWithUuid(NodeImpl.java:1783)
	at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1743)
	at com.calenco.storage.dao.ContentDAO.store(ContentDAO.java:176)

(176 is the line of the session.getNode(path).addNode() call)

-- 
Fabián Mandelbaum
IS Engineer

Mime
View raw message