9 Replies Latest reply on Aug 2, 2010 3:42 AM by Joydeep Sarkar

    Error sendig message from within J2EE component

    Joydeep Sarkar Newbie

      Hi,

       

      While trying to configure dependency injection into a session bean I get the following exception thrown by the application.

      I have followed the User Manual 2.1, section 32.2.

       

      An unexpected error occurred. 
      The System Administrators have been notified. The message is: java.lang.RuntimeException: 
      Unable to inject jndi dependency: env/com.getty.mms.mq.MQManagerBean/inQueue into property com.getty.mms.mq.MQManagerBean.inQueue: indexRequestQueue not bound; 
      nested exception is: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.getty.mms.mq.MQManagerBean/inQueue into property com.getty.mms.mq.MQManagerBean.inQueue: indexRequestQueue not bound
      

       

      The code snippet is as follows,

       

      @Stateless
      @RemoteBinding(jndiBinding = "remote/MQManagerBean")
      public class MQManagerBean implements MQManager
      {
              @Resource(mappedName = "java:/JmsNonXA")
              private ConnectionFactory connectionFactory;
              @Resource(mappedName = "queue/indexRequestQueue")
              Queue inQueue;
      
      

       

       

      While doing the same using JNDI lookup, the program works fine. The only problem I havebeen facing when I try to inject the queue.

      Surprisingly the connection factory works well.

      Just wondering if I require to configure anything for the queue as well just like it is for JmsNonXA factory?

       

       

      TIA,

      Joydeep

        • 1. Re: Error sendig message from within J2EE component
          jaikiran pai Master

          How are you deploying the queue? Please post the relevant configs and the entire exception stacktrace. Also what version of JBoss AS is this?

          • 2. Re: Error sendig message from within J2EE component
            Tim Fox Master

            I'm not sure what this has got to do with HornetQ.

             

            Looks like EJB / JBoss AS config to me. Best place for this would be the EJB forum

            • 3. Re: Error sendig message from within J2EE component
              Joydeep Sarkar Newbie

              Hi,

               

              Sorry for the delayed response.

              Following is the stacktrace.

               

              imagenet.system.util.UnexpectedException: An unexpected error occurred. The System Administrators have been notified. The message is: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.getty.mms.mq.MQManagerBean/inQueue into property com.getty.mms.mq.MQManagerBean.inQueue: indexRequestQueue not bound; nested exception is: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.getty.mms.mq.MQManagerBean/inQueue into property com.getty.mms.mq.MQManagerBean.inQueue: indexRequestQueue not bound
                      at imagenet.system.util.UnexpectedException.getImagenetException(UnexpectedException.java:65)
                      at imagenet.system.util.ImagenetException.getImagenetException(ImagenetException.java:143)
                      at imagenet.system.util.ImagenetException.getImagenetException(ImagenetException.java:123)
                      at imagenet.web.util.ErrorsTag.appendErrorsElement(ErrorsTag.java:112)
                      at imagenet.web.util.XmlTransformTag.doEndTag(XmlTransformTag.java:177)
                      at _web_2d_inf._errors._errorPage._jspService(_errorPage.java:152)
                      at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
                      at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:348)
                      at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)
                      at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)
                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                      at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
                      at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:293)
                      at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:602)
                      at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:308)
                      at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:211)
                      at com.evermind.server.http.EvermindHttpServletResponse.handleException(EvermindHttpServletResponse.java:1671)
                      at com.evermind.server.http.EvermindHttpServletResponse.handleException(EvermindHttpServletResponse.java:1563)
                      at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:792)
                      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:264)
                      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:107)
                      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
                      at java.lang.Thread.run(Thread.java:595)
              Caused by: javax.ejb.EJBException: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.getty.mms.mq.MQManagerBean/inQueue into property com.getty.mms.mq.MQManagerBean.inQueue: indexRequestQueue not bound; nested exception is: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.getty.mms.mq.MQManagerBean/inQueue into property com.getty.mms.mq.MQManagerBean.inQueue: indexRequestQueue not bound
                      at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77)
                      at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
                      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
                      at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
                      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
                      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
                      at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
                      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
                      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
                      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
              Caused by: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.getty.mms.mq.MQManagerBean/inQueue into property com.getty.mms.mq.MQManagerBean.inQueue: indexRequestQueue not bound
                      at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:82)
                      at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99)
                      at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89)
                      at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:61)
                      at org.jboss.ejb3.injection.InjectionInvocation.invokeTarget(InjectionInvocation.java:89)
                      at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:83)
                      at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                      at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:74)
                      at org.jboss.ejb3.EJBContainer.injectBeanContext(EJBContainer.java:1086)
                      at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:83)
                      at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56)
                      at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:51)
                      at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:53)
                      at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:93)
                      at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
                      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)
                      at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
                      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
                      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
                      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
                      at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
                      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
                      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
                      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
                      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:211)
                      at org.jboss.remoting.Client.invoke(Client.java:1724)
                      at org.jboss.remoting.Client.invoke(Client.java:629)
                      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                      at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
                      at $Proxy3.invoke(Unknown Source)
                      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
                      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
                      at $Proxy2.submitIndexRequest(Unknown Source)
                      at com.gettyimages.mq.MMMQPublisher.publishMessage(MMMQPublisher.java:29)
                      at imagenet.business.metadata.editor.impl.MdBundleImpl.commit(MdBundleImpl.java:370)
                      at imagenet.web.functions.metadata.editor.MdEditAction.performAction(MdEditAction.java:155)
                      at imagenet.web.util.LoginRequiredAction.performActionWithChecks(LoginRequiredAction.java:257)
                      at imagenet.web.util.LoginRequiredAction.performExecute(LoginRequiredAction.java:77)
                      at imagenet.web.util.ActionForwardFactory.getActionForward(ActionForwardFactory.java:29)
                      at imagenet.web.util.BasicAction.execute(BasicAction.java:100)
                      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
                      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
                      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158)
                      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760
              
              

               

              I have deployed the queue in hornetq-jms.xml. Here I would like to mention that earlier when I was trying to backup this server(Live-backup pair), the queue was not getting deployed before the .ear does. Configuring the queue in hornetq-configuration file made it work fine. Don't know if this is also the same problem this time.

              Following is the configuration snippet from hornetq-jms.xml

               

                 <queue name="IndexRequestQueue">
                    <entry name="/queue/indexRequestQueue"/>
                 </queue>
              

               

              JBoss version is 5.1.0.GA

              HornetQ version is 2.0

               

              Regards,

              Joydeep

              • 4. Re: Error sendig message from within J2EE component
                Joydeep Sarkar Newbie

                Hi,

                 

                As I was just following the user manual(section 32.2), thought to put a post here as I was not sure what exactly is causing the issue.

                I would put a post in EJB forum.

                 

                Regards,

                Joydeep

                • 5. Re: Error sendig message from within J2EE component
                  jaikiran pai Master

                  Joydeep Sarkar wrote:

                   


                  Following is the configuration snippet from hornetq-jms.xml

                   

                     <queues>
                          <queue name="jms.queue.indexRequestQueue">
                              <address>jms.queue.indexRequestQueue</address>
                              <durable>true</durable>
                          </queue>
                     </queues>
                  

                   

                  JBoss version is 5.1.0.GA

                  HornetQ version is 2.0

                   

                  Regards,

                  Joydeep

                  From what I read in the docs, the JMS queue should be configured as follows:

                   

                  <queue name="indexRequestQueue">
                        <entry name="/queue/indexRequestQueue"/>
                  </queue>
                  
                  
                  • 6. Re: Error sendig message from within J2EE component
                    Joydeep Sarkar Newbie

                    Hi,

                     

                    It was a mistake to put the configuration entry from hornetq-configuration file instaed of the hornetq-jms file.

                    I have updated the original post. Following is the entry from hornetq-jms.xml.

                     

                    <queue name="IndexRequestQueue">
                          <entry name="/queue/indexRequestQueue"/>
                       </queue>
                    

                     

                    Sorry about the confusion.

                     

                     

                    Regards,

                    Joydeep

                    • 7. Re: Error sendig message from within J2EE component
                      jaikiran pai Master

                      Hmm, did you just edit your reply with a new config? Which one exactly are you using? It's better to post the exact configs that you are using. That way it becomes easier for others to figure out where exactly the issue lies. Right now, I am really not sure whether your problem is in some EJB configuration or HornetQ configuration.

                      • 8. Re: Error sendig message from within J2EE component
                        Joydeep Sarkar Newbie

                        Hi,

                         

                        Is this the problem with the upper case?

                        I have used the queue name as "IndexRequestQueue" and I have looked up the queue in the code as mappedName="queue/indexRequestQueue" while injecting the dependancy.

                        I wonder if that is the cause.

                         

                        Regards,

                        Joydeep

                        • 9. Re: Error sendig message from within J2EE component
                          Joydeep Sarkar Newbie

                          Hi,

                           

                          Allow me to describe the configuration files.

                           

                          hornetq-jms.xml

                           

                          <configuration xmlns="urn:hornetq"
                                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                      xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
                             <connection-factory name="NettyConnectionFactory">
                                <connectors>
                                   <connector-ref connector-name="netty"/>
                                </connectors>
                                <entries>
                                   <entry name="/ConnectionFactory"/>
                                   <entry name="/XAConnectionFactory"/>
                                </entries>
                             </connection-factory>
                             <connection-factory name="InVMConnectionFactory">
                                <connectors>
                                   <connector-ref connector-name="in-vm"/>
                                </connectors>
                                <entries>
                                   <entry name="java:/ConnectionFactory"/>
                                   <entry name="java:/XAConnectionFactory"/>
                                </entries>
                             </connection-factory>
                             <queue name="DLQ">
                                <entry name="/queue/DLQ"/>
                             </queue>
                             <queue name="ExpiryQueue">
                                <entry name="/queue/ExpiryQueue"/>
                             </queue>
                             <queue name="IndexRequestQueue">
                                <entry name="/queue/indexRequestQueue"/>
                             </queue>
                          </configuration>
                          

                           

                          hornetq-configuration.xml

                           

                          <configuration xmlns="urn:hornetq"
                                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                         xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
                             <clustered>true</clustered>
                             <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
                             <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
                             <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>
                             <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>
                             <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>
                             <backup-connector-ref connector-name="backup-connector"/>
                             <shared-store>true</shared-store>
                            <!-- <FailoverOnInitialConnection>true</FailoverOnInitialConnection>-->
                             <connectors>
                                <connector name="netty">
                                   <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
                                   <param key="host"  value="${hornetq.remoting.netty.host:10.240.132.215}"/>
                                   <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
                                </connector>
                                <connector name="in-vm">
                                   <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
                                </connector>
                                <connector name="backup-connector">
                                  <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                                  <param key="host" value="10.240.132.216"/>
                                  <param key="port" value="5445"/>
                                </connector>
                             </connectors>
                          
                             <acceptors>
                                <acceptor name="netty">
                                   <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
                                   <param key="host"  value="${hornetq.remoting.netty.host:10.240.132.215}"/>
                                   <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
                                </acceptor>
                                <acceptor name="in-vm">
                                  <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
                                  <param key="server-id" value="0"/>
                                </acceptor>
                             </acceptors>
                             <broadcast-groups>
                                <broadcast-group name="bg-group1">
                                  <local-bind-address>10.240.132.215</local-bind-address>
                                   <group-address>224.0.0.1</group-address>
                                   <group-port>9876</group-port>
                                   <broadcast-period>5000</broadcast-period>
                                   <connector-ref connector-name="netty"/>
                                </broadcast-group>
                             </broadcast-groups>
                             <discovery-groups>
                                <discovery-group name="dg-group1">
                                   <group-address>224.0.0.1</group-address>
                                   <group-port>9876</group-port>
                                   <refresh-timeout>10000</refresh-timeout>
                                </discovery-group>
                             </discovery-groups>
                             <cluster-connections>
                                <cluster-connection name="my-cluster">
                                   <address>jms</address>
                                        <discovery-group-ref discovery-group-name="dg-group1"/>
                                </cluster-connection>
                             </cluster-connections>
                             <security-settings>
                                <security-setting match="#">
                                   <permission type="createTempQueue" roles="guest"/>
                                   <permission type="deleteTempQueue" roles="guest"/>
                                   <permission type="consume" roles="guest"/>
                                   <permission type="send" roles="guest"/>
                                </security-setting>
                             </security-settings>
                             <address-settings>
                                <!--default for catch all-->
                                <address-setting match="#">
                                   <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                                   <expiry-address>jms.queue.ExpiryQueue</expiry-address>
                                   <redelivery-delay>0</redelivery-delay>
                                   <max-size-bytes>-1</max-size-bytes>
                                   <page-size-bytes>10485760</page-size-bytes>
                                   <message-counter-history-day-limit>10</message-counter-history-day-limit>
                                </address-setting>
                             </address-settings>
                          </configuration>
                          

                           

                          Sorry about the earlier confusion. I am using the hornetq-jms.xml to deploy the queue (This is the issue in the live server. In the backup server I have used hornetq-configuration.xml. Ref: https://community.jboss.org/post!reply.jspa?message=555354).

                           

                          Regards,

                          Joydeep