You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Nan <na...@gmail.com> on 2013/09/14 00:57:12 UTC

cxf enable jta transaction on jms transport

I am using cxf 2.7.6 and trying to receive soap message over jms. 

I need to get messge from inbound queue, process it(DB action), then
response back to the outbound queue. at any phrase when problem happen, the
DB action should be reverted.

The message can be received, processed and sent back correctly, but I
noticed that there is no transaction. I prefer use spring transaction
annotation, but I found there is no good place for me to put it. I want to
start the tx when I get jms message, so when I process the message
right(update DB) and send back message has problem, the DB change can be
reverted.
all my resources are XAResource.
here is my configuration.


<jaxws:endpoint id="tasaJmsServiceEndPoint" address="jms://" 
implementor="#tasaWebServiceOverJms">
		<jaxws:features>
			<bean class="org.apache.cxf.transport.jms.JMSConfigFeature"
p:jmsConfig-ref="tasaJmsConfig" />
			<wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing"
allowDuplicates="true" usingAddressingAdvisory="true"/>
		</jaxws:features>
	</jaxws:endpoint>

	<bean id="tasaJmsConfig"
class="org.apache.cxf.transport.jms.JMSConfiguration"
		p:connectionFactory-ref="tasaConnectionFactory" 
		p:targetDestination="tasaInboundQueue"
		p:replyDestination="tasaOutboundQueue"
		p:destinationResolver-ref="jmsDestinationResolver"
		p:transactionManager-ref="transactionManager"
		/>    
<jee:jndi-lookup id="tasaConnectionFactory"
jndi-name="mqForeignConnectionFactory" />

<tx:jta-transaction-manager/>
<bean id="jmsDestinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver"
p:resourceRef="true"/>


@WebService(
       
endpointInterface="com.webservice.service.TasaWebServiceOverJmsEndPoint",
        serviceName="TasaServiceOverJms",
        portName="TasaServiceverJmsPort")
@Addressing(enabled=true, required=false)
@Transactional  //* I really doubt I want to put a transactional here, it
should start ealier than here.*
public class TasaWebServiceOverJmsEndPointImpl implements
TasaWebServiceOverJmsEndPoint {




--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-enable-jta-transaction-on-jms-transport-tp5734088.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: cxf enable jta transaction on jms transport

Posted by Nan <na...@gmail.com>.
after I put sessionTransacted, weblogic alway show this

Setup of JMS message listener invoker failed for destination
'gfxservlet-jms!com.gfx.cpfx.tasaInboundQueue' - trying to recover. Cause:
Local JMS transaction failed to commit; nested exception is
weblogic.jms.common.IllegalStateException: [JMSClientExceptions:055055]No
transaction



--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-enable-jta-transaction-on-jms-transport-tp5734088p5734289.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: cxf enable jta transaction on jms transport

Posted by Nan <na...@gmail.com>.
I've tried this, but I guess this configuration just make cxf use the jms
local transaction, and this is not join to JTA.



--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-enable-jta-transaction-on-jms-transport-tp5734088p5734164.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: cxf enable jta transaction on jms transport

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Could you also configure  "sessionTransacted" as "true" for org.apache.cxf.transport.jms.JMSConfiguration?
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋



On 2013-9-14, at 上午6:57, Nan wrote:

> I am using cxf 2.7.6 and trying to receive soap message over jms. 
> 
> I need to get messge from inbound queue, process it(DB action), then
> response back to the outbound queue. at any phrase when problem happen, the
> DB action should be reverted.
> 
> The message can be received, processed and sent back correctly, but I
> noticed that there is no transaction. I prefer use spring transaction
> annotation, but I found there is no good place for me to put it. I want to
> start the tx when I get jms message, so when I process the message
> right(update DB) and send back message has problem, the DB change can be
> reverted.
> all my resources are XAResource.
> here is my configuration.
> 
> 
> <jaxws:endpoint id="tasaJmsServiceEndPoint" address="jms://" 
> implementor="#tasaWebServiceOverJms">
> 		<jaxws:features>
> 			<bean class="org.apache.cxf.transport.jms.JMSConfigFeature"
> p:jmsConfig-ref="tasaJmsConfig" />
> 			<wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing"
> allowDuplicates="true" usingAddressingAdvisory="true"/>
> 		</jaxws:features>
> 	</jaxws:endpoint>
> 
> 	<bean id="tasaJmsConfig"
> class="org.apache.cxf.transport.jms.JMSConfiguration"
> 		p:connectionFactory-ref="tasaConnectionFactory" 
> 		p:targetDestination="tasaInboundQueue"
> 		p:replyDestination="tasaOutboundQueue"
> 		p:destinationResolver-ref="jmsDestinationResolver"
> 		p:transactionManager-ref="transactionManager"
> 		/>    
> <jee:jndi-lookup id="tasaConnectionFactory"
> jndi-name="mqForeignConnectionFactory" />
> 
> <tx:jta-transaction-manager/>
> <bean id="jmsDestinationResolver"
> class="org.springframework.jms.support.destination.JndiDestinationResolver"
> p:resourceRef="true"/>
> 
> 
> @WebService(
> 
> endpointInterface="com.webservice.service.TasaWebServiceOverJmsEndPoint",
>        serviceName="TasaServiceOverJms",
>        portName="TasaServiceverJmsPort")
> @Addressing(enabled=true, required=false)
> @Transactional  //* I really doubt I want to put a transactional here, it
> should start ealier than here.*
> public class TasaWebServiceOverJmsEndPointImpl implements
> TasaWebServiceOverJmsEndPoint {
> 
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-enable-jta-transaction-on-jms-transport-tp5734088.html
> Sent from the cxf-user mailing list archive at Nabble.com.