I'm trying to add ACL pragmatically. I've added jackrabbit-standalone-2.6.3.jar in classpath, and I'm using CQ 5.6
Code:
Repository repository = JcrUtils.getRepository("http://11.11.11.64:4502/crx/server");
Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()),"crx.default");
AccessControlManager aMgr = session.getAccessControlManager(); // Error is coming from here
Error: Exception in thread "main" javax.jcr.UnsupportedRepositoryOperationException: JCR-1104
at org.apache.jackrabbit.jcr2spi.SessionImpl.getAccessControlManager(SessionImpl.java:501)
Repository.xml :
<Security appName="com.day.crx">
<SecurityManager class="com.day.crx.core.CRXSecurityManager">
<UserManager class="com.day.crx.core.CRXUserManagerImpl">
<param name="usersPath" value="/home/users"/>
<param name="groupsPath" value="/home/groups"/>
<param name="defaultDepth" value="1"/>
<param name="autoExpandTree" value="true"/>
</UserManager>
</SecurityManager>
<AccessManager class="org.apache.jackrabbit.core.security.DefaultAccessManager"></AccessManager>
<LoginModule class="com.day.crx.core.CRXLoginModule">
<param name="anonymousId" value="anonymous"/>
<param name="adminId" value="admin"/>
<param name="tokenExpiration" value="43200000"/>
<!-- param name="trust_credentials_attribute" value="d5b9167e95dad6e7d3b5d6fa8df48af8"/ -->
</LoginModule>
</Security>
I found the exact same issue here: http://mail-archives.apache.org/mod_mbox/jackrabbit-users/201307.mbox/%3CDD9A8DB7-3D84-464F-A14F-75D...krabbit-users/201307.mbox/%3CDD9A8DB7-3D84-464F-A14F-75DFAAAE570B@adobe.com%3E
but could not find any solution. Please advice.
Solved! Go to Solution.
Views
Replies
Total Likes
A number of operations are not supported when you connect via RMI or DAVEX. Setting ACLs might be one of these.
Jörg
Views
Replies
Total Likes
You are trying to create this object from a standalone Java app. Try creating this object from within an OSGi bunlde. For example:
//Inject a Sling ResourceResolverFactory
@Reference
private ResourceResolverFactory resolverFactory;
//Queries the AEM JCR for customer data and returns
//the data within an XML schema
public String getCustomerData(String filter) {
Customer cust = null;
List<Customer> custList = new ArrayList<Customer>();
try {
//Invoke the adaptTo method to create a Session
ResourceResolver resourceResolver = resolverFactory.getAdministrativeResourceResolver(null);
session = resourceResolver.adaptTo(Session.class);
//Create an AccessControlManager instance
AccessControlManager aMgr = session.getAccessControlManager();
TO learn how to work with the JCR API from within a CQ OSGi bundle, see this community article.
http://helpx.adobe.com/experience-manager/using/querying-experience-manager-data-using1.html
Hope this helps
Views
Replies
Total Likes
Thanks Sam, is it really not possible to apply ACL from standalone java code?
Views
Replies
Total Likes
A number of operations are not supported when you connect via RMI or DAVEX. Setting ACLs might be one of these.
Jörg
Views
Replies
Total Likes
I confirmed that the code does not run from a standalone Java app -- I got the same exception.
Views
Replies
Total Likes
Thanks Sam and Jorg for your help!
Views
Replies
Total Likes