2 Replies Latest reply: Sep 6, 2011 6:24 PM by 886634 RSS

    Cannot find symbol for some jms methods

      Hi, I'm new to JMS and am having trouble compiling the HelloWorld example. I am able to create a connection but for some reason I cannot create a session from the same connection. I am however able to call some of the other methods such as getClientID, start, and close. Below is a copy of what i have compiled so far (which is basically a copy of the example code), the error message I get, and what I have CLASSPATH set to. If my CLASSPATH is not set correctly, I would assume none of the code would compile which is very confusing. Any help is appreciated, thanks!

      //Step 1:
      //Import the JMS API classes.
      import javax.jms.ConnectionFactory;
      import javax.jms.Connection;
      import javax.jms.Session;
      import javax.jms.MessageProducer;
      import javax.jms.MessageConsumer;
      import javax.jms.Queue;
      import javax.jms.Session;
      import javax.jms.Message;
      import javax.jms.TextMessage;
      import javax.jms.*;
      //Import the classes to use JNDI.
      import javax.naming.*;
      import java.util.*;

      public class HelloWorldMessage
      public static void main(String[] args){
           System.out.println("Hello World!");
      Queue myQueue;

           // Instantiate a Oracle GlassFish(tm) Server Message Queue ConnectionFactory administered object
           com.sun.messaging.ConnectionFactory myConnFactory = new com.sun.messaging.ConnectionFactory();
           // Create a connection to the Oracle GlassFish(tm) Server Message Queue Message Service.
           Connection myConn = myConnFactory.createConnection();
           // Create a session within the connection.
           Session mySess = myConn.createSession(false, Session.AUTO_ACKNOWLEDGE);

           myQueue = new com.sun.messaging.Queue("world");

           catch(Exception jmse){
           System.out.println("Exception occurred : " + jmse.toString());

      # javac HelloWorldMessage.java
      HelloWorldMessage.java:39: cannot find symbol
      symbol : method createSession(boolean,int)
      location: interface javax.jms.Connection
           Session mySess = myConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      1 error

      # echo $CLASSPATH

      Edited by: 883631 on Sep 6, 2011 4:03 PM