3 Replies Latest reply on Sep 26, 2007 1:30 AM by dinesh uikey

    Unable to connect to Queue from remote client

    Vincent OSullivan Newbie

      Iam using JBoss Server version 4.0.2 and EJB3.0 preview 5.

      I have the following problem when I try to connect to a Queue from a remote client:

      java.lang.ClassCastException: javax.naming.Reference
       at com.adaptivemobile.activity.dataprocess.test.TestClass.test1(TestClass.java:121)
       at com.adaptivemobile.activity.dataprocess.test.TestClass.main(TestClass.java:92)
      


      The error occcurs here:
       queue = (Queue)iCTX.lookup("queue/amsQueue");
      


      I have used the JMX management console to see if the queue is deployed and it is:

       +- jaas (class: javax.naming.Context)
       | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
       | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
       | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
       +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
       +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
       +- comp.ejb3 (class: javax.naming.Context)
       | NonContext: null
       +- JBossCorbaNaming (class: org.omg.CosNaming.NamingContextExt)
       +- DefaultDS (class: javax.sql.DataSource)
       +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
       +- TransactionManager (class: org.jboss.tm.TxManager)
       +- JBossCorbaPOA (class: org.omg.PortableServer.POA)
       +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
       +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- OracleDS (class: javax.sql.DataSource)
       +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
       +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- JBossCorbaInterfaceRepositoryPOA (class: org.omg.PortableServer.POA)
       +- Mail (class: javax.mail.Session)
       +- JBossCorbaORB (class: org.omg.CORBA.ORB)
       +- timedCacheFactory (class: javax.naming.Context)
      Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
       +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
       +- comp (class: javax.naming.Context)
      
      
      Global JNDI Namespace
      
       +- HASessionState (class: org.jnp.interfaces.NamingContext)
       | +- Default (class: org.jboss.ha.hasessionstate.server.HASessionStateImpl)
       +- com.adaptivemobile.frame.util.AsynchronousManager (proxy: $Proxy80 implements interface com.adaptivemobile.frame.util.AsynchronousManager,interface org.jboss.ejb3.JBossProxy)
       +- jmx (class: org.jnp.interfaces.NamingContext)
       | +- invoker (class: org.jnp.interfaces.NamingContext)
       | | +- RMIAdaptor (proxy: $Proxy39 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
       | +- rmi (class: org.jnp.interfaces.NamingContext)
       | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
       +- JAXR (class: org.apache.ws.scout.registry.ConnectionFactoryImpl)
       +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- UserTransactionSessionFactory (proxy: $Proxy11 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
       +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- invokers (class: org.jnp.interfaces.NamingContext)
       | +- lirix-tech (class: org.jnp.interfaces.NamingContext)
       | | +- iiop (class: org.jboss.invocation.iiop.IIOPInvoker)
       +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
       +- containers (class: org.jnp.interfaces.NamingContext)
       | +- com.adaptivemobile.frame.util.AsynchronousManagerBean (class: org.jboss.ejb3.stateless.StatelessContainer)
       | +- com.adaptivemobile.activity.group.GroupManagerBean (class: org.jboss.ejb3.stateless.StatelessContainer)
       | +- com.adaptivemobile.activity.filter.FilterManagerBean (class: org.jboss.ejb3.stateless.StatelessContainer)
       +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
       +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
       +- HAPartition (class: org.jnp.interfaces.NamingContext)
       | +- DefaultPartition (class: org.jboss.ha.framework.server.HAPartitionImpl)
       +- com.adaptivemobile.activity.filter.FilterManager (proxy: $Proxy76 implements interface com.adaptivemobile.activity.filter.FilterManager,interface org.jboss.ejb3.JBossProxy)
       +- queue (class: org.jnp.interfaces.NamingContext)
       | +- amsQueue (class: org.jboss.mq.SpyQueue)
       | +- A (class: org.jboss.mq.SpyQueue)
       | +- testQueue (class: org.jboss.mq.SpyQueue)
       | +- ex (class: org.jboss.mq.SpyQueue)
       | +- DLQ (class: org.jboss.mq.SpyQueue)
       | +- D (class: org.jboss.mq.SpyQueue)
       | +- C (class: org.jboss.mq.SpyQueue)
       | +- B (class: org.jboss.mq.SpyQueue)
       +- topic (class: org.jnp.interfaces.NamingContext)
       | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
       | +- testTopic (class: org.jboss.mq.SpyTopic)
       | +- securedTopic (class: org.jboss.mq.SpyTopic)
       +- console (class: org.jnp.interfaces.NamingContext)
       | +- PluginManager (proxy: $Proxy40 implements interface org.jboss.console.manager.PluginManagerMBean)
       +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
       +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
       +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
       +- com.adaptivemobile.activity.group.GroupManager (proxy: $Proxy78 implements interface com.adaptivemobile.activity.group.GroupManager,interface org.jboss.ejb3.JBossProxy)
       +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
      


      Here are my JNDI setting:

      Properties properties = new Properties();
       properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       properties.put(Context.PROVIDER_URL, "jnp://localhost:1099");
       iCTX = new InitialContext(properties);
      


      I cant see why this is not working... any insights would be most welcome.