Persistance Error creating new Group from UserManager (ResourcerResolver.commit())
I have a service I call on to create a new approver group for a user if it doesn't already exist, here's the whole method:
public void updateApproverGroup(Author person) { try { Map<String, Object> param = new HashMap<String, Object>(); param.put(ResourceResolverFactory.SUBSERVICE, "WriteService"); ResourceResolver resourceResolver = resolverFactory.getServiceResourceResolver(param); log.info(resourceResolver.getUserID()); session = resourceResolver.adaptTo(Session.class); userManager = resourceResolver.adaptTo(UserManager.class); String groupName = person.id + "Approvers"; //does the group exist? Group group = (Group) userManager.getAuthorizable(groupName); if(group == null) { //create the group group = userManager.createGroup(groupName,new SimplePrincipal(groupName),"/home/groups/news"); log.error(group.getPath()); } resourceResolver.commit(); } catch (Exception e) { log.error(e.getMessage()); for(int i = 0; i < e.getStackTrace().length; i++) { log.error(e.getStackTrace()[i].toString()); } return; } }My catch block catches an exception, here's the first few lines from my console
30.09.2015 09:17:30.342 *INFO* [0:0:0:0:0:0:0:1 [1443619050214] POST /content/news/stories/200005.request HTTP/1.1] com.uc.news.PersonServiceImpl writeuser 30.09.2015 09:17:30.347 *ERROR* [0:0:0:0:0:0:0:1 [1443619050214] POST /content/news/stories/200005.request HTTP/1.1] com.uc.news.PersonServiceImpl /home/groups/news/TrloE9Ztv_oj1nzsxYfU 30.09.2015 09:17:30.350 *ERROR* [0:0:0:0:0:0:0:1 [1443619050214] POST /content/news/stories/200005.request HTTP/1.1] com.uc.news.PersonServiceImpl Unable to commit changes to session. 30.09.2015 09:17:30.351 *ERROR* [0:0:0:0:0:0:0:1 [1443619050214] POST /content/news/stories/200005.request HTTP/1.1] com.uc.news.PersonServiceImpl org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:638) 30.09.2015 09:17:30.351 *ERROR* [0:0:0:0:0:0:0:1 [1443619050214] POST /content/news/stories/200005.request HTTP/1.1] com.uc.news.PersonServiceImpl org.apache.sling.resourceresolver.impl.helper.ResourceResolverContext.commit(ResourceResolverContext.java:181) 30.09.2015 09:17:30.351 *ERROR* [0:0:0:0:0:0:0:1 [1443619050214] POST /content/news/stories/200005.request HTTP/1.1] com.uc.news.PersonServiceImpl org.apache.sling.resourceresolver.impl.ResourceResolverImpl.commit(ResourceResolverImpl.java:1147) 30.09.2015 09:17:30.351 *ERROR* [0:0:0:0:0:0:0:1 [1443619050214] POST /content/news/stories/200005.request HTTP/1.1] com.uc.news.PersonServiceImpl com.uc.news.PersonServiceImpl.updateApproverGroup(PersonServiceImpl.java:205)
writeuser has full rights for the entire repository, so it doesn't seem like a permissions issue.
The group that it puts in the console at the second line isn't showing up in the repo either (as expected).
I've also tried creating the usermanager from a jackrabbitsession I adapted from the resource resolver, with no luck. (that method is detailed here).