Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-7170

don't allow method invokes on core session without a transaction

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.4.2
    • Fix Version/s: 5.5
    • Component/s: None
    • Upgrade notes:
      Hide

      When application is invoking a core session without a transaction active, the system is warning you with the following message :

      "Session invoked in a container without a transaction active"

      If the warn occurs in the processing of a web request, that means that you've forgot to configure the request controller for injecting the transactional context. Looks at the following snip-set that show you how contributing to the request controller for this.

      <extension target="org.nuxeo.ecm.platform.web.common.requestcontroller.service.RequestControllerService"
      point="filterConfig">

      <filterConfig name="MyFilterConfig" transactional="true">
      <pattern>${org.nuxeo.ecm.contextPath}/<my-pattern></pattern>
      </filterConfig>
      </extension>

      In the other cases, you should manage the transaction demarcation in your own code. Here is a snip-set that can help you for doing this job.

      TransactionHelper.startTransaction();
      try

      { .... }

      catch (Throwable e)

      { TransactionHelper.setTransactionRollbackOnly(); }

      finally

      { TransactionHelper.commitOrRollbackTransaction(); }
      Show
      When application is invoking a core session without a transaction active, the system is warning you with the following message : "Session invoked in a container without a transaction active" If the warn occurs in the processing of a web request, that means that you've forgot to configure the request controller for injecting the transactional context. Looks at the following snip-set that show you how contributing to the request controller for this. <extension target="org.nuxeo.ecm.platform.web.common.requestcontroller.service.RequestControllerService" point="filterConfig"> <filterConfig name="MyFilterConfig" transactional="true"> <pattern>${org.nuxeo.ecm.contextPath}/<my-pattern></pattern> </filterConfig> </extension> In the other cases, you should manage the transaction demarcation in your own code. Here is a snip-set that can help you for doing this job. TransactionHelper.startTransaction(); try { .... } catch (Throwable e) { TransactionHelper.setTransactionRollbackOnly(); } finally { TransactionHelper.commitOrRollbackTransaction(); }

      Description

      In tomcat, at this time, we allow the use of the session without a transaction activation active. We suspect this being the root cause
      of another problems such as SQL server locked on a single transaction.

      We're going to forbid that kind of access by detecting the condition and throwing a runtime exception in the org.nuxeo.ecm.core.api.TransactionalCoreSessionWrapper.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: