Topic
  • 2 replies
  • Latest Post - ‏2013-07-04T11:04:16Z by Billy Murphy
anuragkalra
anuragkalra
3 Posts

Pinned topic Problem in getting children of Folder entity

‏2012-07-25T10:28:05Z |
Hi,

We are trying to crawl the children under a Folder entity in WCM 7.0. I created the object of Folder using WebContentLibraryService.
But am facing some issues. Basically what I did was:

Identity documentIdFolder = workspaceObj.createDocumentId(strDocumentId);

Folder folderObject = webContentLibraryService.getFolderById(workspaceObj, documentIdFolder);

ResultIterator res = folderObject.getChildren();

Now the getChildrent seems to work fine. We get the ResultIterator object and the res.size() works fine too. But when I try to iterate it,
we get Exception on res.next(). Funny thing is that it returns 1 child though.

Exception is: java.lang.IllegalStateException: com.ibm.icm.jcr.InvalidTicketException: This ticket has been marked invalid due to a prior logout or other failure. Please login again to obtain a new instance.

Can someone help us with this. Why this exception is happening? Is there some workaround for it?

Thanks,

Anurag
Updated on 2012-07-25T10:29:11Z at 2012-07-25T10:29:11Z by anuragkalra
  • anuragkalra
    anuragkalra
    3 Posts

    Re: Problem in getting children of Folder entity

    ‏2012-07-25T10:29:11Z  
    Here is the sample code that we are using to Iterate res:

    while (res.hasNext()){

    try {

    Item item = (Item)res.next();

    _logger.debug("item.getName(): " + item.getName());

    } catch (Exception e){

    _logger.debug(e.toString());

    }

    For example if the Folder has 5 documents or subfolders. We will get 4 exceptions first and in the end 1 document’s name will be printed. There is nothing special with that document J. Full exception message is:

    >>

    java.lang.IllegalStateException: com.ibm.icm.jcr.InvalidTicketException: This ticket has been marked invalid due to a prior logout or other failure. Please login again to obtain a new instance.

    at com.ibm.icm.jcr.WorkspaceImpl.getNodeTypeManager(WorkspaceImpl.java:2311)

    at com.ibm.icm.jcr.NodeImpl.getNodeType(NodeImpl.java:1342)

    at com.ibm.workplace.wcm.domain.transformers.TransformerUtils.getWCMClassForNode(TransformerUtils.java:590)

    at com.ibm.workplace.wcm.domain.transformers.TransformerUtils.transformNode(TransformerUtils.java:1782)

    at com.ibm.workplace.wcm.services.query.TransformingIterator.prefetchNode(TransformingIterator.java:170)

    at com.ibm.workplace.wcm.services.query.TransformingIterator.prefetchQueryResult(TransformingIterator.java:133)

    at com.ibm.workplace.wcm.services.query.TransformingIterator.prefetch(TransformingIterator.java:99)

    at com.ibm.workplace.wcm.services.query.TransformingIterator.next(TransformingIterator.java:239)

    at com.ibm.workplace.wcm.services.query.ResultIteratorImpl.next(ResultIteratorImpl.java:66)

    at com.ibm.workplace.wcm.api.query.WCM_ResultIterator.next(WCM_ResultIterator.java:61)

    at com.persistentsys.enconnect.ecsc.websphere.servlet.PortalDataAccess.getChildrenAssociation(PortalDataAccess.java:372)

    at com.persistentsys.enconnect.ecsc.websphere.servlet.PortalDataServlet.service(Unknown Source)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:937)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)

    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)

    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)

    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)

    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)

    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)

    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)

    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)

    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)

    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)

    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)

    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)

    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)

    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)

    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)

    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)

    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)

    Caused by:

    com.ibm.icm.jcr.InvalidTicketException: This ticket has been marked invalid due to a prior logout or other failure. Please login again to obtain a new instance.

    at com.ibm.icm.jcr.TicketImpl.checkValid(TicketImpl.java:331)

    at com.ibm.icm.jcr.TicketImpl.getNodeTypeManager(TicketImpl.java:726)

    at com.ibm.icm.jcr.WorkspaceImpl.getNodeTypeManager(WorkspaceImpl.java:2308)

    ... 33 more

    <<
    We are running this code in Plain java file in a WAR deployed on WebSphere portal.
    Even if we remove the class cast (Item)res.next(), even then we get the error.

    Thanks,
  • Billy Murphy
    Billy Murphy
    1 Post

    Re: Problem in getting children of Folder entity

    ‏2013-07-04T11:04:16Z  
    Here is the sample code that we are using to Iterate res:

    while (res.hasNext()){

    try {

    Item item = (Item)res.next();

    _logger.debug("item.getName(): " + item.getName());

    } catch (Exception e){

    _logger.debug(e.toString());

    }

    For example if the Folder has 5 documents or subfolders. We will get 4 exceptions first and in the end 1 document’s name will be printed. There is nothing special with that document J. Full exception message is:

    >>

    java.lang.IllegalStateException: com.ibm.icm.jcr.InvalidTicketException: This ticket has been marked invalid due to a prior logout or other failure. Please login again to obtain a new instance.

    at com.ibm.icm.jcr.WorkspaceImpl.getNodeTypeManager(WorkspaceImpl.java:2311)

    at com.ibm.icm.jcr.NodeImpl.getNodeType(NodeImpl.java:1342)

    at com.ibm.workplace.wcm.domain.transformers.TransformerUtils.getWCMClassForNode(TransformerUtils.java:590)

    at com.ibm.workplace.wcm.domain.transformers.TransformerUtils.transformNode(TransformerUtils.java:1782)

    at com.ibm.workplace.wcm.services.query.TransformingIterator.prefetchNode(TransformingIterator.java:170)

    at com.ibm.workplace.wcm.services.query.TransformingIterator.prefetchQueryResult(TransformingIterator.java:133)

    at com.ibm.workplace.wcm.services.query.TransformingIterator.prefetch(TransformingIterator.java:99)

    at com.ibm.workplace.wcm.services.query.TransformingIterator.next(TransformingIterator.java:239)

    at com.ibm.workplace.wcm.services.query.ResultIteratorImpl.next(ResultIteratorImpl.java:66)

    at com.ibm.workplace.wcm.api.query.WCM_ResultIterator.next(WCM_ResultIterator.java:61)

    at com.persistentsys.enconnect.ecsc.websphere.servlet.PortalDataAccess.getChildrenAssociation(PortalDataAccess.java:372)

    at com.persistentsys.enconnect.ecsc.websphere.servlet.PortalDataServlet.service(Unknown Source)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:937)

    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)

    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)

    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)

    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)

    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)

    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)

    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)

    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)

    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)

    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)

    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)

    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)

    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)

    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)

    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)

    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)

    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)

    Caused by:

    com.ibm.icm.jcr.InvalidTicketException: This ticket has been marked invalid due to a prior logout or other failure. Please login again to obtain a new instance.

    at com.ibm.icm.jcr.TicketImpl.checkValid(TicketImpl.java:331)

    at com.ibm.icm.jcr.TicketImpl.getNodeTypeManager(TicketImpl.java:726)

    at com.ibm.icm.jcr.WorkspaceImpl.getNodeTypeManager(WorkspaceImpl.java:2308)

    ... 33 more

    <<
    We are running this code in Plain java file in a WAR deployed on WebSphere portal.
    Even if we remove the class cast (Item)res.next(), even then we get the error.

    Thanks,

    Hi Anurag,

    This happens because your application is managing the workspace, but before we see the issue there is a logout and login. Also because the query service performs a login and logout so that workspace is not logged in when the user servlet tries to make the call.

    Check your code for something like;
    Workspace().logout();
    Workspace().login();
     

    To resolve it is necessary to login to the workspace after executing the query. You should expect your code to look something like;
    try   
    {   
    // Perform Login   
    Workspace.login()   
        
    // Call WCM API method for current request   
    ...   
    }  
    .  
    finally   
    {   
    // Perform logout   
    Workspace.logout()   
    }

     

    Good luck with it.

    Billy