4 Replies Latest reply on Mar 23, 2004 12:35 AM by chetana_vir

    javax.naming.NameNotFoundException: ConnectionFactory not bo

    chetana_vir

      Hi,

      I am using jboss-3.0.8 server for my application. I could not bind the jndi name when i was using jdbc2 persistence for jms program. The same program is working fine when using file persistence for jms program.
      I have commented out the following code for using jdbc2 persistence.
      Here is the my jbossmq-service.xml file. I am looking up for the jndi name "ConnectionFactory"


      <!--
      | The CacheStore decides where to store JBossMQ message that
      | that the MessageCache has decided to move in secondary storage.
      -->

      tmp/jbossmq


      <!--
      | The StateManager is used to keep JMS persistent state data.
      | For example: what durable subscriptions are active.
      -->

      <!-- This file is pulled from the configuration URL of the server -->
      jbossmq-state.xml


      <!-- The PersistenceManager is used to store messages to disk. -->
      <!--
      db/jbossmq/file
      <depends optional-attribute-name="MessageCache">jboss.mq:service=MessageCache

      -->
      <!--
      | The jdbc2 PersistenceManager is the new improved JDBC implementation.
      | This implementation allows you to control how messages are stored in
      | the database.
      |
      | Use this PM if you want the reliablity a relational database can offer
      | you. The default configuration is known to work with hsqldb, other databases
      | will requrie teaking of the SqlProperties.
      -->


      <depends optional-attribute-name="MessageCache">jboss.mq:service=MessageCache
      <depends optional-attribute-name="DataSource">jboss.jca:service=LocalTxDS,name=hsqldbDS
      jboss.jca:service=LocalTxCM,name=hsqldbDS

      BLOB_TYPE=OBJECT_BLOB
      INSERT_TX = INSERT INTO JMS_TRANSACTIONS (TXID) values(?)
      INSERT_MESSAGE = INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)
      SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM JMS_TRANSACTIONS
      SELECT_MAX_TX = SELECT MAX(TXID) FROM JMS_MESSAGES
      SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE DESTINATION=?
      SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
      MARK_MESSAGE = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE MESSAGEID=? AND DESTINATION=?
      UPDATE_MESSAGE = UPDATE JMS_MESSAGES SET MESSAGEBLOB=? WHERE MESSAGEID=? AND DESTINATION=?
      UPDATE_MARKED_MESSAGES = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=?
      UPDATE_MARKED_MESSAGES_WITH_TX = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID=?
      DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM JMS_MESSAGES WHERE TXID IN (SELECT TXID FROM JMS_TRANSACTIONS) AND TXOP=?
      DELETE_TX = DELETE FROM JMS_TRANSACTIONS WHERE TXID = ?
      DELETE_MARKED_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=?
      DELETE_MESSAGE = DELETE FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
      CREATE_MESSAGE_TABLE = CREATE TABLE JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, \
      DESTINATION VARCHAR(255) NOT NULL, TXID INTEGER, TXOP CHAR(1), \
      MESSAGEBLOB OBJECT, PRIMARY KEY (MESSAGEID, DESTINATION) )
      CREATE_TX_TABLE = CREATE TABLE JMS_TRANSACTIONS ( TXID INTEGER )


        • 1. Re: javax.naming.NameNotFoundException: ConnectionFactory no

          And your error messages at startup were?

          Regards,
          Adrian

          • 2. Re: javax.naming.NameNotFoundException: ConnectionFactory no
            chetana_vir

            Hi Andrian,

            Actually i am using MBeans for persisting the mails in jms queue and then reading them from the queue and sending them to the destinations. we are implementing jms persistence for mails so that no mails will be lost when the mail server is down. Hope u understood this. so in the MBean i am writing the code for jms lookup where i read the messages from the queue continuously for every 3 minutes using threads. This MBean gets executed initially at the time of server startup and gets executed continously. So my problem is i couldn't lookup the "ConnectionFactory" during the startup of the server. Here is the error that i am getting while the server is starting up.

            12:51:28,328 INFO [MainDeployer] Starting deployment of package: file:/C:/jboss-3.0.8/server/defaul
            t/deploy/jms-service.xml
            12:51:28,375 ERROR [STDERR] javax.naming.NameNotFoundException: org.jnp.interfaces.NamingContextFact
            ory not bound
            12:51:28,375 ERROR [STDERR] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(St
            reamRemoteCall.java:245)
            12:51:28,375 ERROR [STDERR] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.j
            ava:220)
            12:51:28,375 ERROR [STDERR] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
            12:51:28,375 ERROR [STDERR] at org.jnp.server.NamingServer_Stub.list(Unknown Source)
            12:51:28,375 ERROR [STDERR] at org.jnp.interfaces.NamingContext.list(NamingContext.java:698)
            12:51:28,375 ERROR [STDERR] at org.jnp.interfaces.NamingContext.list(NamingContext.java:687)
            12:51:28,406 ERROR [STDERR] at javax.naming.InitialContext.list(InitialContext.java:390)
            12:51:28,406 ERROR [STDERR] at com.virinchi.capture.mbean.MailQueueHandler.getRemoteConnection(M
            ailQueueHandler.java:140)


            I have written a simple jms program using simple client with same lookup code and it is working fine with the same server.
            I need help to solve this error i am struggling to resolve this error from the past 10 days as i am new to jms and jboss. The same code is working fine with file persistence but when i am shifting to jdbc2 persistence it is giving the above problem. what changes do we need to shift from file persistence to jdbc2 persitence. I am just commenting and uncommenting the mbean code for file and jdbc2. I am using jboss-3.0.8 server.


            chetana_vir.

            • 3. Re: javax.naming.NameNotFoundException: ConnectionFactory no

              12:51:28,375 ERROR [STDERR] javax.naming.NameNotFoundException: org.jnp.interfaces.NamingContextFactory not bound

              Why are you doing a lookup with this value?

              Regards,
              Adrian

              • 4. Re: javax.naming.NameNotFoundException: ConnectionFactory no
                chetana_vir

                Hi,

                >>Why are you doing a lookup with this value?

                I have gone through the jboss docs and wrote that code. If it is not the better ContextFactory to lookup then what is the best naming context factory to lookup the initial context. Here is the code that iam using for lookup.

                remoteContext = new InitialContext();

                remoteQueueFactory = (QueueConnectionFactory) remoteContext.lookup("ConnectionFactory");

                remoteQueueConnection = remoteQueueFactory.createQueueConnection();

                Here is the jndi.properties file :

                java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                java.naming.provider.url=localhost:1099


                Here is the error i am getting:

                javax.naming.NameNotFoundException: ConnectionFactory not bound
                at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(St

                at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.j

                at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
                at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:493)
                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:472)
                at javax.naming.InitialContext.lookup(InitialContext.java:350)