cancel
Showing results for 
Search instead for 
Did you mean: 

JCR - Log in a system generates a thread/session error

cdn_alfresco_de
Champ in-the-making
Champ in-the-making
We are getting a RepositoryException with our application.  We have a submission that is created with a stand alone java application client (basically a zip file).  The code below takes the zip and extracts it into the Alfresco repository. 

The create dossier function is run by our submission administrator under their account name.  In order to have the sufficient permissions to do all the functions required in the create dossier, the code logs in to the system account using jcr credentials( adminSession = helper.getJcrSession())

We are getting an intermittent problem where the create dossier process throws an exception "Only one active session is allowed per thread." 

We have not been able to determine what the cause of the exception is. We have tried removing the code related to logging in as system and it appears to have resolved the issue. We are not sure why it was required to log in as system. This creates and auditing problem as well since all the dossiers/folders/files are created with system as owner/modifier so we lose the ability to track who submitted what.

We are concerned about releasing this to production since we have not been able to say for certain that this problem won't manifest itself elsewhere. We would like to determine the root cause of the exception to be more confident in our fix.

Does anyone have any insight as to why we might get this exception when switching to the system account? Are there other process in alfresco that would be running as system by default as well? (i.e. something like lucene..  do you know how to determine what credentials lucene runs under?)

package ca.gc.hc.nhpd.action.executer;

import java.io.InputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.transaction.UserTransaction;

import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionServiceException;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.lock.NodeLockedException;
import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.OwnableService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import ca.gc.hc.nhpd.domain.SubmissionAttachments;
import ca.gc.hc.nhpd.domain.factory.NodeFactory;
import ca.gc.hc.nhpd.repo.NhpolsModel;
import ca.gc.hc.nhpd.repo.RepositoryHelper;
import ca.gc.hc.nhpd.repo.structure.StructureHelper;
import ca.gc.hc.nhpd.repo.structure.patch.BasePatch;
import ca.gc.hc.nhpd.repo.workflow.WorkflowHelper;
import ca.gc.hc.nhpd.service.DossierService;
import ca.gc.hc.nhpd.service.InfrastructureUpdateService;
import ca.gc.hc.nhpd.submissionbuilder.domain.Submission;
import ca.gc.hc.nhpd.submissionbuilder.domain.factory.SimpleSubmissionFactory;

/*******************************************************************************
* This implements the functionality of the CreateDossierAction. This action
* creates a new space in the Holding Area space using the Submission Dossier
* template, then distributes (moves) the contents of the current space
* into its sub-spaces. The new Dossier also assigned a new tracking number.
*/
public class CreateDossierActionExecuter extends ActionExecuterAbstractBase {
    //TODO the workflow name is dependant on the type of submission:
    public static final String MAIN_WORKFLOW_NAME =
                               "nhpolswf:compendialWorkflow";
    public static final String NAME = "createDossier";
    private static final String ARCHIVE_EXTENSION = ".hcs";
    private static final String ARCHIVE_FILTER = ".*\\" + ARCHIVE_EXTENSION
                                + "$";
    private static final Log LOG = LogFactory.getLog(
                                   CreateDossierActionExecuter.class);
    private static final String PRIMARY_FORM_EXTENSION = ".pdf";
    private static final String PRIMARY_FORM_FILTER = ".*\\"
                                + PRIMARY_FORM_EXTENSION + "$";
    private static final String SUBMISSION_XML_FILE_NAME = "submission.xml";
    private static final String SUBMISSION_HTML_FILE_NAME = "submission.html";
    private static final String SUBMISSION_BARCODE_FILE_NAME_EXTENSION = "*.tif";
    private ExtractMetadataActionExecuter extractMetadataActionExecuter;

    /***************************************************************************
     * @see org.alfresco.repo.action.ParameterizedItemAbstractBase
     *      #addParameterDefinitions(java.util.List)
     */
    @Override
    protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
        // none required
    }

    /***************************************************************************
     * Implements the core of the action.
     * @see org.alfresco.repo.action.executer.ActionExecuter#execute(
     *          org.alfresco.repo.ref.NodeRef, org.alfresco.repo.ref.NodeRef)
     */
    @Override
    public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) {
        long startTime = System.currentTimeMillis();
        RepositoryHelper repositoryHelper = RepositoryHelper.instance();
       
        // qualified names must be compared using .equals()
        if (!NhpolsModel.TYPE_DROP_BOX.equals(repositoryHelper.getNodeService().
                                              getType(actionedUponNodeRef))) {
            throw new ActionServiceException("error.notDropBox");
        }
        List<NodeRef> archiveNodes = getSubmissionArchiveNodes(
                                     actionedUponNodeRef, repositoryHelper);
       
        if (archiveNodes == null) {
            throw new ActionServiceException("error.noSubmission");
        }
        for (NodeRef archiveRef : archiveNodes) {
            processSubmissionArchive(archiveRef, actionedUponNodeRef,
                                     repositoryHelper);
        }
        LOG.warn("createDossier action executed in "
                 + (System.currentTimeMillis() - startTime) + " ms.");
     }


    /***************************************************************************
     * Processes a SubmissionBuilder archive that was found in the DropBox. This
     * unzips it, creates a dossier from it, deletes the working folders, then
     * hooks the dossier to workflow.
     * @param archiveRef the SubmissionBuilder archive to be processed.
     * @param dropBox the DropBox that the SubmissionBuilder archive is in.
     * @param helper
     * @throws ActionServiceException if a problem occurs.
     */
    private void processSubmissionArchive(NodeRef archiveRef, NodeRef dropBox,
                 RepositoryHelper helper) throws ActionServiceException {
       
       LOG.debug("Starting process Submission Archive");
        long startTime = System.currentTimeMillis();
        RepositoryHelper repositoryHelper = RepositoryHelper.instance();
        DossierService dossierService = repositoryHelper.getDossierService();
        FileFolderService ffService = repositoryHelper.getFileFolderService();
        InfrastructureUpdateService updateService =
            repositoryHelper.getInfrastructureUpdateService();
        NodeService nodeService = repositoryHelper.getNodeService();
        PermissionService pService = repositoryHelper.getPermissionService();
        String archiveFileName = repositoryHelper.getNodeName(archiveRef);
        NodeRef dossierRef = null;
        NodeRef primaryFormRef = null;
        Session adminSession = null;
        UserTransaction transaction = helper.getTransactionService()
                                      .getUserTransaction();
        NodeRef unzippedArchive = null;
        SubmissionAttachments submissionAttachments = new SubmissionAttachments();
        NodeFactory nf = new NodeFactory();
       
        String unzippedArchiveName = archiveFileName.substring(0,
               archiveFileName.length() - ARCHIVE_EXTENSION.length());
        long updateServiceCallTime;
        WorkflowHelper workflowHelper = WorkflowHelper.instance();
        boolean barcodedEpla = false;
       
        try {        
           LOG.debug("Starting user transaction");
            transaction.begin(); //User transaction
            LOG.debug("Creating temporary folder");
            //Unzip the archive into a temporary folder
            unzippedArchive = ffService.create(dropBox, unzippedArchiveName,
                                               ContentModel.TYPE_FOLDER)
                              .getNodeRef();
            LOG.debug("Unzipping to temporary folder");
            if (StructureHelper.instance().unZip(archiveRef,
                                                 unzippedArchive, false)) {
               LOG.debug("Switching to admin account to deploy dossier");
                //Log on as the administrator to deploy the dossier
***************  adminSession = helper.getJcrSession(); ***********************This is where the code throws and exception****
                //Create a domain object that defines the submission
               LOG.debug("Creating submission domain object");
                Submission submission = createSubmission(unzippedArchive,
                                           repositoryHelper, submissionAttachments);
                //Create the dossier and locate the primary form
                LOG.debug("Locating primary form (pla)");
                primaryFormRef = getPrimaryFormNode(unzippedArchive, nodeService);
                LOG.debug("Extracting the metadata");
                extractMetaData(primaryFormRef, repositoryHelper);
               
                LOG.debug("Creating the dossier");
                dossierRef = dossierService.createDossier(primaryFormRef);
                LOG.debug("Distributing the attachments");
                dossierService.distributeAttachments(submission,
                               unzippedArchive, dossierRef, repositoryHelper, nf);
                LOG.debug("Moving the submission node to the proper folder");
                moveSubmissionArchiveNode(archiveRef, dossierRef,
                                          repositoryHelper, submissionAttachments, nf);            
               
                //workflowHelper.addToWorkflow(primaryFormRef, MAIN_WORKFLOW_NAME,
                //        repositoryHelper.getNodeName(dossierRef), true);
                //Do this last since it can't be rolled back if something else
                //goes wrong:
                updateServiceCallTime = System.currentTimeMillis();
                LOG.debug("Calling the integration service");
                //Infrastructure Update Service - NHPSAS
                updateService.updateFromDocument(primaryFormRef);
                LOG.warn("updateService responded in "
                        + (System.currentTimeMillis() - updateServiceCallTime)
                        + " ms.");
                long commitTime = System.currentTimeMillis();
                LOG.debug("Comitting user transaction");
                transaction.commit(); //User transaction
                LOG.warn("Commit took "
                        + (System.currentTimeMillis() - commitTime) + " ms.");
               
                 
                //Adjust permissions for the original tif and epla so only
                //System Administrators can have collaborator access
               
                //if there is a tiff attachment, then do not allow general users
                //to see the ePLA
                //ITS #9153
                if ((submissionAttachments.getSubmissionTIFRef() != null) &&
                      (submissionAttachments.getSubmissionTIFRef().size() > 0)) {
                   
                    LOG.debug("Adjusting permissions on the primary form to coordinator" +
                          "so only System Administrators can see it");
                    nf.adjustNodePermissions(primaryFormRef, repositoryHelper,
                          pService.COORDINATOR, NhpolsModel.LNAME_SYS_ADMIN,
                          false, true);
                } else {
                   LOG.debug("Adjusting permissions on the primary form to coordinator");
                    nf.adjustNodePermissions(primaryFormRef, repositoryHelper,
                          pService.COORDINATOR, NhpolsModel.LNAME_SYS_ADMIN,
                          false, false);
                   
                    LOG.debug("Adjusting permissions on the primary form to consumer");
                    nf.adjustNodePermissions(primaryFormRef, repositoryHelper,
                          pService.CONSUMER, NhpolsModel.LNAME_SUBMISSION_ADMIN_OFFICERS,
                          false, true); 
                                  
                }
                
                LOG.debug("Saving admin session");
                adminSession.save(); //Commits the administrator transaction
            }
            LOG.warn("dossier created in "
                     + (System.currentTimeMillis() - startTime) + " ms.");

        } catch (ActionServiceException e1) {
            try {
                transaction.rollback(); //User transaction

            } catch (Exception e2) {
                //Nothing to do here
            }
            throw e1;

        } catch (FileExistsException fee) {
            try {
                transaction.rollback(); //User transaction

            } catch (Exception e2) {
                //Nothing to do here
            }
            throw new ActionServiceException("error.fileExists", new Object[]{archiveFileName});
           
        } catch (NodeLockedException nle) {
            try {
                transaction.rollback(); //User transaction

            } catch (Exception e2) {
                //Nothing to do here
            }
            throw new ActionServiceException("error.lockedNode", new Object[]{archiveFileName});
           
        } catch (Exception e2) {
            try {
                transaction.rollback(); //User transaction

            } catch (Exception e3) {
                //Nothing to do here
            }
            throw new ActionServiceException("error.critical", e2);

        } finally {
            if (adminSession != null) {
                //Rolls back any administrator transactions not already saved
                adminSession.logout();
            }
            if (unzippedArchive != null
                && nodeService.exists(unzippedArchive)) {
                nodeService.deleteNode(unzippedArchive);
            }
        }
     }

    /***************************************************************************
     * Should only be called by Swing injection in nhpols-action-context.xml.
     */
    public void setExtractMetadataActionExecuter(
                ExtractMetadataActionExecuter anActionExecuter) {
        extractMetadataActionExecuter = anActionExecuter;
    }

    /***************************************************************************
     * Creates a submission definition from the passed submission archive.
     * @param unzippedSubmissionRef a reference to the unzipped submission
     *        archive node.
     * @param helper
     * @return an object that defines the submission contents.
     * @throws ActionServiceException if a problem occurs or it isn't found.
     */
    private Submission createSubmission(NodeRef unzippedSubmissionRef,
                       RepositoryHelper helper,
                       SubmissionAttachments submissionAttachments) throws ActionServiceException {
       
        ContentService contentService = helper.getContentService();
        QName submissionXmlQName = QName.createQName(
                NamespaceService.CONTENT_MODEL_1_0_URI,
                QName.createValidLocalName(SUBMISSION_XML_FILE_NAME));
        QName submissionHTMLQName = QName.createQName(
                NamespaceService.CONTENT_MODEL_1_0_URI,
                QName.createValidLocalName(SUBMISSION_HTML_FILE_NAME));
       
        InputStream inStream = null;
       
        try {
            NodeRef submissionXmlRef = helper.getChildByQName(
                    unzippedSubmissionRef, ContentModel.ASSOC_CONTAINS,
                    submissionXmlQName);
            submissionAttachments.setSubmissionHTMLRef(helper.getChildByQName(
                    unzippedSubmissionRef, ContentModel.ASSOC_CONTAINS,
                    submissionHTMLQName));
           
            FileFolderService ffs = helper.getFileFolderService();
                              
            for (FileInfo fi:ffs.search(unzippedSubmissionRef,
                  SUBMISSION_BARCODE_FILE_NAME_EXTENSION,
                  true,false,false)) {    
               submissionAttachments.addSubmissionTIFRef(fi.getNodeRef());
            }
                  
            if (submissionXmlRef != null) {
                ContentReader reader = contentService.getReader(submissionXmlRef,
                                       ContentModel.PROP_CONTENT);
                if (reader != null) {
                    inStream = reader.getContentInputStream();
                    
                    return SimpleSubmissionFactory.instance()
                             .createSubmissionFromXml(inStream);
               
                } else { // Should never happen
                    LOG.error("Submission XML file is not really a file.");
                } 
               
            } else { // Should never happen
                LOG.error("Submission XML file not found in the submission archive.");
            }

        } catch (Exception e) {
            throw new ActionServiceException("error.critical", e);
        } finally {
           try { // IMSD #10317 - File handle leak
            if(inStream != null) inStream.close();
         } catch (Exception e) {
            LOG.warn("Could not close submission input stream properly", e);
         }
        }
       
        throw new ActionServiceException("error.critical");
     }

    /***************************************************************************
     * Extracts the metadata from the passed form and populates the node with it.
     * @param formRef
     * @param helper
     * @throws Exception if a problem occurs.
     */
    private void extractMetaData(NodeRef formRef, RepositoryHelper helper)
                                 throws Exception {
        Map<String, Serializable> parameters =
                                  new HashMap<String, Serializable>();
       
        Action action = helper.getActionService().createAction(
                        ExtractMetadataActionExecuter.NAME, parameters);

        extractMetadataActionExecuter.execute(action, formRef);
     }

    /***************************************************************************
     * Gets the primary form node found in the passed folder.
     * @param unzippedArchiveRef the folder that the submission archive was
     *        unzipped into.
     * @param nodeService
     * @return a reference to the primary form node.
     * @throws ActionServiceException if a problem occurs, if it isn't found, or
     *         if there's more than one.
     */
    private NodeRef getPrimaryFormNode(NodeRef unzippedArchiveRef,
                    NodeService nodeService) throws ActionServiceException {
        RegexQNamePattern regExpression = new RegexQNamePattern(
                                              PRIMARY_FORM_FILTER);
        Collection<ChildAssociationRef> assocRefs = nodeService.getChildAssocs(
                unzippedArchiveRef, ContentModel.ASSOC_CONTAINS,
                regExpression);

        if (assocRefs != null && !assocRefs.isEmpty()) {
            if (assocRefs.size() == 1) {
                NodeRef plaNodeRef = assocRefs.iterator().next().getChildRef();
                nodeService.setType(plaNodeRef, NhpolsModel.TYPE_PLA);
                return plaNodeRef;
            }
            throw new ActionServiceException("error.multipleSubmissions");
        }
        throw new ActionServiceException("error.noSubmission");
     }

    /***************************************************************************
     * Gets the submission archive node(s) found in the passed folder.
     * @param sourceFolderRef the folder that is being worked on.
     * @param helper
     * @return a list of references to the submission archive nodes. Null if
     *         there aren't any.
     */
    private List<NodeRef> getSubmissionArchiveNodes(NodeRef sourceFolderRef,
            RepositoryHelper helper) throws ActionServiceException {
        NodeService nodeService = helper.getNodeService();
        RegexQNamePattern regExpression = new RegexQNamePattern(
                                              ARCHIVE_FILTER);
        Collection<ChildAssociationRef> assocRefs = nodeService.getChildAssocs(
                sourceFolderRef, ContentModel.ASSOC_CONTAINS, regExpression);

        if (assocRefs != null && !assocRefs.isEmpty()) {
            ArrayList<NodeRef> archiveNodes = new ArrayList<NodeRef>();
           
            for (ChildAssociationRef assocRef : assocRefs) {
                archiveNodes.add(assocRef.getChildRef());   
            }
            return archiveNodes;
        }
        return null;
    }

    /***************************************************************************
     * Assigns the submission archive node a category, then moves it into the
     * original submission folder in the dossier, makes it versionable, and
     * changes the archive node's owner to admin so that it will be read-only
     * (Alfresco will make it and the folder read-write if it contains a
     * document owned by the user).
     * @param archiveRef the submission archive.
     * @param dossierRef the dossier.
     * @param helper
     * @throws ActionServiceException if a problem occurs.
     * @throws RepositoryException if a problem occurs.
     */
    private void moveSubmissionArchiveNode(NodeRef archiveRef,
                 NodeRef dossierRef, RepositoryHelper helper,
                 SubmissionAttachments submissionAttachments,
                 NodeFactory nf)
                 throws ActionServiceException, RepositoryException {
        DossierService dossierService = helper.getDossierService();
        OwnableService ownableService = helper.getOwnableService();
        PermissionService pService = helper.getPermissionService();
        NodeRef originalSubmissionFolder = dossierService.getDossierSubFolder(
                dossierRef, BasePatch.PLA_DOSSIER_ORIGINAL_SUBMISSION_FOLDER_KEY);
       
        helper.assignCategoryToNode(archiveRef,
                                    NhpolsModel.NAME_ORIGINAL_SUBMISSION);
        helper.moveNode(archiveRef, originalSubmissionFolder);
        LOG.debug("Setting permissions and owner on the archived hcs file");
        nf.adjustNodePermissions(archiveRef,
            helper, pService.CONSUMER,
            NhpolsModel.LNAME_NHPOLS_USERS , false, true);
       
        if (submissionAttachments.getSubmissionHTMLRef() != null) {
           LOG.debug("Setting permissions and owner on the HTML Reference Attachment");
           NodeRef subHTMLRef = submissionAttachments.getSubmissionHTMLRef();
            helper.moveNode(subHTMLRef, originalSubmissionFolder);
           
            nf.adjustNodePermissions(subHTMLRef,
                helper, pService.CONSUMER,
                NhpolsModel.LNAME_NHPOLS_USERS , false, true);
        }
       
        if (submissionAttachments.getSubmissionTIFRef() != null) {
           LOG.debug("Setting permissions and owner on the Submission Tif Attachments: Barcoded epla");
           for (NodeRef submissionAttachmentNR:submissionAttachments.getSubmissionTIFRef()) {
              helper.moveNode(submissionAttachmentNR, dossierRef);
              nf.adjustNodePermissions(submissionAttachmentNR,
                    helper, pService.CONSUMER,
                    NhpolsModel.LNAME_NHPOLS_USERS , false, true);
           }
        }
    }
}





2013-05-01 10:16:20.072 ERROR [org.alfresco.web.ui.common.Utils] A critical Error has occured
org.alfresco.service.cmr.action.ActionServiceException: A critical Error has occured
   at ca.gc.hc.nhpd.action.executer.CreateDossierActionExecuter.processSubmissionArchive(Unknown Source)
   at ca.gc.hc.nhpd.action.executer.CreateDossierActionExecuter.executeImpl(Unknown Source)
   at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:120)
   at ca.gc.hc.nhpd.web.bean.actions.ActionJsfHandler.createDossier(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:618)
   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
   at javax.faces.component.UICommand.broadcast(UICommand.java:89)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
   at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1087)
   at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
   at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
   at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
   at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
   at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:840)
   at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:683)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:589)
   at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:489)
   at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
   at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:748)
   at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
   at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:122)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
   at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
   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:136)
   at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
   at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
   at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
   at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)
Caused by: javax.jcr.RepositoryException: Only one active session is allowed per thread.
   at org.alfresco.jcr.repository.RepositoryImpl.registerSession(RepositoryImpl.java:300)
   at org.alfresco.jcr.repository.RepositoryImpl.login(RepositoryImpl.java:231)
   at org.alfresco.jcr.repository.RepositoryImpl.login(RepositoryImpl.java:246)
   at ca.gc.hc.nhpd.repo.RepositoryHelper.getJcrSession(Unknown Source)
   … 42 more


Thank you,
Bruce Dempsey
Programmer Analyst / Programmeur-analyste
Solutions Centre / Centre des solutions
Corporate Services Branch / Direction générale des services de gestion
Public Health Agency of Canada / Agence de la santé publique du Canada
Information Management Services Branch / Direction des services de gestion de l'information
Health Canada / Santé Canada
Tel. (613) 796-4612
Fax (613) 946-1117
AL: 2801G
1 REPLY 1

mrogers
Star Contributor
Star Contributor
The error messaage is clear,  only one JCR session is allowed per thread.

The issue is why are more than one sessions per thread being created.    However it doesn't look like that JCR session is actually used.