Social Media

Apache CXF – JMS Spring Config

The JMS Spring Config Demo (samples\jms_spring_config) uses the wsdl_first code, and adds JMS transport through configuration


The WSDL remains unchanged, with the port defined –

[sourcecode lang=”xml”] <wsdl:service name="CustomerServiceService">
<wsdl:port name="CustomerServicePort" binding="tns:CustomerServiceServiceSoapBinding">
<soap:address location="http://localhost:9090/CustomerServicePort"/>

Spring Configuration

JMS is configured through the server-applicationContext.xml –

[sourcecode lang=”xml”] <bean id="jmsConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<property name="targetConnectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />

<bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration"

<!– JMS Endpoint –>
<jaxws:endpoint xmlns:customer=""
id="CustomerServiceHTTP" address="jms://"
<bean class="org.apache.cxf.feature.LoggingFeature" />
<bean class="org.apache.cxf.transport.jms.JMSConfigFeature" p:jmsConfig-ref="jmsConfig" />

There are 3 point of connectivity –

  • jmsConnectionFactory – Inject ActiveMQConnectionFactory into Spring’s JMS SingleConnectionFactory
  • jmsConfig – Inject the jmsConnectionFactory and queue name
  • jaxws:endpoint – Inject jmsConfig into the jaxws:endpoint

About the Author Martin Farrell

My name is Martin Farrell. I have almost 20 years Java experience. I specialize inthe Spring Framework and JEE. I’ve consulted to a range of businesses, and have provide Java and Spring mentoring and training. You can learn more at About or on my consultancy website Glendevon Software

follow me on:

Leave a Comment: