camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MasterLotis <yomi...@hotmail.com>
Subject Problem from Camelcontext close after poolingconnection,transactionmanager and datasource
Date Wed, 31 Mar 2010 13:06:10 GMT

   I Have using camel 2.2.0 with spring 2.5.6 Tomcat 6 and Atomikos
Transaction manager working together.
I found error on stopping tomcat like this.

    STACKTRACE:

    java.net.SocketException: socket closed
	    at java.net.SocketInputStream.socketRead0(Native Method)
	    at java.net.SocketInputStream.read(SocketInputStream.java:129)
	    at
com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
	    at com.mysql.jdbc.util.ReadAheadInputStream
           
.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
	    at
com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
	    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1994)
	    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2411)
	    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2916)
	    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
	    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
	    at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
	    at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
	    at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:882)
	    at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper
            .execute(PreparedStatementWrapper.java:787)
	    at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:80)
	    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement
            .sqlExecuteUpdate(MappedStatement.java:216)
	    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement
            .executeUpdate(MappedStatement.java:94)
	    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate
            .update(SqlMapExecutorDelegate.java:457)
	    at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionImpl.java:90)
	    at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.update(SqlMapClientImpl.java:66)
	    at
org.apache.camel.component.ibatis.strategy.DefaultIBatisProcessingStategy
            .commit(DefaultIBatisProcessingStategy.java:42)
	    at org.apache.camel.component.ibatis.IBatisPollingConsumer
            .processBatch(IBatisPollingConsumer.java:219)
	    at
org.apache.camel.component.ibatis.IBatisPollingConsumer.poll(IBatisPollingConsumer.java:179)
	    at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:106)
	    at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
	    at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
	    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
	    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask
            .access$101(ScheduledThreadPoolExecutor.java:65)
	    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask
            .runPeriodic(ScheduledThreadPoolExecutor.java:146)
	    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask
            .run(ScheduledThreadPoolExecutor.java:170)
	    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
	    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
	    at java.lang.Thread.run(Thread.java:595)


    ** END NESTED EXCEPTION **


    Then I do some change in spring context like remove "
destroy-method="destroy" " on poolconnectionfactorybean remove 
"destroy-method="close" "on atomikostransactionmanager 
and datasource and start and stop again I got random error like this.


ERROR: org.apache.camel.component.ibatis.IBatisPollingConsumer - Caused by:
[com.ibatis.common.jdbc.exception.NestedSQLException - Could not commit
transaction.  Cause:
com.ibatis.sqlmap.engine.transaction.TransactionException:
TransactionManager could not commit.  No transaction is started.]
com.ibatis.common.jdbc.exception.NestedSQLException: Could not commit
transaction.  Cause:
com.ibatis.sqlmap.engine.transaction.TransactionException:
TransactionManager could not commit.  No transaction is started.
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.commitTransaction(SqlMapExecutorDelegate.java:719)
	at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.commitTransaction(SqlMapSessionImpl.java:172)
	at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.commitTransaction(SqlMapClientImpl.java:148)
	at
org.apache.camel.component.ibatis.strategy.DefaultIBatisProcessingStategy.commit(DefaultIBatisProcessingStategy.java:45)
	at
org.apache.camel.component.ibatis.IBatisPollingConsumer.processBatch(IBatisPollingConsumer.java:219)
	at
org.apache.camel.component.ibatis.IBatisPollingConsumer.poll(IBatisPollingConsumer.java:179)
	at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:106)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
	at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:146)
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:170)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
	at java.lang.Thread.run(Thread.java:595)
Caused by: com.ibatis.sqlmap.engine.transaction.TransactionException:
TransactionManager could not commit.  No transaction is started.
	at
com.ibatis.sqlmap.engine.transaction.TransactionManager.commit(TransactionManager.java:62)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.commitTransaction(SqlMapExecutorDelegate.java:717)
	... 15 more


And


Caused by: javax.jms.IllegalStateException: The Session is closed
	at
org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:659)
	at
org.apache.activemq.ActiveMQSession.getTransacted(ActiveMQSession.java:470)
	at
org.apache.activemq.pool.PooledSession.getTransacted(PooledSession.java:193)
	at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:224)
	at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:164)
	at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$3.doInJms(JmsConfiguration.java:198)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471)
	... 55 more


I turn on debug logging and see destroy sequence of spring bean like this.


31 มี.ค. 2553 19:52:43 org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
31 มี.ค. 2553 19:52:43 org.apache.catalina.core.ApplicationContext log
INFO: Destroying Spring FrameworkServlet 'dispatcher'
INFO : org.springframework.web.context.support.XmlWebApplicationContext -
Closing
org.springframework.web.context.support.XmlWebApplicationContext@71e2b67c:
display name [WebApplicationContext for namespace 'dispatcher-servlet'];
startup date [Wed Mar 31 19:50:09 ICT 2010]; parent:
org.springframework.web.context.support.XmlWebApplicationContext@627a4489
DEBUG: org.apache.camel.spring.SpringCamelContext - onApplicationEvent:
org.springframework.context.event.ContextClosedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@71e2b67c:
display name [WebApplicationContext for namespace 'dispatcher-servlet'];
startup date [Wed Mar 31 19:50:09 ICT 2010]; parent:
org.springframework.web.context.support.XmlWebApplicationContext@627a4489]
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory
- Destroying singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@21a79071:
defining beans []; parent:
org.springframework.beans.factory.support.DefaultListableBeanFactory@24fe2558
INFO : org.springframework.web.context.support.XmlWebApplicationContext -
Closing
org.springframework.web.context.support.XmlWebApplicationContext@627a4489:
display name [Root WebApplicationContext]; startup date [Wed Mar 31 19:49:53
ICT 2010]; root of context hierarchy
DEBUG: org.apache.camel.spring.SpringCamelContext - onApplicationEvent:
org.springframework.context.event.ContextClosedEvent[source=org.springframework.web.context.support.XmlWebApplicationContext@627a4489:
display name [Root WebApplicationContext]; startup date [Wed Mar 31 19:49:53
ICT 2010]; root of context hierarchy]
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory
- Destroying singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@24fe2558:
defining beans
[identifyClassDAOImp,divisionreceiverinput,menuproductdivisionreceiverinput,employeesreceiverinput,employeehistorydetailreceiverinput,productstaticreceiverinput,creditcardscanreceiverinput,creditcardreceiverinput,promotionMasterreceiverinput,productopeningmasterreceiverinput,purchaseordermasterdivisionreceiverinput,historydocumentofficedivisionreceiverinput,giftvouchercarddivisionreceiverinput,deliveryordermasterreceiverinput,warehouseconfirmreceiverinput,productposmasterreceiverinput,productgroupreceiverinput,uommasterreceiverinput,creditcardtypereceiverinput,toppingmasterreceiverinput,countingstockproductreceiverinput,productmenugroupreceiverinput,packagetypereceiverinput,packageproductfinishreceiverinput,documentgroupreceiverinput,positionreceiverinput,bankreceiverinput,optionmasterreceiverinput,menugroupreceiverinput,menuauthenticatereceiverinput,promotionprodgroupmasterreceiverinput,copromotionmasterreceiverinput,settingaccountcodereceiverinput,divisionorderreceiverinput,userloginaccreceiverinput,menuusergroupaccreceiverinput,historydocumentofficereceiverinput,historydocumentaccountreceiverinput,productplaceorderreceiverinput,processingproductreceiverinput,template,consumerTemplate,camel:beanPostProcessor,camel,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,amqConnectionFactory,poolConnectionFactory,amqConfig,activemq,dataSource,sqlMapClient,ibatis,atomikosTransactionManager,atomikosUserTransaction,transactionManager,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,deliveryOrderMasterDAOImp,divisionDAOImp,giftVoucherCardDivisionDAOImp,historyDocumentAccountDAOImp,historyDocumentOfficeDAOImp,historyDocumentOfficeDivisionDAOImp,invoiceMasterPOSDAOImp,menuProductDivisionDAOImp,movingProductStockDAOImp,packageProductFinishDAOImp,productLotDAOImp,productOpeningMasterDAOImp,productPOSMasterDAOImp,productReceiveInvoiceMasterDAOImp,productReturnMasterDAOImp,productStaticDAOImp,promotionMasterDAOImp,promotionProdGroupMasterDAOImp,purchaseOrderMasterDivisionDAOImp,purchaseOrderMasterPosDAOImp,purchaseRequestOrderMasterDAOImp,registerMachineDAOImp,shiftEndMasterDAOImp,trainInvMasterDAOImp,transactionPurchaseMasterDODAOImp,transactionPurchaseMasterPODAOImp,userLoginAccDAOImp,voucherMasterDAOImp,warehouseConfirmDAOImp,warehouseDAOImp,deliveryOrderMasterEndPoint,divisionEndPoint,giftVoucherCardDivisionEndPoint,historyDocumentAccountEndPoint,historyDocumentOfficeDivisionEndPoint,historyDocumentOfficeEndPoint,invoiceMasterPOSEndPoint,menuProductDivisionEndPoint,movingProductStockEndPoint,packageProductFinishEndPoint,productLotEndPoint,productOpeningMasterEndPoint,productPOSMasterEndPoint,productReceiveInvoiceMasterEndPoint,productReturnMasterEndPoint,productStaticEndPoint,promotionMasterEndPoint,promotionProdGroupMasterEndPoint,purchaseOrderMasterDivisionEndPoint,purchaseOrderMasterPosEndPoint,purchaseRequestOrderMasterEndPoint,registerMachineEndPoint,shiftEndMasterEndPoint,trainInvMasterEndPoint,transactionPurchaseMasterDOEndPoint,transactionPurchaseMasterPOEndPoint,userLoginAccEndPoint,voucherMasterEndPoint,warehouseConfirmEndPoint,warehouseEndPoint,checkStatementProcessor,destinationGenerator,listSpritter,controllerService,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,_messageBrokerHandlerAdapter,_messageBrokerDefaultHandlerMapping,_jsonConfigMapEditorConfigurer,_messageBrokerMessagingProcessor,_flexRemotingAnnotationPostProcessor,_messageBrokerRemotingProcessor,org.springframework.flex.core.ExceptionTranslationAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#0,org.springframework.flex.core.MessageInterceptionAdvice#0,org.springframework.flex.core.EndpointServiceMessagePointcutAdvisor#1,_messageBrokerEndpointProcessor,_messageBroker,org.springframework.flex.remoting.RemotingDestinationExporter#0];
root of factory hierarchy
DEBUG: org.springframework.beans.factory.support.DisposableBeanAdapter -
Invoking destroy() on bean with name
'org.springframework.flex.remoting.RemotingDestinationExporter#0'
INFO : org.springframework.flex.remoting.RemotingDestinationExporter -
Removing remoting destination 'controllerService'
DEBUG: org.springframework.beans.factory.support.DisposableBeanAdapter -
Invoking destroy() on bean with name '_messageBroker'
31 มี.ค. 2553 19:52:43 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
DEBUG: org.springframework.beans.factory.support.DisposableBeanAdapter -
Invoking destroy() on bean with name 'poolConnectionFactory'
DEBUG: org.apache.activemq.pool.PooledConnectionFactory - Stop the
PooledConnectionFactory, number of connections in cache: 1
DEBUG: org.apache.activemq.transport.tcp.TcpTransport - Stopping transport
tcp:///127.0.0.1:61616
DEBUG: org.apache.camel.spring.spi.TransactionErrorHandler - Transaction
commit (0x7512951d) for ExchangeId: d3d2b5de-56a9-45fb-8b30-078006d090b6
DEBUG: org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC
Connection from DataSource
DEBUG: org.springframework.beans.factory.support.DisposableBeanAdapter -
Invoking destroy() on bean with name 'camel'
INFO : org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.2.0
(CamelContext:camel) is stopping
INFO : org.apache.camel.impl.DefaultShutdownStrategy - Starting to graceful
shutdown routes (timeout 300 seconds)
DEBUG: org.apache.camel.impl.DefaultShutdownStrategy - There are 1 routes to
shutdown
DEBUG: org.apache.camel.impl.DefaultShutdownStrategy - Suspend complete for:
Consumer[ibatis://getUnProcessInvoiceMasterPOS?consumer.onConsume=updateProcessedInvoiceMasterPOS&statementType=QueryForList]
INFO : org.apache.camel.impl.DefaultShutdownStrategy - Route:
invoicemasterpossender suspended and shutdown deferred.
DEBUG: org.apache.camel.component.ibatis.IBatisPollingConsumer - Stopping
consumer:
Consumer[ibatis://getUnProcessInvoiceMasterPOS?consumer.onConsume=updateProcessedInvoiceMasterPOS&statementType=QueryForList]
DEBUG: org.apache.camel.impl.DefaultShutdownStrategy - Shutdown complete
for:
Consumer[ibatis://getUnProcessInvoiceMasterPOS?consumer.onConsume=updateProcessedInvoiceMasterPOS&statementType=QueryForList]
INFO : org.apache.camel.impl.DefaultShutdownStrategy - Route:
invoicemasterpossender shutdown complete.
INFO : org.apache.camel.impl.DefaultShutdownStrategy - Graceful shutdown of
routes completed in 0 seconds
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=consumers,name=IBatisPollingConsumer(0x111f2041)
DEBUG: org.apache.camel.component.jms.JmsProducer - Stopping producer:
Producer[activemq://queue:allinvoicemasterpos]
INFO : org.apache.camel.impl.DefaultInflightRepository - Shutting down with
no inflight exchanges.
DEBUG: org.apache.camel.impl.SharedProducerServicePool - Stopping service
pool: org.apache.camel.impl.SharedProducerServicePool@2fd23e75
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=routes,name="invoicemasterpossender"
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=services,name=DefaultInflightRepository(0x3d39ef3a)
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=services,name=DefaultTypeConverter(0x695e0163)
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=context,name="camel"
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=tracer,name=Tracer(0x66cf9bf0)
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=endpoints,name="spring-event://default"
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=errorhandlers,name="DefaultErrorHandlerBuilder(ref:CamelDefaultErrorHandlerBuilder)"
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=components,name="activemq"
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=errorhandlers,name="TransactionErrorHandlerBuilder(ref:CamelDefaultErrorHandlerBuilder)"
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=producers,name=JmsProducer(0x39d0c448)
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=components,name="ibatis"
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=endpoints,name="ibatis://getUnProcessInvoiceMasterPOS\?consumer.onConsume=updateProcessedInvoiceMasterPOS&statementType=QueryForList"
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=services,name=DefaultShutdownStrategy(0x2688e83d)
DEBUG: org.apache.camel.management.DefaultManagementAgent - Unregistered
MBean with objectname:
org.apache.camel:context=Pond-NB/camel,type=endpoints,name="activemq://queue:allinvoicemasterpos"
INFO : org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.2.0
(CamelContext:camel) stopped


    I am looking around internet and found spring cand use depends-on to
order sequence of shutdown process. I try set "depends-on" to camel activemq
- ibatis componant no thing change And I cant find the way to set
"depends-on" to camelcontext  :,(


How can I set the order of shutdown process?

Thank you in advance.
-- 
View this message in context: http://old.nabble.com/Problem-from-Camelcontext-close-after-poolingconnection%2Ctransactionmanager-and-datasource-tp28095558p28095558.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message