You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jeffrey Knight <je...@gmail.com> on 2010/09/14 01:31:21 UTC

Configuring CXF with JMS using a JNDI resource

Hello

I've developed a CXF service that uses JMS transport. My configuration
[1] is all in the applicationContext.xml rather than WSDL or in the
code as part of the @WebService.

Now, instead of targeting the JMS directly, I want to use a JNDI
resource defined in WebSphere.
I haven't been able to find any documentation on how to do this with
CXF (but I keep finding information on "<jms:conduit" and
"<jms:destination"
configurations which I believe have been superseded by the JMSConfigFeature).

I'm expecting that I will NOT need the tcp://... broker url, since
that's already configured in the JNDI resource itself.
I should only need:
- JNDI name (as configured in WebSphere)
- targetDestination (the JNDI name of the target queue)
- replyDestination (then JNDI name of the target queue)
- username (optional)
- password (optional).

But I'm confused about the "wrapped connection factory" and
org.apache.cxf.transport.jms.JNDIConfiguration pieces.

Where does the JNDI configuration go, and what parameters do I need?

<jaxws:endpoint
     xmlns:batch="urn://my.namespace.here" id="MyId"
     address="jms://" transportId="http://cxf.apache.org/transports/jms"
     serviceName="ns1:MyService"
     endpointName="ns1:MyPort"	
     implementor="com.some.path.MyImpl"
wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
     <jaxws:features>
          <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
	          <property name="jmsConfig" ref="jmsConfig" />
          </bean>
	</jaxws:features>
</jaxws:endpoint>

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

     <!-- Do I need a wrapped connection factory to access a JNDI
resource ? -->
     <property name="connectionFactory" ref="wrappedConnectionFactory" />

     <!-- These should be the JNDI names of the queues ... -->
     <property name="targetDestination" value="myRequestQueue"/>
     <property name="replyDestination" value="myResponseQueue"/>

     <!-- I'm guessing I'll need this ... -->
     <property name="jndiConfig" ref="jndiConfig" />
</bean>

<!-- Maybe I don't need the wrapped connection at all for a JNDI-JMS
config ? -->
<bean id="wrappedConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
     <property name="targetConnectionFactory">

	<!-- Shouldn't need this: the JNDI resource handles this. So maybe I
don't need this wrapped factory ? -->
	<!-- bean class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL" value="tcp://localhost:61616" />
	</bean -->
     </property>
</bean>

<!-- Is this where the JNDI name belongs? -->
<bean id="jndiConfig" class="org.apache.cxf.transport.jms.JNDIConfiguration">
     <property name="environment">
          <props>
               <prop
key="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</prop>

               <!-- does the name of the JNDI resource go here ?? -->

               <!-- Shouldn't need this: the JNDI resource handles this -->
               <!-- prop
key="java.naming.provider.url">tcp://localhost:61616</prop -->
          </props>
     </property>
</bean>



[2] Current applicationContext.xml, targeting the message queue directly (works)

<jaxws:endpoint
     xmlns:batch="urn://my.namespace.here" id="MyId"
     address="jms://" transportId="http://cxf.apache.org/transports/jms"
     serviceName="ns1:MyService"
     endpointName="ns1:MyPort"	
     implementor="com.some.path.MyImpl"
wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
     <jaxws:features>
          <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
	          <property name="jmsConfig" ref="jmsConfig" />
          </bean>
	</jaxws:features>
</jaxws:endpoint>
	
<bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
     <property name="connectionFactory" ref="wrappedConnectionFactory" />
     <property name="targetDestination" value="myRequestQueue"/>
     <property name="replyDestination" value="myResponseQueue"/>
     <!-- false means use queues, true means use topics  -->
     <property name="pubSubDomain" value="false"/>
</bean>
	
<bean id="wrappedConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
     <property name="targetConnectionFactory">
          <bean class="org.apache.activemq.ActiveMQConnectionFactory">
               <property name="brokerURL" value="tcp://localhost:61616" />
          </bean>
     </property>
</bean>

-Jeff

Re: Configuring CXF with JMS using a JNDI resource

Posted by Daniel Kulp <dk...@apache.org>.

> I am trying to configure the with weblogic jndi . I am getting error
>  org.apache.cxf.BusException: No DestinationFactory was found for the
> namespace http://www.w3.org/2010/soapjms/.
.....
> Let me know how to resolve this issue.
> I am using cxf 2.2

Likely upgrade to a newer version of CXF.   The SOAP/JMS specification support 
wasn't added until CXF 2.3.   

Dan



On Wednesday, January 25, 2012 10:16:06 AM smsarma wrote:
> I am trying to configure the with weblogic jndi . I am getting error
>  org.apache.cxf.BusException: No DestinationFactory was found for the
> namespace http://www.w3.org/2010/soapjms/.
> 
> here is the config
> 
> <jaxws:endpoint id="stockQuoteWebService"
> 		implementor="com.._2012._01.StockQuoteInterfaceImpl"
> 		address="jms://"   wsdlLocation="WEB-INF/wsdl/StockQuote.wsdl" >
> 		<jaxws:features>
> 			<bean class="org.apache.cxf.feature.LoggingFeature" />
> 			<bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
> 				<property name="jmsConfig" ref="jmsConfig" />
> 			</bean>
> 		</jaxws:features>
> 	</jaxws:endpoint>
> 
> <jee:jndi-lookup id="jmsConnectionFactory" jndi-name="JMSConnectionFactory">
> <jee:environment>
>       java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
>       java.naming.provider.url=t3://localhost:7001
>     </jee:environment>
>  </jee:jndi-lookup>
> 
> <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
> 
> 		<property name="connectionFactory" ref="jmsConnectionFactory" />
> 		<property name="destinationResolver" ref="jndiDestinationResolver" 
/>
> 		<property name="targetDestination" value="TestRequestQueue" />
> 		<property name="replyDestination" value="TestResponseQueue" />
> 		<property name="wrapInSingleConnectionFactory" value="false" />
> 		<property name="reconnectOnException" value="true"/>
> 		<property name="pubSubDomain" value="false"/>
> 	</bean><!--
> 
> 
> Let me know how to resolve this issue.
> I am using cxf 2.2
> 
> 
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Configuring-CXF-with-JMS-using-a-JNDI-resou
> rce-tp2838432p5430946.html Sent from the cxf-user mailing list archive at
> Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: Configuring CXF with JMS using a JNDI resource

Posted by smsarma <sm...@yahoo.com>.
I am trying to configure the with weblogic jndi . I am getting error 
 org.apache.cxf.BusException: No DestinationFactory was found for the
namespace http://www.w3.org/2010/soapjms/.

here is the config 

<jaxws:endpoint id="stockQuoteWebService"
		implementor="com.._2012._01.StockQuoteInterfaceImpl"
		address="jms://"   wsdlLocation="WEB-INF/wsdl/StockQuote.wsdl" >
		<jaxws:features>
			<bean class="org.apache.cxf.feature.LoggingFeature" />
			<bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
				<property name="jmsConfig" ref="jmsConfig" />
			</bean>
		</jaxws:features>
	</jaxws:endpoint>

<jee:jndi-lookup id="jmsConnectionFactory" jndi-name="JMSConnectionFactory">
    <jee:environment>
      java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
      java.naming.provider.url=t3://localhost:7001
    </jee:environment>
 </jee:jndi-lookup>

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

		<property name="connectionFactory" ref="jmsConnectionFactory" />
		<property name="destinationResolver" ref="jndiDestinationResolver" />
		<property name="targetDestination" value="TestRequestQueue" />
		<property name="replyDestination" value="TestResponseQueue" />
		<property name="wrapInSingleConnectionFactory" value="false" />
		<property name="reconnectOnException" value="true"/>
		<property name="pubSubDomain" value="false"/> 
	</bean><!--


Let me know how to resolve this issue.
I am using cxf 2.2




--
View this message in context: http://cxf.547215.n5.nabble.com/Configuring-CXF-with-JMS-using-a-JNDI-resource-tp2838432p5430946.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Configuring CXF with JMS using a JNDI resource

Posted by Christian Schneider <ch...@die-schneider.net>.
  Hi Jeff,

that is interesting. Do you have any idea why this is happening? If it 
is a common problem with jndi connectionfactories we could
document it in the wiki.

Would you mind posting your working config. I will try to make some 
documentation or an example from it.

Best regards

Christian


Am 22.09.2010 17:33, schrieb Jeffrey Knight:
> Thanks for the help on this. The missing piece to get CXF to work with
> MQ configured as a JNDI resource in WebSphere was :
>
> 		<property name="wrapInSingleConnectionFactory" value="false" />
>
> Without this settings, connections are dropped as soon as they're established.
>
> -Jeff
>
> On Wed, Sep 15, 2010 at 2:54 AM, Christian Schneider
> <ch...@die-schneider.net>  wrote:
>>   Hi Jeff,
>>
>> sorry for replying so late.
>>
>> For the connection factory you should use a jndi lookup like described in
>> the spring documentation:
>>
>> <jee:jndi-lookup id="*connectionFactory*" jndi-name="jndi name for the
>> connectionfactory"/>
>>
>> You will not need a Wrapper for the factory.
>>
>> To resolve the destinations via jndi you simply set the destinationResolver
>> in the JmsConfiguration to a spring JndiDestinationResolver. So you can use
>> jndi names for all destinations and spring will do the lookup.
>> http://www.jarvana.com/jarvana/view/org/springframework/spring/1.2.9/spring-1.2.9-javadoc.jar!/org/springframework/jms/support/destination/JndiDestinationResolver.html
>>
>> You will not need the  JNDIConfiguration from cxf. This is mainly used
>> internally if you configure jms using the wsdl. I am not exactly sure how
>> you define the Jndi config in spring but it should be described in the
>> spring documentations. In any case by injecting the connectionFactory and
>> destinationResolver like described above you should be able to use plain
>> spring jms config stuff.
>>
>> I hope I could help you a little. I think we do not yet have a nice example
>> for this. If you have more problems you can post your config and I will dig
>> more into it.
>>
>> Best Regards
>>
>> Christian
>>
>>
>> Am 14.09.2010 01:31, schrieb Jeffrey Knight:
>>> Hello
>>>
>>> I've developed a CXF service that uses JMS transport. My configuration
>>> [1] is all in the applicationContext.xml rather than WSDL or in the
>>> code as part of the @WebService.
>>>
>>> Now, instead of targeting the JMS directly, I want to use a JNDI
>>> resource defined in WebSphere.
>>> I haven't been able to find any documentation on how to do this with
>>> CXF (but I keep finding information on "<jms:conduit" and
>>> "<jms:destination"
>>> configurations which I believe have been superseded by the
>>> JMSConfigFeature).
>>>
>>> I'm expecting that I will NOT need the tcp://... broker url, since
>>> that's already configured in the JNDI resource itself.
>>> I should only need:
>>> - JNDI name (as configured in WebSphere)
>>> - targetDestination (the JNDI name of the target queue)
>>> - replyDestination (then JNDI name of the target queue)
>>> - username (optional)
>>> - password (optional).
>>>
>>> But I'm confused about the "wrapped connection factory" and
>>> org.apache.cxf.transport.jms.JNDIConfiguration pieces.
>>>
>>> Where does the JNDI configuration go, and what parameters do I need?
>>>
>>> <jaxws:endpoint
>>>       xmlns:batch="urn://my.namespace.here" id="MyId"
>>>       address="jms://" transportId="http://cxf.apache.org/transports/jms"
>>>       serviceName="ns1:MyService"
>>>       endpointName="ns1:MyPort"
>>>       implementor="com.some.path.MyImpl"
>>>
>>> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>>>       <jaxws:features>
>>>            <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
>>>         <property name="jmsConfig" ref="jmsConfig" />
>>>            </bean>
>>>         </jaxws:features>
>>> </jaxws:endpoint>
>>>
>>> <bean id="jmsConfig"
>>> class="org.apache.cxf.transport.jms.JMSConfiguration">
>>>
>>>       <!-- Do I need a wrapped connection factory to access a JNDI
>>> resource ? -->
>>>       <property name="connectionFactory" ref="wrappedConnectionFactory" />
>>>
>>>       <!-- These should be the JNDI names of the queues ... -->
>>>       <property name="targetDestination" value="myRequestQueue"/>
>>>       <property name="replyDestination" value="myResponseQueue"/>
>>>
>>>       <!-- I'm guessing I'll need this ... -->
>>>       <property name="jndiConfig" ref="jndiConfig" />
>>> </bean>
>>>
>>> <!-- Maybe I don't need the wrapped connection at all for a JNDI-JMS
>>> config ? -->
>>> <bean id="wrappedConnectionFactory"
>>> class="org.springframework.jms.connection.SingleConnectionFactory">
>>>       <property name="targetConnectionFactory">
>>>
>>>         <!-- Shouldn't need this: the JNDI resource handles this. So maybe
>>> I
>>> don't need this wrapped factory ? -->
>>>         <!-- bean class="org.apache.activemq.ActiveMQConnectionFactory">
>>>                 <property name="brokerURL" value="tcp://localhost:61616" />
>>>         </bean -->
>>>       </property>
>>> </bean>
>>>
>>> <!-- Is this where the JNDI name belongs? -->
>>> <bean id="jndiConfig"
>>> class="org.apache.cxf.transport.jms.JNDIConfiguration">
>>>       <property name="environment">
>>>            <props>
>>>                 <prop
>>>
>>> key="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</prop>
>>>
>>>                 <!-- does the name of the JNDI resource go here ?? -->
>>>
>>>                 <!-- Shouldn't need this: the JNDI resource handles this
>>> -->
>>>                 <!-- prop
>>> key="java.naming.provider.url">tcp://localhost:61616</prop -->
>>>            </props>
>>>       </property>
>>> </bean>
>>>
>>>
>>>
>>> [2] Current applicationContext.xml, targeting the message queue directly
>>> (works)
>>>
>>> <jaxws:endpoint
>>>       xmlns:batch="urn://my.namespace.here" id="MyId"
>>>       address="jms://" transportId="http://cxf.apache.org/transports/jms"
>>>       serviceName="ns1:MyService"
>>>       endpointName="ns1:MyPort"
>>>       implementor="com.some.path.MyImpl"
>>>
>>> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>>>       <jaxws:features>
>>>            <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
>>>         <property name="jmsConfig" ref="jmsConfig" />
>>>            </bean>
>>>         </jaxws:features>
>>> </jaxws:endpoint>
>>>
>>> <bean id="jmsConfig"
>>> class="org.apache.cxf.transport.jms.JMSConfiguration">
>>>       <property name="connectionFactory" ref="wrappedConnectionFactory" />
>>>       <property name="targetDestination" value="myRequestQueue"/>
>>>       <property name="replyDestination" value="myResponseQueue"/>
>>>       <!-- false means use queues, true means use topics  -->
>>>       <property name="pubSubDomain" value="false"/>
>>> </bean>
>>>
>>> <bean id="wrappedConnectionFactory"
>>> class="org.springframework.jms.connection.SingleConnectionFactory">
>>>       <property name="targetConnectionFactory">
>>>            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>>>                 <property name="brokerURL" value="tcp://localhost:61616" />
>>>            </bean>
>>>       </property>
>>> </bean>
>>>
>>> -Jeff
>>>
>> --
>> ----

-- 
----
http://www.liquid-reality.de


Re: Configuring CXF with JMS using a JNDI resource

Posted by Jeffrey Knight <je...@gmail.com>.
Thanks for the help on this. The missing piece to get CXF to work with
MQ configured as a JNDI resource in WebSphere was :

		<property name="wrapInSingleConnectionFactory" value="false" />

Without this settings, connections are dropped as soon as they're established.

-Jeff

On Wed, Sep 15, 2010 at 2:54 AM, Christian Schneider
<ch...@die-schneider.net> wrote:
>  Hi Jeff,
>
> sorry for replying so late.
>
> For the connection factory you should use a jndi lookup like described in
> the spring documentation:
>
> <jee:jndi-lookup id="*connectionFactory*" jndi-name="jndi name for the
> connectionfactory"/>
>
> You will not need a Wrapper for the factory.
>
> To resolve the destinations via jndi you simply set the destinationResolver
> in the JmsConfiguration to a spring JndiDestinationResolver. So you can use
> jndi names for all destinations and spring will do the lookup.
> http://www.jarvana.com/jarvana/view/org/springframework/spring/1.2.9/spring-1.2.9-javadoc.jar!/org/springframework/jms/support/destination/JndiDestinationResolver.html
>
> You will not need the  JNDIConfiguration from cxf. This is mainly used
> internally if you configure jms using the wsdl. I am not exactly sure how
> you define the Jndi config in spring but it should be described in the
> spring documentations. In any case by injecting the connectionFactory and
> destinationResolver like described above you should be able to use plain
> spring jms config stuff.
>
> I hope I could help you a little. I think we do not yet have a nice example
> for this. If you have more problems you can post your config and I will dig
> more into it.
>
> Best Regards
>
> Christian
>
>
> Am 14.09.2010 01:31, schrieb Jeffrey Knight:
>>
>> Hello
>>
>> I've developed a CXF service that uses JMS transport. My configuration
>> [1] is all in the applicationContext.xml rather than WSDL or in the
>> code as part of the @WebService.
>>
>> Now, instead of targeting the JMS directly, I want to use a JNDI
>> resource defined in WebSphere.
>> I haven't been able to find any documentation on how to do this with
>> CXF (but I keep finding information on "<jms:conduit" and
>> "<jms:destination"
>> configurations which I believe have been superseded by the
>> JMSConfigFeature).
>>
>> I'm expecting that I will NOT need the tcp://... broker url, since
>> that's already configured in the JNDI resource itself.
>> I should only need:
>> - JNDI name (as configured in WebSphere)
>> - targetDestination (the JNDI name of the target queue)
>> - replyDestination (then JNDI name of the target queue)
>> - username (optional)
>> - password (optional).
>>
>> But I'm confused about the "wrapped connection factory" and
>> org.apache.cxf.transport.jms.JNDIConfiguration pieces.
>>
>> Where does the JNDI configuration go, and what parameters do I need?
>>
>> <jaxws:endpoint
>>      xmlns:batch="urn://my.namespace.here" id="MyId"
>>      address="jms://" transportId="http://cxf.apache.org/transports/jms"
>>      serviceName="ns1:MyService"
>>      endpointName="ns1:MyPort"
>>      implementor="com.some.path.MyImpl"
>>
>> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>>      <jaxws:features>
>>           <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
>>        <property name="jmsConfig" ref="jmsConfig" />
>>           </bean>
>>        </jaxws:features>
>> </jaxws:endpoint>
>>
>> <bean id="jmsConfig"
>> class="org.apache.cxf.transport.jms.JMSConfiguration">
>>
>>      <!-- Do I need a wrapped connection factory to access a JNDI
>> resource ? -->
>>      <property name="connectionFactory" ref="wrappedConnectionFactory" />
>>
>>      <!-- These should be the JNDI names of the queues ... -->
>>      <property name="targetDestination" value="myRequestQueue"/>
>>      <property name="replyDestination" value="myResponseQueue"/>
>>
>>      <!-- I'm guessing I'll need this ... -->
>>      <property name="jndiConfig" ref="jndiConfig" />
>> </bean>
>>
>> <!-- Maybe I don't need the wrapped connection at all for a JNDI-JMS
>> config ? -->
>> <bean id="wrappedConnectionFactory"
>> class="org.springframework.jms.connection.SingleConnectionFactory">
>>      <property name="targetConnectionFactory">
>>
>>        <!-- Shouldn't need this: the JNDI resource handles this. So maybe
>> I
>> don't need this wrapped factory ? -->
>>        <!-- bean class="org.apache.activemq.ActiveMQConnectionFactory">
>>                <property name="brokerURL" value="tcp://localhost:61616" />
>>        </bean -->
>>      </property>
>> </bean>
>>
>> <!-- Is this where the JNDI name belongs? -->
>> <bean id="jndiConfig"
>> class="org.apache.cxf.transport.jms.JNDIConfiguration">
>>      <property name="environment">
>>           <props>
>>                <prop
>>
>> key="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</prop>
>>
>>                <!-- does the name of the JNDI resource go here ?? -->
>>
>>                <!-- Shouldn't need this: the JNDI resource handles this
>> -->
>>                <!-- prop
>> key="java.naming.provider.url">tcp://localhost:61616</prop -->
>>           </props>
>>      </property>
>> </bean>
>>
>>
>>
>> [2] Current applicationContext.xml, targeting the message queue directly
>> (works)
>>
>> <jaxws:endpoint
>>      xmlns:batch="urn://my.namespace.here" id="MyId"
>>      address="jms://" transportId="http://cxf.apache.org/transports/jms"
>>      serviceName="ns1:MyService"
>>      endpointName="ns1:MyPort"
>>      implementor="com.some.path.MyImpl"
>>
>> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>>      <jaxws:features>
>>           <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
>>        <property name="jmsConfig" ref="jmsConfig" />
>>           </bean>
>>        </jaxws:features>
>> </jaxws:endpoint>
>>
>> <bean id="jmsConfig"
>> class="org.apache.cxf.transport.jms.JMSConfiguration">
>>      <property name="connectionFactory" ref="wrappedConnectionFactory" />
>>      <property name="targetDestination" value="myRequestQueue"/>
>>      <property name="replyDestination" value="myResponseQueue"/>
>>      <!-- false means use queues, true means use topics  -->
>>      <property name="pubSubDomain" value="false"/>
>> </bean>
>>
>> <bean id="wrappedConnectionFactory"
>> class="org.springframework.jms.connection.SingleConnectionFactory">
>>      <property name="targetConnectionFactory">
>>           <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>>                <property name="brokerURL" value="tcp://localhost:61616" />
>>           </bean>
>>      </property>
>> </bean>
>>
>> -Jeff
>>
>
> --
> ----

Re: Configuring CXF with JMS using a JNDI resource

Posted by Christian Schneider <ch...@die-schneider.net>.
  Hi Jeff,

sorry for replying so late.

For the connection factory you should use a jndi lookup like described 
in the spring documentation:

<jee:jndi-lookup id="*connectionFactory*" jndi-name="jndi name for the connectionfactory"/>

You will not need a Wrapper for the factory.

To resolve the destinations via jndi you simply set the 
destinationResolver in the JmsConfiguration to a spring 
JndiDestinationResolver. So you can use jndi names for all destinations 
and spring will do the lookup.
http://www.jarvana.com/jarvana/view/org/springframework/spring/1.2.9/spring-1.2.9-javadoc.jar!/org/springframework/jms/support/destination/JndiDestinationResolver.html

You will not need the  JNDIConfiguration from cxf. This is mainly used 
internally if you configure jms using the wsdl. I am not exactly sure 
how you define the Jndi config in spring but it should be described in 
the spring documentations. In any case by injecting the 
connectionFactory and destinationResolver like described above you 
should be able to use plain spring jms config stuff.

I hope I could help you a little. I think we do not yet have a nice 
example for this. If you have more problems you can post your config and 
I will dig more into it.

Best Regards

Christian


Am 14.09.2010 01:31, schrieb Jeffrey Knight:
> Hello
>
> I've developed a CXF service that uses JMS transport. My configuration
> [1] is all in the applicationContext.xml rather than WSDL or in the
> code as part of the @WebService.
>
> Now, instead of targeting the JMS directly, I want to use a JNDI
> resource defined in WebSphere.
> I haven't been able to find any documentation on how to do this with
> CXF (but I keep finding information on "<jms:conduit" and
> "<jms:destination"
> configurations which I believe have been superseded by the JMSConfigFeature).
>
> I'm expecting that I will NOT need the tcp://... broker url, since
> that's already configured in the JNDI resource itself.
> I should only need:
> - JNDI name (as configured in WebSphere)
> - targetDestination (the JNDI name of the target queue)
> - replyDestination (then JNDI name of the target queue)
> - username (optional)
> - password (optional).
>
> But I'm confused about the "wrapped connection factory" and
> org.apache.cxf.transport.jms.JNDIConfiguration pieces.
>
> Where does the JNDI configuration go, and what parameters do I need?
>
> <jaxws:endpoint
>       xmlns:batch="urn://my.namespace.here" id="MyId"
>       address="jms://" transportId="http://cxf.apache.org/transports/jms"
>       serviceName="ns1:MyService"
>       endpointName="ns1:MyPort"	
>       implementor="com.some.path.MyImpl"
> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>       <jaxws:features>
>            <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
> 	<property name="jmsConfig" ref="jmsConfig" />
>            </bean>
> 	</jaxws:features>
> </jaxws:endpoint>
>
> <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
>
>       <!-- Do I need a wrapped connection factory to access a JNDI
> resource ? -->
>       <property name="connectionFactory" ref="wrappedConnectionFactory" />
>
>       <!-- These should be the JNDI names of the queues ... -->
>       <property name="targetDestination" value="myRequestQueue"/>
>       <property name="replyDestination" value="myResponseQueue"/>
>
>       <!-- I'm guessing I'll need this ... -->
>       <property name="jndiConfig" ref="jndiConfig" />
> </bean>
>
> <!-- Maybe I don't need the wrapped connection at all for a JNDI-JMS
> config ? -->
> <bean id="wrappedConnectionFactory"
> class="org.springframework.jms.connection.SingleConnectionFactory">
>       <property name="targetConnectionFactory">
>
> 	<!-- Shouldn't need this: the JNDI resource handles this. So maybe I
> don't need this wrapped factory ? -->
> 	<!-- bean class="org.apache.activemq.ActiveMQConnectionFactory">
> 		<property name="brokerURL" value="tcp://localhost:61616" />
> 	</bean -->
>       </property>
> </bean>
>
> <!-- Is this where the JNDI name belongs? -->
> <bean id="jndiConfig" class="org.apache.cxf.transport.jms.JNDIConfiguration">
>       <property name="environment">
>            <props>
>                 <prop
> key="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</prop>
>
>                 <!-- does the name of the JNDI resource go here ?? -->
>
>                 <!-- Shouldn't need this: the JNDI resource handles this -->
>                 <!-- prop
> key="java.naming.provider.url">tcp://localhost:61616</prop -->
>            </props>
>       </property>
> </bean>
>
>
>
> [2] Current applicationContext.xml, targeting the message queue directly (works)
>
> <jaxws:endpoint
>       xmlns:batch="urn://my.namespace.here" id="MyId"
>       address="jms://" transportId="http://cxf.apache.org/transports/jms"
>       serviceName="ns1:MyService"
>       endpointName="ns1:MyPort"	
>       implementor="com.some.path.MyImpl"
> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>       <jaxws:features>
>            <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
> 	<property name="jmsConfig" ref="jmsConfig" />
>            </bean>
> 	</jaxws:features>
> </jaxws:endpoint>
> 	
> <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
>       <property name="connectionFactory" ref="wrappedConnectionFactory" />
>       <property name="targetDestination" value="myRequestQueue"/>
>       <property name="replyDestination" value="myResponseQueue"/>
>       <!-- false means use queues, true means use topics  -->
>       <property name="pubSubDomain" value="false"/>
> </bean>
> 	
> <bean id="wrappedConnectionFactory"
> class="org.springframework.jms.connection.SingleConnectionFactory">
>       <property name="targetConnectionFactory">
>            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>                 <property name="brokerURL" value="tcp://localhost:61616" />
>            </bean>
>       </property>
> </bean>
>
> -Jeff
>

-- 
----
http://www.liquid-reality.de


Re: Configuring CXF with JMS using a JNDI resource

Posted by Jeffrey Knight <je...@gmail.com>.
Jeffrey Knight <je...@...> writes:
> 
> I'm still drawing a blank on the JNDI config for JMS.
> 
> Can anyone who's successfully configured CXF with JMS transport,
> referencing a message queue defined as a (WebSphere)
> JNDI resource
> point me in the right direction?
> 
> Thanks,
> Jeff
> 

Just in case anyone is looking for this in the future, here's the config for CXF
+ JMS via JNDI

<jee:jndi-lookup id="myTargetConnectionFactory" 
            jndi-name="${mq.jndi-name}"/>
<bean id="jmsDestResolver"
class="org.springframework.jms.support.destination
          .JndiDestinationResolver"/>

<bean id="myConnectionFactory"
class="org.springframework.jms.connection
            .UserCredentialsConnectionFactoryAdapter">
    <property name="targetConnectionFactory" 
              ref="myTargetConnectionFactory"/>
    <property name="username" value="${mq.username}"/>
    <property name="password" value=""/>
</bean>

<bean id="jmsConfig" class="org.apache.camel.component.jms
          .JmsConfiguration">
    <property name="connectionFactory" ref="myConnectionFactory" />
    <property name="destinationResolver" ref="jmsDestResolver" />
    <property name="concurrentConsumers" value="1" />
    <property name="maxConcurrentConsumers" value="10" />
    <property name="cacheLevelName" value="CACHE_NONE" />
</bean>


Re: Configuring CXF with JMS using a JNDI resource

Posted by Jeffrey Knight <je...@gmail.com>.
I'm still drawing a blank on the JNDI config for JMS.

Can anyone who's successfully configured CXF with JMS transport,
referencing a message queue defined as a (WebSphere) JNDI resource
point me in the right direction?

Thanks,
Jeff

On Mon, Sep 13, 2010 at 8:00 PM, Jeffrey Knight
<je...@gmail.com> wrote:
> Perhaps I can use Spring's JMS Config ?
>
> http://onjava.com/pub/a/onjava/2006/02/22/asynchronous-messaging-with-spring-jms.html?page=4
>
>
> On Mon, Sep 13, 2010 at 7:31 PM, Jeffrey Knight
> <je...@gmail.com> wrote:
>> Hello
>>
>> I've developed a CXF service that uses JMS transport. My configuration
>> [1] is all in the applicationContext.xml rather than WSDL or in the
>> code as part of the @WebService.
>>
>> Now, instead of targeting the JMS directly, I want to use a JNDI
>> resource defined in WebSphere.
>> I haven't been able to find any documentation on how to do this with
>> CXF (but I keep finding information on "<jms:conduit" and
>> "<jms:destination"
>> configurations which I believe have been superseded by the JMSConfigFeature).
>>
>> I'm expecting that I will NOT need the tcp://... broker url, since
>> that's already configured in the JNDI resource itself.
>> I should only need:
>> - JNDI name (as configured in WebSphere)
>> - targetDestination (the JNDI name of the target queue)
>> - replyDestination (then JNDI name of the target queue)
>> - username (optional)
>> - password (optional).
>>
>> But I'm confused about the "wrapped connection factory" and
>> org.apache.cxf.transport.jms.JNDIConfiguration pieces.
>>
>> Where does the JNDI configuration go, and what parameters do I need?
>>
>> <jaxws:endpoint
>>     xmlns:batch="urn://my.namespace.here" id="MyId"
>>     address="jms://" transportId="http://cxf.apache.org/transports/jms"
>>     serviceName="ns1:MyService"
>>     endpointName="ns1:MyPort"
>>     implementor="com.some.path.MyImpl"
>> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>>     <jaxws:features>
>>          <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
>>                  <property name="jmsConfig" ref="jmsConfig" />
>>          </bean>
>>        </jaxws:features>
>> </jaxws:endpoint>
>>
>> <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
>>
>>     <!-- Do I need a wrapped connection factory to access a JNDI
>> resource ? -->
>>     <property name="connectionFactory" ref="wrappedConnectionFactory" />
>>
>>     <!-- These should be the JNDI names of the queues ... -->
>>     <property name="targetDestination" value="myRequestQueue"/>
>>     <property name="replyDestination" value="myResponseQueue"/>
>>
>>     <!-- I'm guessing I'll need this ... -->
>>     <property name="jndiConfig" ref="jndiConfig" />
>> </bean>
>>
>> <!-- Maybe I don't need the wrapped connection at all for a JNDI-JMS
>> config ? -->
>> <bean id="wrappedConnectionFactory"
>> class="org.springframework.jms.connection.SingleConnectionFactory">
>>     <property name="targetConnectionFactory">
>>
>>        <!-- Shouldn't need this: the JNDI resource handles this. So maybe I
>> don't need this wrapped factory ? -->
>>        <!-- bean class="org.apache.activemq.ActiveMQConnectionFactory">
>>                <property name="brokerURL" value="tcp://localhost:61616" />
>>        </bean -->
>>     </property>
>> </bean>
>>
>> <!-- Is this where the JNDI name belongs? -->
>> <bean id="jndiConfig" class="org.apache.cxf.transport.jms.JNDIConfiguration">
>>     <property name="environment">
>>          <props>
>>               <prop
>> key="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</prop>
>>
>>               <!-- does the name of the JNDI resource go here ?? -->
>>
>>               <!-- Shouldn't need this: the JNDI resource handles this -->
>>               <!-- prop
>> key="java.naming.provider.url">tcp://localhost:61616</prop -->
>>          </props>
>>     </property>
>> </bean>
>>
>>
>>
>> [2] Current applicationContext.xml, targeting the message queue directly (works)
>>
>> <jaxws:endpoint
>>     xmlns:batch="urn://my.namespace.here" id="MyId"
>>     address="jms://" transportId="http://cxf.apache.org/transports/jms"
>>     serviceName="ns1:MyService"
>>     endpointName="ns1:MyPort"
>>     implementor="com.some.path.MyImpl"
>> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>>     <jaxws:features>
>>          <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
>>                  <property name="jmsConfig" ref="jmsConfig" />
>>          </bean>
>>        </jaxws:features>
>> </jaxws:endpoint>
>>
>> <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
>>     <property name="connectionFactory" ref="wrappedConnectionFactory" />
>>     <property name="targetDestination" value="myRequestQueue"/>
>>     <property name="replyDestination" value="myResponseQueue"/>
>>     <!-- false means use queues, true means use topics  -->
>>     <property name="pubSubDomain" value="false"/>
>> </bean>
>>
>> <bean id="wrappedConnectionFactory"
>> class="org.springframework.jms.connection.SingleConnectionFactory">
>>     <property name="targetConnectionFactory">
>>          <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>>               <property name="brokerURL" value="tcp://localhost:61616" />
>>          </bean>
>>     </property>
>> </bean>
>>
>> -Jeff
>>
>

Re: Configuring CXF with JMS using a JNDI resource

Posted by Jeffrey Knight <je...@gmail.com>.
Perhaps I can use Spring's JMS Config ?

http://onjava.com/pub/a/onjava/2006/02/22/asynchronous-messaging-with-spring-jms.html?page=4


On Mon, Sep 13, 2010 at 7:31 PM, Jeffrey Knight
<je...@gmail.com> wrote:
> Hello
>
> I've developed a CXF service that uses JMS transport. My configuration
> [1] is all in the applicationContext.xml rather than WSDL or in the
> code as part of the @WebService.
>
> Now, instead of targeting the JMS directly, I want to use a JNDI
> resource defined in WebSphere.
> I haven't been able to find any documentation on how to do this with
> CXF (but I keep finding information on "<jms:conduit" and
> "<jms:destination"
> configurations which I believe have been superseded by the JMSConfigFeature).
>
> I'm expecting that I will NOT need the tcp://... broker url, since
> that's already configured in the JNDI resource itself.
> I should only need:
> - JNDI name (as configured in WebSphere)
> - targetDestination (the JNDI name of the target queue)
> - replyDestination (then JNDI name of the target queue)
> - username (optional)
> - password (optional).
>
> But I'm confused about the "wrapped connection factory" and
> org.apache.cxf.transport.jms.JNDIConfiguration pieces.
>
> Where does the JNDI configuration go, and what parameters do I need?
>
> <jaxws:endpoint
>     xmlns:batch="urn://my.namespace.here" id="MyId"
>     address="jms://" transportId="http://cxf.apache.org/transports/jms"
>     serviceName="ns1:MyService"
>     endpointName="ns1:MyPort"
>     implementor="com.some.path.MyImpl"
> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>     <jaxws:features>
>          <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
>                  <property name="jmsConfig" ref="jmsConfig" />
>          </bean>
>        </jaxws:features>
> </jaxws:endpoint>
>
> <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
>
>     <!-- Do I need a wrapped connection factory to access a JNDI
> resource ? -->
>     <property name="connectionFactory" ref="wrappedConnectionFactory" />
>
>     <!-- These should be the JNDI names of the queues ... -->
>     <property name="targetDestination" value="myRequestQueue"/>
>     <property name="replyDestination" value="myResponseQueue"/>
>
>     <!-- I'm guessing I'll need this ... -->
>     <property name="jndiConfig" ref="jndiConfig" />
> </bean>
>
> <!-- Maybe I don't need the wrapped connection at all for a JNDI-JMS
> config ? -->
> <bean id="wrappedConnectionFactory"
> class="org.springframework.jms.connection.SingleConnectionFactory">
>     <property name="targetConnectionFactory">
>
>        <!-- Shouldn't need this: the JNDI resource handles this. So maybe I
> don't need this wrapped factory ? -->
>        <!-- bean class="org.apache.activemq.ActiveMQConnectionFactory">
>                <property name="brokerURL" value="tcp://localhost:61616" />
>        </bean -->
>     </property>
> </bean>
>
> <!-- Is this where the JNDI name belongs? -->
> <bean id="jndiConfig" class="org.apache.cxf.transport.jms.JNDIConfiguration">
>     <property name="environment">
>          <props>
>               <prop
> key="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</prop>
>
>               <!-- does the name of the JNDI resource go here ?? -->
>
>               <!-- Shouldn't need this: the JNDI resource handles this -->
>               <!-- prop
> key="java.naming.provider.url">tcp://localhost:61616</prop -->
>          </props>
>     </property>
> </bean>
>
>
>
> [2] Current applicationContext.xml, targeting the message queue directly (works)
>
> <jaxws:endpoint
>     xmlns:batch="urn://my.namespace.here" id="MyId"
>     address="jms://" transportId="http://cxf.apache.org/transports/jms"
>     serviceName="ns1:MyService"
>     endpointName="ns1:MyPort"
>     implementor="com.some.path.MyImpl"
> wsdlLocation="jar:file:WEB-INF/lib/MyWebServiceContracts.jar!/some/path/My.wsdl">
>     <jaxws:features>
>          <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
>                  <property name="jmsConfig" ref="jmsConfig" />
>          </bean>
>        </jaxws:features>
> </jaxws:endpoint>
>
> <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
>     <property name="connectionFactory" ref="wrappedConnectionFactory" />
>     <property name="targetDestination" value="myRequestQueue"/>
>     <property name="replyDestination" value="myResponseQueue"/>
>     <!-- false means use queues, true means use topics  -->
>     <property name="pubSubDomain" value="false"/>
> </bean>
>
> <bean id="wrappedConnectionFactory"
> class="org.springframework.jms.connection.SingleConnectionFactory">
>     <property name="targetConnectionFactory">
>          <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>               <property name="brokerURL" value="tcp://localhost:61616" />
>          </bean>
>     </property>
> </bean>
>
> -Jeff
>