Access denied for __anonim ERROR after adding JCR content in JPP 6
Issue
We store content into the JCR using the following code:
Node fileNode;
Node resNode;
if (node.hasNode(name)) {
fileNode = node.getNode(name);
resNode = fileNode.getNode("jcr:content");
} else {
fileNode = node.addNode(name, "nt:file");
fileNode.addMixin("exo:privilegeable");
resNode = fileNode.addNode("jcr:content", "nt:resource");
}
in = new FileInputStream(file);
fileNode.setProperty("exo:permissions", defaultPermission);
resNode.setProperty("jcr:mimeType", mimeType);
resNode.setProperty("jcr:encoding", "UTF-8");
resNode.setProperty("jcr:data", in);
Calendar lastModified = Calendar.getInstance();
lastModified.setTimeInMillis(file.lastModified());
resNode.setProperty("jcr:lastModified", lastModified);
saveSession();
When we try to see the new images in the portal, we can't see them in the beginning. We always get an error like:
"ERROR [exo.jcr.component.webdav.GetCommand] Access denied []:1[]media:1[]media:1[]website:1[]portal.jpg:1 for __anonim: javax.jcr.AccessDeniedException: Access denied
at org.exoplatform.services.jcr.impl.core.SessionDataManager.readItem(SessionDataManager.java:609) [exo.jcr.component.core-1.15.0-GA.jar:1.15.0-GA]".
We are accessing the image through the JCR REST service, eg: http://server:port/rest/jcr/repository/portal-system/media/media/website/portal.jpg
And it does not matter, if logged in as root or not at all. We have read-access for anonim-user, so that even anonymous users can see the portal.
After several minutes all new images are visible and we don't get the error messages any more.
Environment
- Red Hat JBoss Portal
- 6.0 GA
- 6.1 GA
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
