This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
Hi,
I am using CQ5.6. I am using admin resolver to get session. I create nodes and then save the session using session.save(). I am creating multiple nodes in a loop. However each time when I run the code, I get session exception and code execution stops without creating all the nodes. Is it because of this admin resolver that my execution stops in between? What can be the solution?
16.09.2016 08:25:13.323 *WARN* [Finalizer] org.apache.jackrabbit.core.session.SessionState Attempt to close session-admin-1660298 while another thread is concurrently accessing this session. Blocking until the other thread is finished using this session. Please review your code to avoid concurrent use of a session. java.lang.Exception: Stack trace of concurrent access to session-admin-1660298
at org.apache.jackrabbit.core.session.SessionState.close(SessionState.java:263)
at org.apache.jackrabbit.core.SessionImpl.logout(SessionImpl.java:943)
at org.apache.jackrabbit.core.XASessionImpl.logout(XASessionImpl.java:392)
at com.day.crx.core.CRXSessionImpl.logout(CRXSessionImpl.java:127)
at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.close(JcrResourceProvider.java:226)
at org.apache.sling.resourceresolver.impl.helper.ResourceResolverContext.close(ResourceResolverContext.java:120)
at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.close(ResourceResolverImpl.java:146)
at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.finalize(ResourceResolverImpl.java:157)
Regards,
Shallu Rohilla
Solved! Go to Solution.
Views
Replies
Total Likes
Make sure you close() the session in a finally{} block, I don't see the close in your code.
Views
Replies
Total Likes
Hi,
looks like you are using a session with multiple threads. Don't do this, as it will cause all kind of weird problems.
Jörg
Views
Replies
Total Likes
Please post the code so communuty can see what is happening. Also, are you using Sling Mapping service to map system user to get a session?
Views
Replies
Total Likes
Hi,
PFB code snippet:
ResourceResolver adminResolver = resolverFactory.getAdministrativeResourceResolver(null);
Session session = adminResolver.adaptTo(Session.class)
Node node= JcrUtils.getOrCreateByPath(livePath, DamConstants.NT_SLING_ORDEREDFOLDER, session);
for(Group group : groupDetail.getGroups()){
String nodeName = StringSimplifier.simplifiedString(group .getGroupName());
Node roleNode = dataScopesecurityRoleNode.addNode(dataNodeName );
roleNode .setProperty("dataRole", group.getGroupName());
session.save();
for(GroupIDs group1 : group.getGroupIDs()){
Node childNode = roleNode .addNode(group1.getName(), "nt:unstructured");
childNode.setProperty("role", group1.getGroupName());
childNode.setProperty("id", group1.getGroupID());
session.save();
}
}
session.save();
}
Views
Replies
Total Likes
Make sure you close() the session in a finally{} block, I don't see the close in your code.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies