users@glassfish.java.net

JMS and Glassfish Remote Connection

From: <glassfish_at_javadesktop.org>
Date: Thu, 26 Jun 2008 07:25:46 PDT

Hello all,
I am trying to create a JMS connection with glassfish 9.1 and connect to it using a stand alone java application. I have created the connection factory and queue properly and can view them in the jndi tree on the admin port so I know they are there. I have tried many ways to get this to work and am wondering if someone has a suggestion. I will post code and stack trace as follows
Hashtable properties = new Hashtable(2);
        properties.put(Context.PROVIDER_URL,"iiop://10.30.16.29:4693");
        properties.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.S1ASCtxFactory");
        properties.put("com.sun.appserv.iiop.endpoints","10.30.16.29:4693");
        
        
        
        //System.setProperty("org.omg.CORBA.ORBInitialPort","4693");
        //System.setProperty("org.omg.CORBA.ORBInitialHost","10.30.16.29");
       // properties.put("org.omg.CORBA.ORBInitialHost","10.30.16.29");
       // properties.put("org.omg.CORBA.ORBInitialPort","4693");
        try {
           // Context ic = new InitialContext();
        //Object o = ic.lookup("corbaname:iiop://10.30.16.29:4693");
       // System.out.println(o.toString());
            //ctx = new InitialContext();
          // ctx = new InitialContext(properties);
            ctx = getIntialContext();
            
        } catch (NamingException ex) {
            ex.printStackTrace();
        }
    }
   public Object lookup(String name){
        try {
            return ctx.lookup(name);
        } catch (NamingException ex) {
            ex.printStackTrace();
        }
        return null;
    }
    public static Context getIntialContext()throws javax.naming.NamingException{
        Hashtable env=new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
        env.put("java.naming.provider.url", "mq://10.30.16.29:4693/");
        return new javax.naming.InitialContext(env);
    }
    public static void main(String[] args)
    {
        JmsClient client = new JmsClient();
    
        try{
            System.out.println("BEFORE FACTORY");
            Context c = JmsClient.getIntialContext();
            ConnectionFactory connectionFactory = (ConnectionFactory)c.lookup("jms/tConnectionFactory");

javax.naming.NameNotFoundException
        at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:268)
        at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:191)
        at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
        at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:129)
        at sun.reflect.GeneratedMethodAccessor130.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)

I have worked on this a long time and still get this error. I think my problem is getting to the server's JNDI correctly. Any help appreciated.
Ken
[Message sent by forum member 'kenbarnesjr' (kenbarnesjr)]

http://forums.java.net/jive/thread.jspa?messageID=282783