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

Reply via email to