0 Replies Latest reply on Jun 12, 2007 7:50 PM by jmarvan

    Fail to inject Queue as Resource into EJB3 bean

    jmarvan

      I am unable to send a JMS message from within an EJB3 stateless session bean into a local queue.

      The bean method that is supposed to send to the Queue is invoked from a servlet.

      //Inject QueueConnectionFactory
      @Resource(mappedName = "java:/JmsXA")
       private QueueConnectionFactory queueConnectionFactory;


      //Inject the queue.
      @Resource(mappedName = "xxx") //xxx = various values.
      private Queue queue;



      When I set xxx to queue/MODEL_EVENTS, I get SocketException "Recevie Timed out".

      When I set xxx to jnp://localhost:1099/queue/MODEL_EVENTS, I actually get org.jboss.mq.SpyQueue out of it, but it fails to cast into javax.jms.Queue and produces the "Non matching type for inject of field" message. I suspect I am just getting the Remote interface of the Queue here.

      Setting "java:comp/env/queue/MODEL_EVENTS" for xxx fails with "queue not bound" javax.naming.NamingException. That makes sense since I don't se the queue registered within the java: context.

      I may have lost a marble or two over this already, what am I missing?
      Somebody please help before I lose more!

      Jaroslav


      Following are contents of JMX bean.

      java: Namespace

      +- SynergyConfigurationDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
       +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
       +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
       +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
       +- comp (class: javax.naming.Context)
       +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
       +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- jaas (class: javax.naming.Context)
       | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
       | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
       | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
       +- timedCacheFactory (class: javax.naming.Context)
      Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
       +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
       +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
       +- Mail (class: javax.mail.Session)
       +- comp.ejb3 (class: javax.naming.Context)
       | NonContext: null
       +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
       +- TransactionManager (class: org.jboss.tm.TxManager)
       +- synergyModelDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)



      Global JNDI Namespace

      +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- ConfigurationServiceBean (class: org.jnp.interfaces.NamingContext)
       | +- local (proxy: $Proxy66 implements interface net.symmetrics.synergy.config.ejb.ConfigurationService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
       | +- remote (proxy: $Proxy65 implements interface net.symmetrics.synergy.config.ejb.ConfigurationService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
       +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
       +- EventDispatcher (class: org.jboss.ws.eventing.mgmt.DispatcherDelegate)
       +- UserTransactionSessionFactory (proxy: $Proxy43 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
       +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
       +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
       +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
       +- topic (class: org.jnp.interfaces.NamingContext)
       | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
       | +- testTopic (class: org.jboss.mq.SpyTopic)
       | +- securedTopic (class: org.jboss.mq.SpyTopic)
       +- queue (class: org.jnp.interfaces.NamingContext)
       | +- MODEL_EVENTS (class: org.jboss.mq.SpyQueue)
       | +- D (class: org.jboss.mq.SpyQueue)
       | +- C (class: org.jboss.mq.SpyQueue)
       | +- B (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)
       | +- ETL_STATUS (class: org.jboss.mq.SpyQueue)
       +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
       +- PentahoModelRepositoryBean (class: org.jnp.interfaces.NamingContext)
       | +- local (proxy: $Proxy87 implements interface net.symmetrics.synergy.model.repository.PentahoModelRepository,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
       | +- remote (proxy: $Proxy86 implements interface net.symmetrics.synergy.model.repository.PentahoModelRepository,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
       +- ModelRepositoryBean (class: org.jnp.interfaces.NamingContext)
       | +- local (proxy: $Proxy84 implements interface net.symmetrics.synergy.model.repository.ModelRepository,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
       | +- remote (proxy: $Proxy83 implements interface net.symmetrics.synergy.model.repository.ModelRepository,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
       +- jmx (class: org.jnp.interfaces.NamingContext)
       | +- invoker (class: org.jnp.interfaces.NamingContext)
       | | +- RMIAdaptor (proxy: $Proxy37 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)
       +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
       +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)