5 Replies Latest reply on Jul 24, 2015 11:52 AM by sharmamanish3

    JBoss 6.4, Connection factory set-up in Domain giving javax.naming.NameNotFoundException

    sharmamanish3

      Hi,

      I am trying to access a connectionfactory locally on JBOSS server 6.4 but it is giving the NameNotFoundException.

      Details are as follows

      In domain.xml file under  <subsystem xmlns="urn:jboss:domain:messaging:1.4"> <hornetq-server><jms-connection-factories> tag

                             <connection-factory name="APR3_TES_Archive_Connection_Factory">

                                  <connectors>

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

                                  </connectors>

                                  <entries>

                                      <entry name="java:jboss/exported/APR3_TES_Archive_Connection_Factory"/>

                                  </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>

       

      In my EAR application file which contains a Java file with below code fails


      InitialContext ctx = new InitialContext();

      queueConnectionFactory = (javax.jms.QueueConnectionFactory) ctx.lookup("APR3_TES_Archive_Connection_Factory");

       

      Error comes on above line [ERROR] [23 Jul 2015 15:04:45,853] [stderr] : javax.naming.NameNotFoundException: APR3_TES_Connection_Factory -- service jboss.naming.context.java.APR3_TES_Connection_Factory

       

      Many thanks in advance.

       

      Regards,

      Manish Sharma

        • 1. Re: JBoss 6.4, Connection factory set-up in Domain giving javax.naming.NameNotFoundException
          jbertram

          The "exported" JNDI namespace is special because it behaves differently depending on if the client is remote or local.  If your client is local then it should use the full JNDI string (i.e. "java:jboss/exported/APR3_TES_Archive_Connection_Factory"), and if the client is remote it should use whatever comes after "exported/" (i.e. "APR3_TES_Archive_Connection_Factory").  My guess is that your application has this mixed up.

          • 2. Re: JBoss 6.4, Connection factory set-up in Domain giving javax.naming.NameNotFoundException
            jbertram

            FYI...

             

            I believe you could add this:

             

            <entry name="APR3_TES_Archive_Connection_Factory"/>

             

            to your connection factory and then both local and remote clients can use the same JNDI lookup.

             

            Lastly...If your client is local you should think about using a pooled-connection-factory if you are sending messages or using an MDB if you are consuming messages.  At the very least you should use a connection factory with an in-vm connector if your client is local.

            • 3. Re: JBoss 6.4, Connection factory set-up in Domain giving javax.naming.NameNotFoundException
              sharmamanish3

              Hi Justin,

               

              After doing ENTRY name change, the above error got resolved but  I got another error : HornetQException[errorType=SECURITY_EXCEPTION message=HQ119031: Unable to validate user: null

              • 4. Re: JBoss 6.4, Connection factory set-up in Domain giving javax.naming.NameNotFoundException
                jbertram

                Are you attempting to send a message to a remote server or your local, in-vm server?

                • 5. Re: JBoss 6.4, Connection factory set-up in Domain giving javax.naming.NameNotFoundException
                  sharmamanish3

                  Justin - I have created a queue to which Jboss web application  will send a file to process.

                  There is a remote client which will pick and process this message.

                  So used below configuration in domain.xml.

                   

                                       <connection-factory name="APR3_TES_Connection_Factory">

                                              <connectors>

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

                                              </connectors>

                                              <entries>

                                                  <entry name="java:jboss/exported/APR3_TES_Connection_Factory"/>

                                                  <entry name="APR3_TES_Connection_Factory"/>

                                              </entries>

                                          </connection-factory>

                  I can see the message appearing in the queue from web application - ok.

                  But the Remote client although says is connected to the queues is not picking up the message - any guess.

                   

                  Many thanks for your help.