4 Replies Latest reply on Aug 16, 2007 3:11 AM by timfox

    Spring JNDI lookup using proxyInterface fails

    nkhadakk

      I am attempting to use Spring(2.0.6) JMSTemplate with JBoss Messaging (1.3). Spring JNDI lookups can defer actual 'connection' to the first time the object is to be used...For this to be possible we need to supply a 'proxyInterface' like so :

      <bean id="URIQueue"
       class="org.springframework.jndi.JndiObjectFactoryBean">
       <property name="jndiTemplate">
       <ref bean="jndiTemplate"/>
       </property>
       <property name="jndiName">
       <value>/queue/UniversalResourceProcessingQueue</value>
       </property>
       <property name="lookupOnStartup">
       <value>false</value>
       </property>
       <property name="proxyInterface">
       <value>javax.jms.Queue</value>
       </property>
       <property name="cache">
       <value>true</value>
       </property>
       </bean>


      This causes the following exception to be thrown from jboss code.

      Caused by: javax.jms.InvalidDestinationException: Not a JBossDestination:JBossQueue[UniversalResourceProcessingQueue]
      at org.jboss.jms.client.JBossSession.createProducer(JBossSession.java:206)
      at org.springframework.jms.core.JmsTemplate.doCreateProducer(JmsTemplate.java:846)
      at org.springframework.jms.core.JmsTemplate.createProducer(JmsTemplate.java:827)
      at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:505)


      This error occurs due to using 'javax.jms.Queue' as the interface causing the Proxy created to implement Queue and hence failing the instanceOf JBossDestination test in JBossSession.
      If we had a JBossDestination interface available we could use this interface to create a proxy.

      Does the messaging team have any plan of refactoring this particular code to use an Interface based implementation ?