0 Replies Latest reply on Sep 7, 2015 5:58 AM by sharmamanish3

    AS 7.1, NameNotFoundException (Accessing locally on web server).

    sharmamanish3

      Hi,

      Running on Redhat AS 7.1, JBOSS EAP 6.4

      I am getting NameNotFoundException when trying to access JMS Connection factory from JSP page.  javax.naming.NameNotFoundException service jboss.naming.context.java.TESConnectionFactory not found


      NOTE: My Queues are running in domain e.g. MessagingDomain port:4450 and my application is running on ApplicationDomain port: 8082

      I tried the lookup with various names but no luck:


      Below is the sample code - JSP (As i am just trying to initially verify everything is accessible and avoid several rounds of deployments)

      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      import="javax.jms.*,javax.naming.Context,javax.naming.InitialContext,javax.naming.NamingException"

      Context ctx = new InitialContext();

      QueueConnectionFactory queueConnectionFactory = null;

      Queue requestQueue = null;

      boolean pass = true;

       

       

      try{//java:jboss/jms/TESConnectionFactory

        //APR3_TES_Connection_Factory

        //TESConnectionFactory

        queueConnectionFactory = (QueueConnectionFactory) ctx.lookup("TESConnectionFactory");

        System.out.println("Successfully found connectionfactory TESConnectionFactory ");

      } catch(Exception ex) {

          pass = false;

        System.out.println("Failed with the 1st look up " + ex);

      }

       

       

      if (!pass)

      {

        try{

        queueConnectionFactory = (QueueConnectionFactory) ctx.lookup("java:jboss/jms/TESConnectionFactory");

        //java:jboss/exported/APR3_TES_Connection_Factory

        System.out.println("Successfully found connectionfactory java:jboss/jms/TESConnectionFactory ");

        pass=true;

        } catch(Exception ex) {

        pass = false;

        System.out.println("Failed with the 2nd look up " + ex);

        }

      }

       

       

        if (!pass)

      {

        try{

        queueConnectionFactory = (QueueConnectionFactory) ctx.lookup("jms/TESConnectionFactory");

        System.out.println("3rd Version <BR>");

        System.out.println("Successfully found queue jms/TESConnectionFactory ");

        pass=true;

        } catch(Exception ex) {

        pass = false;

        System.out.println("Failed with the 3rd look up " + ex);

        }

      }

       

       

      if(pass) {

        System.out.println("Connecting to the queue");

       

       

        try{

        requestQueue = (Queue) ctx.lookup("ARP3_TES_RequestQueue");

        pass=true;

        System.out.println("Successfully found queue ARP3_TES_RequestQueue ");

        } catch(Exception ex) {

        pass = false;

        System.out.println("Failed with the Queue 1st look up " + ex);

        }

       

        if(!pass) {

        System.out.println("Connecting to the queue");

       

       

        try{

        requestQueue = (Queue) ctx.lookup("exported/ARP3_TES_RequestQueue");

        System.out.println("Successfully found queue exported/ARP3_TES_RequestQueue ");

        pass=true;

        } catch(Exception ex) {

        pass = false;

        System.out.println("Failed with the Queue 2nd look up " + ex);

        }

         }

        }

        else {

        System.out.println("Exiting");

        }

        requestQueue = null;

        queueConnectionFactory = null;

      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      <connection-factory name="TESConnectionFactory">

                                  <connectors>

                                      <connector-ref connector-name="netty"/>

                                  </connectors>

                                  <entries>

                                      <entry name="java:jboss/jms/TESConnectionFactory"/>

                                  </entries>

                                  <compress-large-messages>false</compress-large-messages>

                                  <failover-on-initial-connection>false</failover-on-initial-connection>

                                  <use-global-pools>true</use-global-pools>

                              </connection-factory>