4 Replies Latest reply on Jan 27, 2003 6:01 AM by adrian.brock

    ConnectionFactory Problem

    wnlee_eric

      I run a simple program with error "JNDI API lookup failed: javax.naming.CommunicationException: Can't find SerialContextProvider". The problem is it can't lookup "QueueConnectionFactory". What should I replace for that? My code is as follows:

      try {
      jndiContext = new InitialContext();
      connectionFactory = (ConnectionFactory) jndiContext.lookup("QueueConnectionFactory");
      if (destType.equals("queue")) {
      dest = (Queue) jndiContext.lookup(destName);
      } else if (destType.equals("topic")) {
      dest = (Topic) jndiContext.lookup(destName);
      } else {
      throw new Exception("Invalid destination type; must be queue or topic");
      }
      } catch (Exception e) {
      System.out.println("JNDI API lookup failed: " + e.toString());
      return;
      }


      Thx for your help!

        • 1. Re: ConnectionFactory Problem

          Do you have j2ee.jar from Sun's RI?
          If so, remove it, use jboss-j2ee.jar

          Regards,
          Adrian

          • 2. Re: ConnectionFactory Problem
            wnlee_eric

            I already delete sun j2ee.jar and add JBoss's library in my classpath and change my JMS code to J2ee version 1.3. However, it still not work. The error as follows:
            JNDI API lookup failed: javax.naming.NameNotFoundException: QueueConnectionFactory not bound

            Besides, when I run my program, I can't see any message in the prompt that is used to restart the JBoss server. What should I do in this situation?


            [Attached my simple code]

            • 3. Re: ConnectionFactory Problem
              wnlee_eric

              I already delete sun j2ee.jar and add JBoss's library in my classpath and change my JMS code to J2ee version 1.3. However, it still not work. The error as follows:
              JNDI API lookup failed: javax.naming.NameNotFoundException: QueueConnectionFactory not bound

              Besides, when I run my program, I can't see any message in the prompt that is used to restart the JBoss server. What should I do in this situation?

              • 4. Re: ConnectionFactory Problem

                There is no QueueConnectionFactory,
                only ConnectionFactory which you can cast to either
                a Queue or Topic ConnectionFactory.

                See jbossmq-service.xml for the valid connection
                factories and their jndi names.

                Regards,
                Adrian