I'm having some problems getting JMS up and running.
 
I've activated the jms entry in the server.xml.  I've checked the jms log file, and it seems to be getting started.  I'm using the default port of 9127.  Unfortunately, when I run my application client, I get the following exception:
 
javax.jms.JMSException:  Unable to connect to JMSServer (localhost:127.0.0.1:9127)
 
I'm currently using a queue.  My jms.xml configurations for this are:
 
<jms-server port="9127" host="localhost">
        <queue-connection-factory location="jms/theQueueConnectionFactory" host="localhost" port="9127" />
        <queue name="Demo Queue" location="jms/demoQueue" persistence-file="../persistence/jms/demoQueue.queue">
              <description>A dummy queue</description>
        </queue>
 
My jndi properties for my application are:
 
java.naming.factory.initial=com.evermind.server.ApplicationClientInitialContextFactory
java.naming.provider.url=ormi://localhost/
java.naming.security.principal=<admin account>
java.naming.security.credentials=<admin password>

And last but not least, my application-client.xml is:
 
<?xml version="1.0"?>
<!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.2//EN" "http://java.sun.com/j2ee/dtds/application-client_1_2.dtd">
<application-client>
   <resource-ref>
      <res-ref-name>jms/theQueueConnectionFactory</res-ref-name>
      <res-type>javax.jms.QueueConnectionFactory</res-type>
      <res-auth>Container</res-auth>
   </resource-ref>
   <resource-ref>
      <res-ref-name>jms/demoQueue</res-ref-name>
      <res-type>javax.jms.Queue</res-type>
      <res-auth>Container</res-auth>
   </resource-ref>
</application-client>
My client program is very basic:
 
   public static void main(String [] argv) {
      
      try {
         Context context = new InitialContext();
         QueueConnectionFactory qfactory = (QueueConnectionFactory)context.lookup("java:comp/env/jms/theQueueConnectionFactory");
         Queue myqueue = (Queue)context.lookup("java:comp/env/jms/demoQueue");
         QueueConnection qconn = qfactory.createQueueConnection();
         qconn.start();
         QueueSession qsess = qconn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
         QueueSender qsend = qsess.createSender(myqueue);
         qsend.send(qsess.createTextMessage("Message"));
         System.out.println("sent message!");
         qconn.close();
        
      } catch (Exception e) {
         e.printStackTrace();   
      }
   }
Any ideas as to what I'm doing wrong??  Obviously, something is hosed on my configuration.
 
Thanks for any help.
 
Joe

Reply via email to