JMS (JNDI InitialContext) with Sun Application Server

Discussion in 'Java' started by RVince, Jul 2, 2007.

  1. RVince

    RVince Guest

    For a remote client running connecting to a server at serverAddr
    running OpenJMS, I am able to obtain an InitialContext as follows:


    Properties env = new Properties( );

    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "org.exolab.jms.jndi.InitialContextFactory");
    env.put(Context.PROVIDER_URL, "tcp://"+serverAddr+":3035/");

    InitialContext jndi = new InitialContext(env);

    Does anyone have a sample of how they accomplish this connecting to either
    Sun Application Server (any version) or Glassfish? I have spent the better
    part of a weekend trying to give that a go, and am at a complete loss here.
    Surely someone must have managed to get this going with one of those
    servers? -R. Vince
     
    RVince, Jul 2, 2007
    #1
    1. Advertising

  2. On Jul 1, 5:32 pm, "RVince" <r vince 9 9 at hotmail dot com> wrote:
    > For a remote client running connecting to a server at serverAddr
    > running OpenJMS, I am able to obtain an InitialContext as follows:
    >
    > Properties env = new Properties( );
    >
    > env.put(Context.INITIAL_CONTEXT_FACTORY,
    > "org.exolab.jms.jndi.InitialContextFactory");
    > env.put(Context.PROVIDER_URL, "tcp://"+serverAddr+":3035/");
    >
    > InitialContext jndi = new InitialContext(env);
    >
    > Does anyone have a sample of how they accomplish this connecting to either
    > Sun Application Server (any version) or Glassfish? I have spent the better
    > part of a weekend trying to give that a go, and am at a complete loss here.
    > Surely someone must have managed to get this going with one of those
    > servers? -R. Vince


    Hi,

    You can try the factory as com.sun.appserv.naming.S1ASCtxFactory and
    provider URL as iiop://<server_address>:3700 for Glassfish.

    -cheers,
    Manish
     
    Manish Pandit, Jul 3, 2007
    #2
    1. Advertising

  3. RVince

    RVince Guest

    Do you know what jars I must include Manish? Thanks, R.Vince
     
    RVince, Jul 3, 2007
    #3
  4. On Jul 2, 4:56 pm, "RVince" <r vince 9 9 at hotmail dot com> wrote:
    > Do you know what jars I must include Manish? Thanks, R.Vince


    The context factory should be in appserv-rt.jar in the $GLASSFISH_HOME/
    lib folder. I believe you are running within glassfish - you should
    not have to specify explicit jar files...no?

    -cheers,
    Manish
     
    Manish Pandit, Jul 3, 2007
    #4
  5. RVince

    RVince Guest

    Hi Manesh,

    Whether I include that jar or not, when I use these values as in my code
    below, I am getting the exception stack which seems to start from a
    "com.sun.appserv.naming.RoundRobinPolicy setClusterInstanceInfo" ? Any
    thoughts here? I am running this under Glassfish v1_ur1-p01-b02 which I
    believe is still the latest release. -Ralph

    Properties env = new Properties( );
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.appserv.naming.S1ASCtxFactory");
    env.put(Context.PROVIDER_URL, "iiop://127.0.0.1:3700/");
    InitialContext jndi = new InitialContext(env);
    //The following line is referred to as
    'Chat.<init>(Chat.java:44)' in the exception stack below
    TopicConnectionFactory conFactory =
    (TopicConnectionFactory)jndi.lookup("jmsConnectionFactory1");

    Jul 3, 2007 6:42:11 AM com.sun.appserv.naming.RoundRobinPolicy
    setClusterInstanceInfo
    WARNING: NAM1005 : No Endpoints selected. Please specify using system
    property com.sun.appserv.iiop.endpoints.
    GroupInfoServiceBase(main): .addObserver->:
    com.sun.appserv.naming.GroupInfoServiceObserverImpl@1ae939f
    GroupInfoServiceBase(main): .addObserver<-:
    com.sun.appserv.naming.GroupInfoServiceObserverImpl@1ae939f true
    Jul 3, 2007 6:42:14 AM com.sun.appserv.naming.RoundRobinPolicy
    getEndpointForProviderURL
    WARNING: NAM1001: No Endpoints selected in com.sun.appserv.iiop.endpoints
    property. Using JNDI Provider URL iiop://127.0.0.1:3700/ instead
    Jul 3, 2007 6:42:15 AM
    com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl
    initialize
    WARNING: sealing violation: can't seal package javax.transaction: already
    loaded
    Jul 3, 2007 6:42:16 AM com.sun.enterprise.connectors.ActiveRAFactory
    createActiveResourceAdapter
    SEVERE: RAR6001 : Class Not found : com.sun.messaging.jms.ra.ResourceAdapter
    Jul 3, 2007 6:42:16 AM com.sun.enterprise.connectors.ActiveRAFactory
    createActiveResourceAdapter
    SEVERE:
    com.sun.enterprise.connectors.ConnectorRuntimeException: Error in creating
    active RAR
    at
    com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:94)
    at
    com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:287)
    at
    com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:208)
    at
    com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:88)
    at
    javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
    at
    com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at Chat.<init>(Chat.java:44)
    at Chat.main(Chat.java:113)
    Caused by: java.lang.ClassNotFoundException:
    com.sun.messaging.jms.ra.ResourceAdapter
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at
    com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:68)
    ... 8 more
    Jul 3, 2007 6:42:16 AM com.sun.enterprise.naming.SerialContext lookup
    SEVERE: NAM0004: Exception during name lookup : {0}
    com.sun.enterprise.connectors.ConnectorRuntimeException: Error in creating
    active RAR
    at
    com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:94)
    at
    com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:287)
    at
    com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:208)
    at
    com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:88)
    at
    javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
    at
    com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at Chat.<init>(Chat.java:44)
    at Chat.main(Chat.java:113)
    Caused by: java.lang.ClassNotFoundException:
    com.sun.messaging.jms.ra.ResourceAdapter
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at
    com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:68)
    ... 8 more
    javax.naming.CommunicationException: serial context communication ex [Root
    exception is com.sun.enterprise.connectors.ConnectorRuntimeException: Error
    in creating active RAR]
    at
    com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:338)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at Chat.<init>(Chat.java:44)
    at Chat.main(Chat.java:113)
    Caused by: com.sun.enterprise.connectors.ConnectorRuntimeException: Error in
    creating active RAR
    at
    com.sun.enterprise.connectors.ActiveRAFactory.createActiveResourceAdapter(ActiveRAFactory.java:94)
    at
    com.sun.enterprise.connectors.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:287)
    at
    com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:208)
    at
    com.sun.enterprise.naming.factory.ConnectorObjectFactory.getObjectInstance(ConnectorObjectFactory.java:88)
    at
    javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
    at
    com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314)
    ... 3 more
    Caused by: java.lang.ClassNotFoundException:
    com.sun.messaging.jms.ra.ResourceAdapter
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
     
    RVince, Jul 3, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page