2 Replies Latest reply on Feb 15, 2006 5:17 AM by Jobst Essmeyer

    Transacted sending from MDBs without XA-Datasource for persi

    Jobst Essmeyer Newbie

      Hi,

      I'm running JBoss 4.0.3SP1. My application has an MDB which processes messages from an IN-Queue, modifies a database object state via Hibernate and sends a message to an OUT-Queue. The processing is transactional i.e. uses JmsXA.
      The JDBC Datasource I'm using for the JMS persistence and Hibernate is a "local-tx-datasource" and not a "xa-datasource".

      Because I get the "Prepare called on local tx"-warning I wanted to change the datasource to "xa-datasource". But I wonder whether this is really necessary. Isn't is possible for JBossMQ and Hibernate to "share" the same JDBC-transaction instead of using two-phase-commit?

      Thanks in advance

      Jobst Essmeyer


        • 2. Re: Transacted sending from MDBs without XA-Datasource for p
          Jobst Essmeyer Newbie

          Adrian,

          thank's for the fast reply. I've read the FAQ before posting this question. I have also read them after your reply but I don't find an answer to my question. The most interesting article is: TransactionalMessageProcessing (the author wants to avoid TPC like I would like to) but I doesn't deal with MDBs and I don't know how to port it to MDB. I simple tried to use the same Datasource for Hibernate and JMS but this doesn't work as I expect it to work, because than the MDB takes two connections from the pool and I get deadlock (rarely) that are broken via the attached Exception. My solution for this was to use to different Datasources for Hibernate and JMS. But what I really want is using one connection instead and one commit per "onMessage" invocation. I this possible?

          Thank's in advance.

          Jobst

          org.hibernate.exception.GenericJDBCException: Cannot open connection
          at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
          at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
          at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:314)
          at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:114)
          at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
          at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
          at org.hibernate.loader.Loader.doQuery(Loader.java:661)
          at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
          at org.hibernate.loader.Loader.loadEntity(Loader.java:1782)
          at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:47)
          at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:41)
          at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2712)
          at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
          at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
          at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
          at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
          at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
          at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:781)
          at org.hibernate.impl.SessionImpl.get(SessionImpl.java:721)
          at org.hibernate.impl.SessionImpl.get(SessionImpl.java:714)
          at de.tmobile.conan.workflow.WorkflowDAO.getWorkflowById(WorkflowDAO.java:24)
          at de.tmobile.conan.workflow.WorkflowManagerHibernateImpl.getWorkflow(WorkflowManagerHibernateImpl.java:42)
          at de.tmobile.conan.workflow.WorkflowProcessorImpl.handleMessage(WorkflowProcessorImpl.java:99)
          at de.tmobile.conan.ejb.WorkflowProcessorMDEJB.onMessage(WorkflowProcessorMDEJB.java:83)
          at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
          at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)
          at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
          at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:101)
          at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
          at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
          at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
          at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)
          at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
          at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
          at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)
          at org.jboss.ejb.Container.invoke(Container.java:873)
          at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:1077)
          at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1379)
          at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
          at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)
          at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:160)
          at org.jboss.mq.SpySession.run(SpySession.java:333)
          at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
          at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
          at java.lang.Thread.run(Thread.java:595)
          Caused by: org.jboss.util.NestedSQLException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ); - nested throwable: (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ))
          at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:79)
          at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
          at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:311)
          ... 46 more
          Caused by: javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] )
          at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:246)
          at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:566)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:410)
          at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:342)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:462)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)
          at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)
          ... 48 more