title: JNDI on JMS Integration with Spring and Webspehre MQ
body: <p>i wrote a WS-Application in Spring which support to create Messages into a JMS Queue.
   I developed it using an Apache Tomcat with ActiveMQ. Everthing works fine here, I have my JNDI resource can derive the Connection factory and send the message into the queue:</p>
  
  <pre><code>&lt;jee:jndi-lookup id="jndiJmsQueueConnectionFactory"
          jndi-name="${jms.factory.jndiName}" proxy-interface="javax.jms.ConnectionFactory"
          lookup-on-startup="false"&gt;
   &lt;/jee:jndi-lookup&gt;
  
  &lt;jee:jndi-lookup id="jndiSendQueue" jndi-name="${jms.myQueue.jndiName}"
          proxy-interface="javax.jms.Queue" lookup-on-startup="false"&gt;&lt;/jee:jndi-lookup&gt;
  
  &lt;bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;
          &lt;property name="connectionFactory" ref ="jmsQueueConnectionFactory"&gt;&lt;/property&gt;
          &lt;property name="sessionAcknowledgeModeName" value="AUTO_ACKNOWLEDGE"/&gt;
  
  &lt;/bean&gt;
  </code></pre>
  
  <p>Now we tried to move the web-application to the Websphere. The JNDI lookup works, the application can create the Factory, the Queue is found, but when my Code tries to create the producer via createProducer() the code throws this exception:</p>
  
  <pre><code>java.lang.ClassCastException: com.sun.proxy.$Proxy28 cannot be cast to com.ibm.mq.jms.MQDestination
  </code></pre>
  
  <p>I tried to replace "javax.jms.Queue" with "javax.jms.Destination" but not worked.</p>
  
  <p>when I remove proxy-interface it is working but I need that queue not to fetched when context is launching.</p>