简体   繁体   中英

org.hibernate.exception.GenericJDBCException: Cannot open connection

I'm seeing a strange exception in our application, which combines both EJB3 and EJB2. A simple purchase request (which involves writing a couple of records to a database) is failing.

Other requests which involve database calls are working fine.

The stack trace shows the code passing through several EJBs in sequence - code extracts from these classes is shown below the stack trace.

 2015-06-17 13:58:27,552 ERROR [org.jboss.aspects.tx.TxPolicy] com.mycompany.global.er.subsmngmnt.SubsManagementException: no account found for criteria
2015-06-17 13:58:27,627 ERROR [org.jboss.aspects.tx.TxPolicy] javax.ejb.EJBTransactionRolledbackException: Cannot open connection
2015-06-17 13:58:27,628 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: public abstract com.mycompany.global.er.subsmngmnt.ejb.Account com.mycompany.global.er.subsmngmnt.ejb.AccountHome.findByPrimaryKey(java.lang.String) throws javax.ejb.FinderException,com.vizzavi.ecommerce.business.common.EcommerceException, causedBy:
org.hibernate.exception.GenericJDBCException: Cannot open connection
        at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
        at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
        at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
        at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
        at org.hibernate.loader.Loader.doQuery(Loader.java:801)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
        at org.hibernate.loader.Loader.doList(Loader.java:2533)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
        at org.hibernate.loader.Loader.list(Loader.java:2271)
        at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
        at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
        at com.mycompany.global.er.subsmngmnt.dao.oracle.AccountDaoImpl.findByCriteria(AccountDaoImpl.java:4655)
        at com.mycompany.global.er.subsmngmnt.dao.oracle.AccountDaoImpl.getUniqueERAccount(AccountDaoImpl.java:4646)
        at com.mycompany.global.er.subsmngmnt.dao.oracle.AccountDaoImpl.selectAccountUsingHibernate(AccountDaoImpl.java:4631)
        at com.mycompany.global.er.subsmngmnt.dao.oracle.AccountDaoImpl.selectAccount(AccountDaoImpl.java:894)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
        at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)
        at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)
        at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)
        at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_971644752.invoke(InvocationContextInterceptor_z_fillMethod_971644752.java)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
        at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_971644752.invoke(InvocationContextInterceptor_z_setup_971644752.java)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
        at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:219)
        at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:261)
        at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101)
        at com.sun.proxy.$Proxy305.selectAccount(Unknown Source)
        at com.mycompany.global.er.subsmngmnt.ejb.AccountBean.ejbFindByPrimaryKey(AccountBean.java:140)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.ejb.plugins.BMPPersistenceManager.callFinderMethod(BMPPersistenceManager.java:632)
        at org.jboss.ejb.plugins.BMPPersistenceManager.findEntity(BMPPersistenceManager.java:316)
        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:234)
        at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1112)
        at org.jboss.ejb.EntityContainer.find(EntityContainer.java:741)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
        at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1139)
        at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:203)
        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:187)
        at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:106)
        at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:137)
        at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:76)
        at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:45)
        at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
        at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
        at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:230)
        at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:205)
        at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:99)
        at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invokeHome(PreSecurityInterceptor.java:88)
        at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
        at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:527)
        at org.jboss.ejb.Container.invoke(Container.java:1046)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
        at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
        at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
        at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
        at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
        at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68)
        at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184)
        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
        at com.sun.proxy.$Proxy261.findByPrimaryKey(Unknown Source)
        at com.mycompany.global.er.subsmngmnt.SubscriptionManagementImpl.findAccountByPrimaryKey(SubscriptionManagementImpl.java:60)
        at com.mycompany.global.er.transctrl.bl.AccountTransaction.validateUser(AccountTransaction.java:342)
        at com.mycompany.global.er.transctrl.purchase.ejb.PurchaseBean.purchasePackageMsisdn(PurchaseBean.java:1175)
        at com.mycompany.global.er.transctrl.purchase.ejb.PurchaseBean.purchasePackage(PurchaseBean.java:3611)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
        at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:228)
        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
        at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
        at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:404)
        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
        at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
        at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
        at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
        at org.jboss.ejb.Container.invoke(Container.java:1029)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
        at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
        at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
        at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
        at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
        at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68)
        at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)
        at com.sun.proxy.$Proxy298.purchasePackage(Unknown Source)
        at com.mycompany.global.er.delegate.PurchaseApiDelegateImpl.purchasePackageMsisdn(PurchaseApiDelegateImpl.java:94)
        at com.mycompany.global.er.decoupling.process.PurchaseProcess.getResponse(PurchaseProcess.java:52)
        at com.mycompany.global.er.decoupling.process.PurchaseProcess.getResponse(PurchaseProcess.java:25)
        at com.mycompany.global.er.decoupling.AbstractProcess.process(AbstractProcess.java:126)
        at com.mycompany.global.er.decoupling.DecouplingProcessServlet.doPost(DecouplingProcessServlet.java:192)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at pk.mycompany.valves.PKAccessLogValve.invoke(PKAccessLogValve.java:547)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:744)
        Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -53ebf5fe:c4a3:55816e8f:b status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -53ebf5fe:c4a3:55816e8f:b status: ActionStatus.ABORT_ONLY >)
        at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
        at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46)
        at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
        ... 186 more
Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -53ebf5fe:c4a3:55816e8f:b status: ActionStatus.ABORT_ONLY >
        at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:370)
        at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
        at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
        at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
        ... 188 more

Here is the pertinent code:

@Stateless //only so we can inject an entityManager
public class AccountDaoImpl implements AccountDAO  {

    @EJB(beanInterface=MultiTenantEntityManager.class)
    private MultiTenantEntityManager multiem;
}

Because we have multi-tenancy, we can't just use a @PersistenceContext annotation - instead we need a multitenant entity manager as per this example .

The DAO layer is called by the AccountBean:

//this is an EJB 2
public class AccountBean implements EntityBean, Account {

    AccountDAO mAccountDao;

    public void setEntityContext(EntityContext ctx)  {
      this.ctx = ctx;
      if (mAccountDao==null)
        mAccountDao = (AccountDAO) ctx.lookup("ercore/AccountDaoImpl/local");
    }


    public String ejbFindByPrimaryKey(String msisdn) throws FinderException  {

        mAccountDao.selectAccount(msisdn);
     }
}

Transactionality is configured on the AccountBean such that 'trans-attribute' is set to Supports . I tried changing this to Required with no effect.

The subscription management layer is where the EJB2 account bean is loaded:

public class SubscriptionManagementImpl implements SubscriptionManagement  {

  public Account findAccountByPrimaryKey(String msisdn) throws EcommerceException {

     Account sAccount = getAccountHome().findByPrimaryKey(msisdn);
    }
}

This subscription management layer is in turn being called by the PurchaseBean:

public class PurchaseBean implements PurchaseTcApi, SessionBean     {

    public PurchaseAuthorization purchasePackage(String msisdn) throws RemoteException   {     

        Account account=getSubscriptionManagement(locale).findAccountByPrimaryKey(msisdn);

    }

And the PurchaseBean is being called by the delegate layer:

public class PurchaseApiDelegateImpl implements PurchaseApi {

    public PurchaseAuthorization purchasePackageMsisdn(String msisdn) throws PurchaseAuthorizationException         {

       getPurchaseBean().purchasePackage(clientApplicationId,
                msisdn, packageId, purchaseAttributes, this.locale);
}

And the delegate layer is in turn called by the servlet layer. Phew!

So it's a pretty complicated setup, and I'm not going to pretend that I like it, but it was working fine until I started trying to move things to EJB3 (the AccountDaoImpl for now).

I suspect it might be something to with transaction boundaries. I know that the default setting is Required , meaning join a transaction if there is one, otherwise create a new one. So I can't see how the transaction can be inactive, since there should be one created as soon as we entered the method in AccountDaoImpl.

You maybe probably looking too far ahead. The exception is

org.hibernate.exception.GenericJDBCException: Cannot open connection

Can you check if the credentials for the DB connection are correct and if the url of the DB is also good ?

I believe the actual root cause is not being exposed in these stack traces. Could you connect your application through a debugger and check that the root cause exception is not swallowed somewhere. This root cause exception might have aborted your transaction and made it inactive.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM