2 Replies Latest reply on Feb 16, 2004 3:26 PM by Neil Davis

    Messaging from servlet

    Neil Davis Newbie

      All,
      The messaging forum is returning:
      Cannot invoke the operation : the module threw an exception
      when I try to access it. So I am posting in the next best topic...

      I have a messaging component which I wrote almost 2 years ago on JBoss 2.4.4. It still works... but the servlet using the component is throwing:

      javax.naming.NameNotFoundException: QueueConnectionFactory not bound

      Anyone know which files i need to touch to enable the servlet to see the queues? I have RTFM like 10x and been stuck here for a while. Any examples I can see for what the resource entries in these files need to look like?

      the queue/outgoing queue is set up. In the JMX MBean View for this queue, the name is queue/outgoing in the JNDIName field.

      I know I need to define this in the xml files within the EAR, but have tried all kinds of stuff, and nothing is working...

      thx,
      Neil

        • 1. Re: Messaging from servlet More info
          Neil Davis Newbie

          jboss-web.xml:
          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd">

          <jboss-web>

          <context-root>email-audit</context-root>

          <!-- Resource Environment References -->

          <!-- Resource references -->

          <!-- EJB References -->
          <!-- JMS Connection Factories (java:comp/env/jms) -->
          <resource-ref>
          <res-ref-name>jms/queue/outgoing</res-ref-name>
          <res-type>javax.jms.QueueConnectionFactory</res-type>
          <jndi-name>QueueConnectionFactory</jndi-name>
          </resource-ref>


          </jboss-web>


          web.xml:

          <servlet-name>RecieveEmailInfo</servlet-name>
          <display-name>Computation Servlet</display-name>
          <![CDATA[Servlet That Audits Email]]>
          <servlet-class>audit.email.RecieveEmailInfo</servlet-class>



          <servlet-mapping>
          <servlet-name>RecieveEmailInfo</servlet-name>
          <url-pattern>/RecieveEmailInfo</url-pattern>
          </servlet-mapping>
          <resource-ref>
          Outgoing Queue
          <res-ref-name>jms/queue/outgoing</res-ref-name>
          <res-type>javax.jms.QueueConnectionFactory</res-type>
          <res-auth>Container</res-auth>
          </resource-ref>


          Java Code:
          String queueName = "queue/outgoing";
          queue = (javax.jms.Queue) jndiContext.lookup(queueName);

          Error:
          [STDOUT] JNDI API lookup failed on queue/outgoing: javax.naming.NameNotFoundException: QueueConnectionFactory not bound
          thx,
          Neil

          • 2. Re: Messaging from servlet
            Neil Davis Newbie

            Turns out the QueueConnectionFactory became ConnectionFactory in JBoss JNDI.... when looking up context, I was specifying the old way.

            Amazing. Old component still works after fixing this!

            figured this out by getting frustrated, then walking away for a few, and referring to the Websphere price quote again. All better!!!