Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-411

When using permanent replyTo queues, their JNDI names can't start with jms/ in the defaultUri property of the WebServiceGateway


    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.5.5
    • Component/s: Core
    • Labels:
    • Environment:
      Websphere AppSrv 6.1


      We are using permanent queues defined as JNDI resources in a WAS 6.1. Their JNDI names start with jms/, for instance jms/RESPONSE_QUEUE.
      We have a client which is configured like this, along side with a jndiDestinationResolver and a jndiTemplate:
      <bean id="serviceGateway" class="net.croz.client.ServiceGatewayImpl">
      <property name="defaultUri" value="jms:jms/REQUEST_QUEUE?replyToName=jms/REPLY_QUEUE" />
      <property name="messageSenders">
      <bean class="org.springframework.ws.transport.jms.JmsMessageSender">
      <property name="connectionFactory" ref="mqConnectionFactory" />
      <property name="pubSubDomain" value="false" />
      <property name="destinationResolver" ref="jndiDestinationResolver"></property>
      <property name="receiveTimeout" value="10000"></property>

      <bean id="jndiTemplate"
      <property name="environment">
      <prop key="java.naming.factory.initial">com.ibm.websphere.naming.WsnInitialContextFactory</prop>
      <prop key="java.naming.provider.url">iiop://localhost:2810</prop>

      <bean id="jndiDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
      <property name="jndiTemplate" ref="jndiTemplate"></property>

      When invoking a fully functional web service (under our control), the request ends up in the REQUEST_QUEUE, but when the client tries to find the RESPONSE_QUEUE via its JNDI name (jms/REPLY_QUEUE) it fails with:
      Destination [jms] not found in JNDI; nested exception is org.springframework.jndi.TypeMismatchNamingException: Object of type [class com.ibm.ws.naming.jndicos.CNContextImpl] available at JNDI location [jms] is not assignable to [javax.jms.Destination]

      Observe the "..available at JNDI location [jms]..." part in particular... This led me to investigate the code responsible for parsing the defaultUri property of the WebServiceGateway. What I've found is that the regular expression responsible for the parsing of the replyToName part of the defaultUri:
      public abstract class JmsTransportUtils {
      private static final Pattern REPLY_TO_NAME_PATTERN = Pattern.compile("replyToName=(
      strips everything behind the "jms" part of the JNDI name.

      To do a quick fix, I've externalized the JmsTransportUtils class and changed the REPLY_TO_NAME_PATTERN to be similar to the DESTINATION_NAME_PATTERN:
      public abstract class JmsTransportUtils {
      private static final Pattern REPLY_TO_NAME_PATTERN = Pattern.compile("replyToName=([^\\?]+)");




            • Assignee:
              arjen.poutsma Arjen Poutsma
              miha Mihael Sedmak
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: