6 Replies Latest reply on Dec 15, 2006 9:47 AM by chaitanya

    javax.jms.InvalidDestinationException: Destination is not an

    chaitanya Novice

      followed this url and deployed new new messaging instance
      http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossMessagingBuildInstructions

      i created mdb.ear and deployed in the mesaging instance.my requirement is i am trying to lookup remote queue;

      i followed below url for scoped ear for Remote Messaging Instance.

      http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossMessagingUser_Deploying_a_scoped_MDB_container

      mdb.ear was deployed with no errors in messaging instance .

      in mesaging instance in directory jboss-messaging.sar i changed destinations-service.xml to create new queue(testQueue);
      below in jms-ds.xml in messaging instance;

      
      <?xml version="1.0" encoding="UTF-8"?>
      
      <connection-factories>
      
       <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
       name="jboss.mq:service=JMSProviderLoader,name=JMSProvider,server=172.16.7.12">
       <attribute name="ProviderName">QueuehostJMSProvider</attribute>
       <attribute name="ProviderAdapterClass">
       org.jboss.jms.jndi.JNDIProviderAdapter
       </attribute>
       <!-- The queue connection factory -->
       <attribute name="QueueFactoryRef">/XAConnectionFactory</attribute>
       <!-- The topic factory -->
       <attribute name="TopicFactoryRef">/XAConnectionFactory</attribute>
       <!-- Use HAJNDI to access JMS -->
       <attribute name="Properties">
       java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
       java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
       java.naming.provider.url=172.16.7.12:1099
       </attribute>
       </mbean>
      
      
       <mbean code="org.jboss.jms.asf.ServerSessionPoolLoader"
       name="jboss.messaging:service=ServerSessionPoolMBean,name=StdJMSPool">
       <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
       <attribute name="PoolName">StdJMSPool</attribute>
       <attribute name="PoolFactoryClass">org.jboss.jms.asf.StdServerSessionPoolFactory</attribute>
       </mbean>
      
      
       <tx-connection-factory>
       <jndi-name>JmsXA</jndi-name>
       <xa-transaction/>
       <rar-name>jms-ra.rar</rar-name>
       <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
       <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
       <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/QueuehostJMSProvider</config-property>
       <max-pool-size>20</max-pool-size>
       <security-domain-and-application>JmsXARealm</security-domain-and-application>
       <depends>jboss.messaging:service=ServerPeer</depends>
       </tx-connection-factory>
      
      </connection-factories>
      
      


      in messaging instance only i changed standardjboss.xml
      ****************************************************
      
      
       <invoker-proxy-binding>
       <name>my-mdb-invoker</name>
       <invoker-mbean>message-driven-bean</invoker-mbean>
       <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
       <proxy-factory-config>
       <JMSProviderAdapterJNDI>QueuehostJMSProvider</JMSProviderAdapterJNDI>
       <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
       <MinimumSize>1</MinimumSize>
       <MaximumSize>15</MaximumSize>
       <KeepAliveMillis>30000</KeepAliveMillis>
       <MaxMessages>1</MaxMessages>
       <MDBConfig>
       <ReconnectIntervalSec>10</ReconnectIntervalSec>
       <DLQConfig>
       <DestinationQueue>queue/DLQ</DestinationQueue>
       <MaxTimesRedelivered>10</MaxTimesRedelivered>
       <TimeToLive>0</TimeToLive>
       </DLQConfig>
       </MDBConfig>
       </proxy-factory-config>
       </invoker-proxy-binding>
      
      


      in the corresponding mdb.ear i changed jboss.xml
      ********************************
      
      
       <message-driven>
       <ejb-name>ExampleMessageDrivenBean</ejb-name>
       <configuration-name>Standard Message Driven Bean</configuration-name>
       <destination-jndi-name>queue/testQueue</destination-jndi-name>
       <invoker-bindings>
       <invoker>
       <invoker-proxy-binding-name>my-mdb-invoker</invoker-proxy-binding-name>
       </invoker>
       </invoker-bindings>
       </message-driven>
      
      


      client code is in default instance

      Properties env = new Properties();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      env.put(Context.PROVIDER_URL, "172.16.7.12:1099");
      
      Context remoteCtx = new InitialContext(env);
      Queue queue = (Queue)remoteCtx.lookup("queue/testQueue");
      QueueConnectionFactory queueFactory = (QueueConnectionFactory)remoteCtx.lookup("java:JmsXA");
      
      


      I am getting JmsXA not bound exception(what is the right way of look up ?)

      when i changed from JmsXA to java:/XAConnectionFactory i am getting queueFactory

      but i am getting below exception.

      javax.jms.InvalidDestinationException: Destination is not an instance of SpyDestination JBossQueue[testQueue]
      

      see my messaging instance log file

      2006-12-05 16:37:24,986 34739 INFO [org.jboss.jms.server.destination.Queue] @main Queue[/queue/DLQ] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,032 34785 INFO [org.jboss.jms.server.destination.Topic] @main Topic[/topic/testTopic] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,032 34785 INFO [org.jboss.jms.server.destination.Topic] @main Topic[/topic/securedTopic] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,048 34801 INFO [org.jboss.jms.server.destination.Topic] @main Topic[/topic/testDurableTopic] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,251 35004 INFO [org.jboss.jms.server.destination.Queue] @main Queue[/queue/testQueue] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,298 35051 INFO [org.jboss.jms.server.destination.Queue] @main Queue[/queue/A] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,298 35051 INFO [org.jboss.jms.server.destination.Queue] @main Queue[/queue/B] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,314 35067 INFO [org.jboss.jms.server.destination.Queue] @main Queue[/queue/C] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,329 35082 INFO [org.jboss.jms.server.destination.Queue] @main Queue[/queue/D] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,345 35098 INFO [org.jboss.jms.server.destination.Queue] @main Queue[/queue/ex] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,345 35098 INFO [org.jboss.jms.server.destination.Topic] @main Topic[/topic/openTopic] started, fullSize=75000, pageSize=2000, downCacheSize=2000
      2006-12-05 16:37:25,939 35692 INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] @main Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA to JNDI name 'java:JmsXA'
      


        • 1. Re: javax.jms.InvalidDestinationException: Destination is no
          Joshua Jackson Master

          You use JmsXA for local connection, but if you want to get the connection factory remotely (as in your example) you use queue/testQueue.

          • 2. Re: javax.jms.InvalidDestinationException: Destination is no
            chaitanya Novice

            U said for remote lookup u use testQueue but what about QueueConnectionFactory.how to lookup QueueConnectionFactory??

            when i send the message to the queue i am getting below exception.


            javax.jms.InvalidDestinationException: Destination is not an instance of SpyDestination JBossQueue[testQueue]
            
            
            Properties env = new Properties();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
            env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
            env.put(Context.PROVIDER_URL, "localhost:1099");
            Context remoteCtx = new InitialContext(env);
            Queue queue = (Queue)remoteCtx.lookup("queue/testQueue");
            System.out.println("queue="+queue);
            
            //I am getting queue correctly here
            
            
            QueueConnectionFactory queueFactory = (QueueConnectionFactory)remoteCtx.lookup("java:JmsXA");
            
            //How to get queueFactory here??
            
            System.out.println("queueFactory="+queueFactory);
            queueConnection = queueFactory.createQueueConnection();
            QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            QueueSender queueSender = queueSession.createSender(queue);
             System.out.println("queueSender="+queueSender);
             TextMessage message = queueSession.createTextMessage();
            
             message.setText(Long.toString(2));
             queueSender.send(message);
            
            


            • 3. Destination is not an instance of SpyDestination JBossQueue
              chaitanya Novice

              anyway queue is coming correctly.while sending the messages do to the queue i am getting exception.

              
               Properties env = new Properties();env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces"); env.put(Context.PROVIDER_URL, "172.16.7.12:1099"); Context remoteCtx = new InitialContext(env);Queue queue = (Queue)remoteCtx.lookup("queue/testQueue"); QueueConnectionFactory queueFactory =(QueueConnectionFactory)remoteCtx.lookup("ConnectionFactory"); queueConnection = queueFactory.createQueueConnection(); QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); QueueSender queueSender = queueSession.createSender(queue); TextMessage message = queueSession.createTextMessage(); message.setText(Long.toString(2));queueSender.send(message);
              
              






              this is the log file i am getting;


               2006-12-15 13:41:55,883 INFO [STDOUT] queue=JBossQueue[testQueue]2006-12-15 13:41:55,883 INFO [STDOUT] queueFactory=org.jboss.mq.SpyConnectionFactory@ee25db2006-12-15 13:41:55,883 INFO [STDOUT] queueSender=SpyMessageProducer@18073655[ dest=JBossQueue[testQueue] delivery=persist priority=4 ttl=0 disableMessageID=false disableTS=false session=SpySession@31137799[tx=false ack=AUTO txid=null RUNNING connection=Connection@29203625[token=ConnectionToken:ID:3/e754023924168169359317b4cb79f038 rcvstate=STOPPED]]]2006-12-15 13:41:55,883 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/sample].[jsp]] Servlet.service() for servlet jsp threw exceptionjavax.jms.InvalidDestinationException: Destination is not an instance of SpyDestination JBossQueue[testQueue] at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:225) at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:199) at org.apache.jsp.UploadSessionBean_jsp._jspService(org.apache.jsp.UploadSessionBean_jsp:83) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595)
              


              • 4. Re: javax.jms.InvalidDestinationException: Destination is no
                Tim Fox Master

                javax.jms.InvalidDestinationException: Destination is not an instance of SpyDestination JBossQueue[t
                estQueue]


                SpyDestination is a JBossMQ class, not JBoss Messaging.

                You are probably trying to use a JBossMQ client to talk to JBoss Messaging.

                I suspect you haven't uninstalled JBossMQ.

                • 5. Re: javax.jms.InvalidDestinationException: Destination is no
                  chaitanya Novice

                   

                  "timfox" wrote:
                  javax.jms.InvalidDestinationException: Destination is not an instance of SpyDestination JBossQueue[t
                  estQueue]


                  SpyDestination is a JBossMQ class, not JBoss Messaging.

                  You are probably trying to use a JBossMQ client to talk to JBoss Messaging.

                  I suspect you haven't uninstalled JBossMQ.


                  My client is in default instance.so how to uninstalled JBossMQ.??




                  • 6. Re: javax.jms.InvalidDestinationException: Destination is no
                    chaitanya Novice

                    aboveJMS client code is correct or not??