JMS (JNDI InitialContext) with Sun Application Server

R

RVince

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
 
M

Manish Pandit

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
 
M

Manish Pandit

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
 
R

RVince

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)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top