Guillaume,I believe I have reproduced this issue outside of my own app, using a simple example based on the jms-binding example and the default config files in the 'conf/' directory of the 6/27 snapshot. I created a new example directory called 'jca-flow' and used the servicemix.xml file which I include below this message. Running with this file appears to load servicemix and establish a JCAFlow without error.
I can then run the JMSClient from the jms-binding example with no problems.
I then split the JMSclient into a sender and a listener, the listener just hangs on receive, while the sender fires 10 messages in a tight loop. On average, only six messages into the loop I begin to receive the error (note: I tweaked the 'blockingTimeout' in this run to 6000 so that I could be sure it was really loading my config, but the issue happens regardless of what I put into tx.xml):
"ERROR - ActiveMQSession - error dispatching message:org.apache.servicemix.jbi.RuntimeJBIException: javax.jbi.messaging.MessagingException: javax.jms.JMSException: No ManagedConnections available within configured blocking timeout ( 6000 [ms] )"
Folowed by a bunch of others."WARN - XAEndpoint - Failed to rollback transaction: javax.transaction.SystemException javax.transaction.SystemException"
"WARN - Transaction - Error ending association for XAResource [EMAIL PROTECTED]; transaction will roll back. XA error code: -7
javax.transaction.xa.XAException: The connection is already closed""ERROR - Transaction - Unexpected exception rolling back [EMAIL PROTECTED]; continuing with rollback
javax.transaction.xa.XAException: The connection is already closed" "ERROR - AbstractTransactionContext - Unable to roll back transaction java.lang.IllegalStateException: Status is STATUS_NO_TRANSACTION"I suppose it's still possible that I'm doing something to cause this, as I'm quite out of my depth, but I can reproduce this issue at will, I was wondering if I should log a JIRA with my logs and example-case?
Thanks again, BJ <?xml version="1.0" encoding="UTF-8"?> <beans xmlns:sm="http://servicemix.apache.org/config/1.0" xmlns:my="http://servicemix.apache.org/demo/"> <sm:systemProperties> <property name="properties"> <map> <entry key="java.security.auth.login.config"><bean class="org.springframework.util.ResourceUtils" factory-method="getFile"> <constructor-arg value="classpath:login.properties"/>
</bean>
</entry>
</map>
</property>
</sm:systemProperties>
<import resource="classpath:jmx.xml" />
<import resource="classpath:activemq.xml" />
<import resource="classpath:jndi.xml" />
<!-- the JBI container -->
<sm:container id="jbi"
rootDir="../../data/smx"
MBeanServer="#mbeanServer"
installationDirPath="../../install"
deploymentDirPath="../../deploy"
dumpStats="true"
statsInterval="10"
flowName="seda"
transactionManager="#transactionManager"
workManager="#workManager"
depends-on="jndi">
<sm:broker>
<sm:securedBroker authorizationMap="#authorizationMap">
<sm:flows>
<!-- <sm:sedaFlow /> -->
<sm:jcaFlow bootstrapContext="#bootstrapContext"
connectionManager="#connectionManager"
jmsURL="tcp://localhost:61616" />
</sm:flows>
</sm:securedBroker>
</sm:broker>
<sm:activationSpecs>
<!-- Subscribe to a JMS destination -->
<sm:activationSpec componentName="inputReceiver"
service="my:inputReceiver"
destinationService="my:outputSender">
<sm:component>
<bean
class="org.apache.servicemix.components.jms.JmsInUsingJCABinding">
<property name="jcaContainer" ref="jencks"/>
<property name="activationSpec">
<bean
class="org.apache.activemq.ra.ActiveMQActivationSpec">
<property name="destination"
value="demo.org.servicemix.source"/>
<property name="destinationType"
value="javax.jms.Topic"/>
</bean>
</property>
</bean>
</sm:component>
</sm:activationSpec>
<!-- Publish the result to a JMS destination -->
<sm:activationSpec componentName="outputSender"
service="my:outputSender">
<sm:component>
<bean
class="org.apache.servicemix.components.jms.JmsSenderComponent">
<property name="template">
<bean
class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref local="jmsFactory"/>
</property>
<property
name="defaultDestinationName" value="demo.org.servicemix.result"/>
<property name="pubSubDomain"
value="true"/>
</bean>
</property>
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
<!-- the JCA container -->
<bean id="jencks" class="org.jencks.JCAContainer" singleton="true">
<!-- lets use the default configuration of work manager and
transaction manager-->
<property name="bootstrapContext">
<bean
class="org.jencks.factory.BootstrapContextFactoryBean">
<property name="threadPoolSize" value="25"/>
</bean>
</property>
<!-- the JCA Resource Adapter -->
<property name="resourceAdapter">
<bean id="activeMQResourceAdapter"
class="org.apache.activemq.ra.ActiveMQResourceAdapter" singleton="true">
<property name="serverUrl" value="tcp://localhost:
61616"/>
</bean>
</property>
</bean>
<!-- message broker -->
<!--
<bean id="broker"
class="org.apache.activemq.xbean.BrokerFactoryBean">
<property name="config" value="classpath:activemq.xml"/>
</bean>
-->
<!--
<bean id="transactionContextManager"
class="org.jencks.factory.TransactionContextManagerFactoryBean"/>
<bean id="transactionManager"
class="org.jencks.factory.GeronimoTransactionManagerFactoryBean" />
-->
<bean id="jmsFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
<property name="connectionFactory">
<bean
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>tcp://localhost:61616</value>
</property>
</bean>
</property>
</bean>
</beans>
On Jun 27, 2006, at 5:20 PM, William Blackburn wrote:
Thanks Guillaume - this was the problem.I've got the JCAflow configuration deploying (I think) properly. Judging by the error messages, my configuration is certainly overwriting the defaults, but unfortunately, the condition is even worse than if I had just left it alone. I can't send more than a couple messages in a tight loop before I get the "no managed connections available" error, even with the blocking timeout tweaked up to 6 full seconds or so and max connections at 16. Once this happens, everything pretty much locks up. Its as if the connections stop being returned to the pool.Later on in this cascade of exceptions, I'll see:ERROR [AbstractTransactionContext:rollbackAndThrow] Unable to roll back transactionjava.lang.IllegalStateException: Status is STATUS_NO_TRANSACTIONat org.apache.geronimo.transaction.manager.TransactionImpl.rollback (TransactionImpl.java:438) at org.apache.geronimo.transaction.context.InheritableTransactionContext. rollbackAndThrow(InheritableTransactionContext.java:308) at org.apache.geronimo.transaction.context.InheritableTransactionContext. complete(InheritableTransactionContext.java:199) at org.apache.geronimo.transaction.context.InheritableTransactionContext. rollback(InheritableTransactionContext.java:152) at org.apache.geronimo.transaction.context.GeronimoTransactionManager.ro. ..This surprised me, as I have autoEnlistInTransaction="true" Then still later, I'll seeWARN [XAEndpoint:release] Failed to rollback transaction: javax.transaction.SystemExceptionjavax.transaction.SystemExceptionat org.apache.geronimo.transaction.manager.TransactionImpl.rollbackResour ces(TransactionImpl.java:546) at org.apache.geronimo.transaction.manager.TransactionImpl.rollback (TransactionImpl.java:446) at org.apache.geronimo.transaction.manager.TransactionManagerImpl.rollbac k(TransactionManagerImpl.java:155) at org.apache.geronimo.transaction.context.InheritableTransactionContext. isRolledback(InheritableTransactionContext.java:283)at org.apache.geronimo.transaction.context.Inherit...Then I'll see this null pointer exception, which stumps me, though I admit I have not looked at the activemq source:ERROR [ServerSessionPoolImpl:removeFromPool] Error redispatching unconsumed messages from stale sessionjava.lang.NullPointerExceptionat org.apache.activemq.ra.ServerSessionPoolImpl.createServerSessionImpl (ServerSessionPoolImpl.java:60) at org.apache.activemq.ra.ServerSessionPoolImpl.getServerSession (ServerSessionPoolImpl.java:113) at org.apache.activemq.ra.ServerSessionPoolImpl.dispatchToSession (ServerSessionPoolImpl.java:135) at org.apache.activemq.ra.ServerSessionPoolImpl.removeFromPool (ServerSessionPoolImpl.java:175) at org.apache.activemq.ra.ServerSessionImpl.run (ServerSessionImpl.java:177) at org.apache.geronimo.connector.work.WorkerContext.run (WorkerContext.java:291) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor $Worker.run(Unknown Source)at java.lang.Thread.run(Thread.java:613)Thread-68 2006-06-27 16:13:59,558 WARN [Transaction:endResources] Error ending association for XAResource [EMAIL PROTECTED]; transaction will roll back. XA error code: -7javax.transaction.xa.XAException: The connection is already closedat org.apache.activemq.TransactionContext.toXAException (TransactionContext.java:589) at org.apache.activemq.TransactionContext.setXid (TransactionContext.java:554) at org.apache.activemq.TransactionContext.end (TransactionContext.java:327) at org.apache.activemq.ra.LocalAndXATransaction.end (LocalAndXATransaction.java:89) at org.apache.geronimo.transaction.manager.TransactionImpl.endResources (TransactionImpl.java:524)at org.apache.geronimo.transaction.manager.TraAt this point I still don't know for sure if something I'm doing with my webapp-based deployment is causing all the trouble, so I plan on creating a simple test case to try and reproduce the issue in a standalone instance of servicemix.Thanks for all your help so far, B.J. On Jun 27, 2006, at 3:29 PM, Guillaume Nodet wrote:Yes. Unfortunately a bug has slipped in xbean version. See http://issues.apache.org/jira/browse/XBEAN-21 and https://issues.apache.org/activemq/browse/SM-458 You have to useorg/apache/servicemix/xbean/XmlWebApplicationContext.java<http:// svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix- core/src/main/java/org/apache/servicemix/xbean/ XmlWebApplicationContext.java>insteadof org\apache\xbean\spring\context\XmlWebApplicationContext Cheers, Guillaume Nodet On 6/27/06, William Blackburn <[EMAIL PROTECTED]> wrote:Thanks Guillaume,I understand this now, but my snapshot (6/16/2006) does not appear tohave the xbean definitions for sm:defaultBroker, etc. When I sttempted to configure like the example you cited, s I got a classdefnotfound error when I tried to run. So I tried to convert it to standard spring bean defininitions, but no matter what I tried, I'm pretty sure my flows were not properly defined, as I got: "MessagingException: Unable to choose a flow for exchange" I then decided to update our app to the latest snapshot (6/27/2006) but now our app (which is deployed in Tomcat as a webapp) won;tdeploy at all. I get this from Spring (I notice we've moved to 2.0 atsome time since my last snapshot): 10:47:51,843 ERROR [ContextLoader:initWebApplicationContext] Context initialization failed java.lang.IllegalStateException: Could not find valid implementation for: 2.0-m5 atorg.apache.xbean.spring.context.XmlWebApplicationContext.createBeanD efinitionReader(XmlWebApplicationContext.java:84) atorg.apache.xbean.spring.context.XmlWebApplicationContext.loadBeanDef initions(XmlWebApplicationContext.java:63) atorg.springframework.context.support.AbstractRefreshableApplicationCo ntext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89) Is there something special I have to do to get this working under Spring-2.0 ? I checked out the examples in the latest dist and nothing seems to have changed and Spring claims backward compatibility with 1.2.x. I'm at a complete standstill, so any help you can offer will be much appreciated. Thanks again, B.J. On Jun 27, 2006, at 12:03 AM, Guillaume Nodet wrote:> Sorry, I forgot to say that you should configure the jca flow using> the > syntax used in > http://svn.apache.org/viewvc/incubator/servicemix/trunk/apache- > servicemix/src/main/release/conf/servicemix.xml? > revision=415380&view=markupso> that you can change the parameters, else all values will be defaulted.> > Cheers, > Guillaume Nodet > > On 6/27/06, William Blackburn <[EMAIL PROTECTED]> wrote: >>>> Guillaume, please forgive me for being so dense, but I can't seem to >> use your advice to solve my problem. The error still occurs and still >> indicates the blocking timeout is 100ms. I must not be incorporating>> the config from tx.xml properly >> >> First - I am using the snapshot from 6/16 - is this new enough? >>>> I simply replaced my current declarations of TransactionManager and>> TransactionContectmanager with the entire tx.xml config >> >> My JCAContainer config now looks like: >> >> <bean id="jencks" class="org.jencks.JCAContainer" >> singleton="true">>> <property name="bootstrapContext" ref="bootstrapContext" /> >> <!-- lets use the default configuration of work manager and>> transaction manager--> >> <!-- >> <property name="bootstrapContext"> >> <bean >> >> class="org.jencks.factory.BootstrapContextFactoryBean"> >> <property name="threadPoolSize" value="25" /> >> </bean> >> </property> >> --> >> <!-- the JCA Resource Adapter --> >> <property name="resourceAdapter"> >> <bean id="activeMQResourceAdapter" >> >> class="org.apache.activemq.ra.ActiveMQResourceAdapter" >> singleton="true"> >> <property name="serverUrl" >> value="tcp://localhost:61616" /> >> </bean> >> </property> >> </bean> >> >> >> >> >> On Jun 26, 2006, at 2:12 PM, Guillaume Nodet wrote: >>>> > In the latest servicemix distribution, the jencks jca container is>> > already >> > configured. >> > You may find easier to override the parameters (or copy/paste) >> in the >> > tx.xmlfile. >> > See the poolingSupport bean in >> > http://svn.apache.org/viewvc/incubator/servicemix/trunk/apache->> > servicemix/src/main/release/conf/tx.xml? revision=415380&view=markup>> > >> > Cheers >> > Guillaume Nodet >> > >> > On 6/26/06, William Blackburn <[EMAIL PROTECTED]> wrote: >> >> >> >> This morning I did a rudimentary load test of our application, >> just >> >> fired 50 messages in rapid sequence via JMS to the first >> component in>> >> a 'chain' of components using JCA flow. Approx 20 messages into>> the >> >> test, I got the following error, for each of the remaining >> messages. >> >> >> >>>> >> 09:35:32,034 ERROR [JCAFlow:doRouting] Failed to send exchange:>> >> MessageExchange[internal JMS Network >> >> javax.jms.JMSException: No ManagedConnections available within >> >> configured blocking timeout ( 100 [ms] ) >> >> at>> >> org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection>> >> (ActiveMQConnectionFactory.java:96) >> >> at>> >> org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection>> >> (ActiveMQConnectionFactory.java:65) >> >> at >> >> org.apache.servicemix.jbi.nmr.flow.jca.JCAFlow.sendJmsMessage >> >> (JCAFlow.java:700) >> >> ... >> >> >> >>>> >> I've been studying the Servicemix and ActiveMQ docs, looking for>> >> settings (under the JCAFlow or the ActiveMQ ConnectionFactory) >> that>> >> would help me increase the number of connections and/or the 100ms>> >> timeout value, but I don't know exactly what I'm looking for, >> so I'm >> >> stumped. >> >> >> >> the applicable bits from my servicemix.xml file are: >> >>>> >> <sm:container id="jbi" rootDir="#rootDir" useMBeanServer="true">> >> createMBeanServer="false" >> installationDirPath="#installDir" >> >> deploymentDirPath="#deployDir" flowName="jca? >> jmsURL=tcp:// >> >> localhost:61616" >> >> autoEnlistInTransaction="true" persistent="true" >> >> monitorInstallationDirectory="true" dumpStats="true" >> >> statsInterval="10" >> transactionManager="#transactionManager" >> >> depends-on="broker"> >> >> >> >> ...other stuff... >> >> >> >> <!-- the JCA container --> >> >> <bean id="jencks" class="org.jencks.JCAContainer" >> >> singleton="true"> >> >> >> >> <!-- lets use the default configuration of work >> manager and >> >> transaction manager--> >> >> <property name="bootstrapContext"> >> >> <bean >> >> >> >> class="org.jencks.factory.BootstrapContextFactoryBean"> >> >> <property name="threadPoolSize" value="25" /> >> >> </bean> >> >> </property> >> >> >> >> <!-- the JCA Resource Adapter --> >> >> <property name="resourceAdapter"> >> >> <bean id="activeMQResourceAdapter" >> >> >> >> class="org.apache.activemq.ra.ActiveMQResourceAdapter" >> >> singleton="true"> >> >> <property name="serverUrl" >> >> value="tcp://localhost:61616" /> >> >> </bean> >> >> </property> >> >> </bean> >> >> >> >> <bean id="broker" >> >> class="org.apache.activemq.xbean.BrokerFactoryBean">>> >> <property name="config" value="classpath:activemq.xml"/>>> >> </bean> >> >> >> >> <bean id="transactionContextManager">> >> class="org.jencks.factory.TransactionContextManagerFactoryBean"/>>> >> <bean id="transactionManager" >> >>>> class="org.jencks.factory.GeronimoTransactionManagerFactoryBean" />>> >> >> >> <bean id="jmsFactory" depends-on="broker">> >> class="org.apache.activemq.pool.PooledConnectionFactory">>> >> <property name="connectionFactory"> >> >> <bean >> >> >> >> class="org.apache.activemq.ActiveMQConnectionFactory">>> >> <constructor-arg value="tcp://localhost: 61616" />>> >> </bean> >> >> </property> >> >> </bean> >> >> >> >> My activemq.xml file looks like: >> >> >> >> <beans xmlns="http://activemq.org/config/1.0"> >> >> <broker id="broker" useJmx="false"> >> >> >> >> <persistenceAdapter> >> >> <journaledJDBC journalLogFiles="5" >> >> dataDirectory="#dataDir" dataSource="#postgres-ds"/> >> >> </persistenceAdapter> >> >> >> >> <transportConnectors> >> >> <transportConnector uri="tcp://localhost:61616"/> >> >> </transportConnectors> >> >> >> >> >> >> </broker> >> >>>> >> <!-- This xbean configuration file supports all the standard>> >> spring xml configuration options --> >> >> >> >> <!-- Postgres DataSource Sample Setup --> >> >> <bean id="postgres-ds" >> >> class="org.postgresql.ds.PGPoolingDataSource"> >> >> <property name="serverName" value="localhost"/> >> >> <property name="databaseName" value="activemq"/> >> >> <property name="portNumber" value="0"/> >> >> <property name="dataSourceName" value="postgres"/> >> >> <property name="initialConnections" value="1"/> >> >> <property name="maxConnections" value="10"/> >> >> <property name="user" value="activemq"/> >> >> <property name="password" value="activemq"/> >> >> <!-- >> >> <property name="user" value="cmroot"/> >> >> <property name="password" value="22cmroot"/> >> >> --> >> >> </bean> >> >> >> >> >> >> >> >> <!-- Directories relative to web app --> >> >> <bean id="servletContext" >> >>>> class="org.springframework.web.context.support.ServletContextFactory B>> >> ean >> >> " /> >> >> <bean id="dataDir" >> class="org.springframework.web.util.WebUtils" >> >> factory-method="getRealPath"> >> >> <constructor-arg ref="servletContext" /> >> >> <constructor-arg value="/data" /> >> >> </bean> >> >> >> >> </beans> >> >> >> >> >> >> >> >> >> >>
