Uploaded image for project: 'ZZZ-WSO2 Application Server '
  1. ZZZ-WSO2 Application Server
  2. WSAS-1998

JpaServlet sample not working in tenant mode

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Highest
    • Resolution: Fixed
    • Affects Version/s: 5.3.0
    • Fix Version/s: 5.3.0
    • Component/s: None
    • Labels:
      None
    • Severity:
      Major
    • Estimated Complexity:
      Moderate
    • Test cases added:
      Yes

      Description

      Steps to reproduce,

      • Build JpaServlet sample (jpa-order-processor) in AS
      • Deploy in a tenant and try to invoke the sample through the sample ui
      • Fails with following error for tenant.

      Note : This scenario works for super tenant.

      TID: [1] [] [2015-06-30 12:07:54,529] @a.com [1] [AS] INFO

      {openjpa.Runtime} - Starting OpenJPA 2.4.0 {openjpa.Runtime}

      TID: [1] [] [2015-06-30 12:07:54,638] @a.com [1] [AS] INFO

      {openjpa.jdbc.JDBC} - Using dictionary class "org.apache.openjpa.jdbc.sql.H2Dictionary" (H2 1.4.179 (2014-06-23) ,H2 JDBC Driver 1.4.179 (2014-06-23)). {openjpa.jdbc.JDBC}

      TID: [1] [] [2015-06-30 12:07:54,656] @a.com [1] [AS] INFO

      {openjpa.jdbc.JDBC} - Connected to H2 version 1.1 using JDBC driver H2 JDBC Driver version 1.4.179 (2014-06-23). {openjpa.jdbc.JDBC}

      TID: [1] [] [2015-06-30 12:07:54,702] @a.com [1] [AS] WARN

      {Transaction} - Unexpected exception from beforeCompletion; transaction will roll back {Transaction}

      <openjpa-2.4.0-r422266:1674604 fatal general error> org.apache.openjpa.persistence.PersistenceException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred.
      at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2368)
      at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2205)
      at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2103)
      at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:2021)
      at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:527)
      at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:512)
      at org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:413)
      at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:262)
      at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252)
      at org.apache.openejb.core.transaction.JtaTransactionPolicy.completeTransaction(JtaTransactionPolicy.java:331)
      at org.apache.openejb.core.transaction.TxRequired.commit(TxRequired.java:76)
      at org.apache.openejb.core.transaction.EjbTransactionUtil.afterInvoke(EjbTransactionUtil.java:77)
      at org.apache.openejb.core.stateful.StatefulContainer.afterInvoke(StatefulContainer.java:883)
      at org.apache.openejb.core.stateful.StatefulContainer.businessMethod(StatefulContainer.java:697)
      at org.apache.openejb.core.stateful.StatefulContainer.invoke(StatefulContainer.java:376)
      at org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:308)
      at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:303)
      at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)
      at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:322)
      at com.sun.proxy.$Proxy95.addOrder(Unknown Source)
      at org.wso2.appserver.sample.ee.jpa.servlet.OrderManagerServlet.doPost(OrderManagerServlet.java:27)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.wso2.carbon.statistics.webapp.RequestIntercepterValve.invoke(RequestIntercepterValve.java:47)
      at org.wso2.carbon.bam.webapp.stat.publisher.WebAppStatisticPublisherValve.invoke(WebAppStatisticPublisherValve.java:104)
      at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
      at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
      at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:113)
      at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
      at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
      at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1739)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1698)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: <openjpa-2.4.0-r422266:1674604 fatal general error> org.apache.openjpa.persistence.PersistenceException: Table "ORDERS" not found; SQL statement:
      INSERT INTO ORDERS (id, item, quantity, timestamp) VALUES (?, ?, ?, ?) [42102-179]

      {INSERT INTO ORDERS (id, item, quantity, timestamp) VALUES (?, ?, ?, ?)} [code=42102, state=42S02]
      at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:5001)
      at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4961)
      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:133)
      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:107)
      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:59)
      at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:90)
      at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:550)
      at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:106)
      at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingConstraintUpdateManager.java:59)
      at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:104)
      at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:77)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:731)
      at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:131)
      ... 53 more
      Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Table "ORDERS" not found; SQL statement:
      INSERT INTO ORDERS (id, item, quantity, timestamp) VALUES (?, ?, ?, ?) [42102-179] {INSERT INTO ORDERS (id, item, quantity, timestamp) VALUES (?, ?, ?, ?)}

      [code=42102, state=42S02]
      at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:218)
      at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:198)
      at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$000(LoggingConnectionDecorator.java:58)
      at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection.prepareStatement(LoggingConnectionDecorator.java:250)
      at org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:133)
      at org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.prepareStatement(ConfiguringConnectionDecorator.java:139)
      at org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:133)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$RefCountConnection.prepareStatement(JDBCStoreManager.java:1642)
      at org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:122)
      at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.prepareStatement(PreparedStatementManagerImpl.java:290)
      at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(PreparedStatementManagerImpl.java:113)
      at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushAndUpdate(BatchingPreparedStatementManagerImpl.java:79)
      at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:100)
      at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:88)
      ... 60 more
      TID: [1] [] [2015-06-30 12:07:54,708] @a.com [1] [AS]ERROR

      {org.apache.catalina.core.StandardWrapperValve} - Servlet.service() for servlet [OrderManagerServlet] in context with path [/t/a.com/webapps/jpa-order-processor] threw exception {org.apache.catalina.core.StandardWrapperValve}

      javax.ejb.EJBTransactionRolledbackException: Transaction was rolled back, presumably because setRollbackOnly was called during a synchronization
      at org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:395)
      at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:326)
      at com.sun.proxy.$Proxy95.addOrder(Unknown Source)
      at org.wso2.appserver.sample.ee.jpa.servlet.OrderManagerServlet.doPost(OrderManagerServlet.java:27)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.wso2.carbon.statistics.webapp.RequestIntercepterValve.invoke(RequestIntercepterValve.java:47)
      at org.wso2.carbon.bam.webapp.stat.publisher.WebAppStatisticPublisherValve.invoke(WebAppStatisticPublisherValve.java:104)
      at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
      at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
      at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:113)
      at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
      at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
      at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1739)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1698)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: javax.transaction.RollbackException: Unable to commit: transaction marked for rollback
      at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:272)
      at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252)
      at org.apache.openejb.core.transaction.JtaTransactionPolicy.completeTransaction(JtaTransactionPolicy.java:331)
      at org.apache.openejb.core.transaction.TxRequired.commit(TxRequired.java:76)
      at org.apache.openejb.core.transaction.EjbTransactionUtil.afterInvoke(EjbTransactionUtil.java:77)
      at org.apache.openejb.core.stateful.StatefulContainer.afterInvoke(StatefulContainer.java:883)
      at org.apache.openejb.core.stateful.StatefulContainer.businessMethod(StatefulContainer.java:697)
      at org.apache.openejb.core.stateful.StatefulContainer.invoke(StatefulContainer.java:376)
      at org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:308)
      at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:303)
      at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)
      at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:322)
      ... 35 more
      Caused by: org.apache.geronimo.transaction.manager.SetRollbackOnlyException: setRollbackOnly() called. See stacktrace for origin
      at org.apache.geronimo.transaction.manager.TransactionImpl.setRollbackOnly(TransactionImpl.java:126)
      at org.apache.geronimo.transaction.manager.TransactionManagerImpl.setRollbackOnly(TransactionManagerImpl.java:243)
      at org.apache.openejb.core.TransactionSynchronizationRegistryWrapper.setRollbackOnly(TransactionSynchronizationRegistryWrapper.java:72)
      at org.apache.openjpa.ee.RegistryManagedRuntime$TransactionManagerRegistryFacade.setRollbackOnly(RegistryManagedRuntime.java:128)
      at org.apache.openjpa.ee.RegistryManagedRuntime.setRollbackOnly(RegistryManagedRuntime.java:74)
      at org.apache.openjpa.ee.AutomaticManagedRuntime.setRollbackOnly(AutomaticManagedRuntime.java:274)
      at org.apache.openjpa.kernel.BrokerImpl.setRollbackOnlyInternal(BrokerImpl.java:1672)
      at org.apache.openjpa.kernel.BrokerImpl.setRollbackOnly(BrokerImpl.java:1652)
      at org.apache.openjpa.kernel.DelegatingBroker.setRollbackOnly(DelegatingBroker.java:980)
      at org.apache.openjpa.persistence.EntityManagerImpl.setRollbackOnly(EntityManagerImpl.java:630)
      at org.apache.openjpa.persistence.PersistenceExceptions$2.translate(PersistenceExceptions.java:75)
      at org.apache.openjpa.kernel.BrokerImpl.translateManagedCompletionException(BrokerImpl.java:2091)
      at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:2025)
      at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:527)
      at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:512)
      at org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:413)
      at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:262)
      ... 46 more

        Attachments

          Activity

            People

            • Assignee:
              supunm@wso2.com Supun Malinga
              Reporter:
              supunm@wso2.com Supun Malinga
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: