I forgot to attach my java code in previous post. I am atatching it here
For convenience, I am putting my code snippet here
//Transaction txobj = tm.suspend();
channel.sendSync(exchange);
Fault fault = exchange.getFault();
if(fault != null){
log.info("fault occurred");
}
Exception error = exchange.getError();
if(error != null){
log.info("error occurred");
}
NormalizedMessage out =
exchange.getMessage("out");
if(out != null){
log.info("out exists");
}
//tm.resume(txobj);
log.info("channel send done");
} else if (exchange.getStatus() == ExchangeStatus.DONE)
{
// if(good){
log.info("inside DONE block");
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);
} else if (exchange.getStatus() ==
ExchangeStatus.ERROR) {
// else{
log.info("inside ERROR block");
// Exception ex = new Exception
// ("ERROR:Fault occurred"+faultbody);
Exception ex = new Exception("ERROR:Fault
occurred");
exchange.setError(ex);
exchange.setStatus(ExchangeStatus.ERROR);
channel.send(exchange);
}
gnanda wrote:
>
> I changed the code what I understood from your suggestion. I am still
> getting same Transactionexception as below. I am using sendSync here. The
> call is not coming back from sendSync , it is not executing the next line
> after sendSync() call. Since the call to external web service returns soap
> fault, I am expecting it withh return back and print "fault occurred"
> It is not returning from the sendSync call , instead it is raising
> "invalidTransactionException"
>
> Please suggest
>
> 2010-04-21 16:24:48,737 | 16:24:48,737 | ERROR | x-http-thread-14 |
> HttpComponent | icemix.common.AsyncBaseLifeCycle 480 |
> Error processing exchange
> org.apache.servicemix.jbi.runtime.impl.inonlyi...@1581385
> java.lang.Exception: Invalid status response: 500
> at
> org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:182)
> at
> org.apache.servicemix.soap.SoapEndpoint.process(SoapEndpoint.java:368)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:478)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:347)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> 2010-04-21 16:24:48,753 | 16:24:48,753 | WARN | ix-eip-thread-14 |
> SimpleEndpoint | .common.endpoints.SimpleEndpoint 90 |
> SimpleEndpoint.fail called:
> 2010-04-21 16:24:48,753 | 16:24:48,753 | ERROR | x-bean-thread-14 |
> BeanComponent | icemix.common.AsyncBaseLifeCycle 480 |
> Error processing exchange
> org.apache.servicemix.jbi.runtime.impl.inouti...@e59bd
> javax.jbi.messaging.MessagingException:
> javax.transaction.InvalidTransactionException: Specified transaction is
> already associated with another thread
> at
> org.apache.servicemix.common.EndpointDeliveryChannel.resumeTx(EndpointDeliveryChannel.java:137)
> at
> org.apache.servicemix.common.EndpointDeliveryChannel.sendSync(EndpointDeliveryChannel.java:118)
> at
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.sendSync(BeanEndpoint.java:638)
> at com.pf.eipconsumer.RouterBean.onMessageExchange(RouterBean.java:98)
> at
> org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:230)
> at
> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:217)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:478)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:347)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: javax.transaction.InvalidTransactionException: Specified
> transaction is already associated with another thread
> at
> org.apache.geronimo.transaction.manager.TransactionManagerImpl.associate(TransactionManagerImpl.java:114)
> at
> org.apache.geronimo.transaction.manager.TransactionManagerImpl.resume(TransactionManagerImpl.java:183)
> at sun.reflect.GeneratedMethodAccessor104.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:64)
> at
> org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:78)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
> org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
> at
> org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
> org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
> org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
> at
> org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
> at $Proxy24.resume(Unknown Source)
> at
> org.apache.servicemix.common.EndpointDeliveryChannel.resumeTx(EndpointDeliveryChannel.java:135)
> ... 12 more
>
>
>
> iocanel wrote:
>>
>> Hi Granda,
>>
>> before we get to the transactional part, I think that you have some
>> issues in your bean endpoint.
>>
>> The bean endpoint has the "role" of transformer for your pipeline. That
>> means that it should handle InOut requests.
>>
>> a) When you get an as ACTIVE exchange (The InOut with In message and no
>> OUT), you need to create the out message and send it to through the
>> delivery channel.
>>
>> b) After doing so you will receive an exchange which will be either DONE
>> or ERROR. This exchange you will send again through the delivery channel
>> and it will reach your consumer.
>>
>> You are doing part a correctly. However in part b you are resending the
>> original exchange instead of the response:
>>
>>
>>
>>> if(good){
>>> log.info("inside DONE block");
>>> exchange.setStatus(ExchangeStatus.DONE);
>>> channel.send(exchange);
>>> }
>>> //else if(exchange.getStatus() ==
>>> ExchangeStatus.ERROR){
>>> else{
>>> log.info("inside ERROR block");
>>> //Exception ex = new Exception
>>> ("ERROR:Fault occurred"+faultbody);
>>> Exception ex = new Exception
>>> ("ERROR:Fault occurred");
>>> exchange.setError(ex);
>>>
>>> exchange.setStatus(ExchangeStatus.ERROR);
>>> channel.send(exchange);
>>> }
>>>
>>
>>
>> You need to implement this as indicated above. This is probably the
>> reason you have the error with the transaction.
>>
>>
>>
>
>
http://old.nabble.com/file/p28323659/RouterBean.java RouterBean.java
--
View this message in context:
http://old.nabble.com/smx4-javax.transaction.InvalidTransactionException%3A-tp28287860p28323659.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.