Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

JMS (JNDI InitialContext) with Sun Application Server

Thread view: 
RVince - 02 Jul 2007 01:32 GMT
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
Manish Pandit - 03 Jul 2007 00:08 GMT
>         For a remote client running connecting to a server at serverAddr
> running OpenJMS, I am able to obtain an InitialContext as follows:
[quoted text clipped - 12 lines]
> 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
RVince - 03 Jul 2007 00:56 GMT
Do you know what jars I must include Manish? Thanks, R.Vince
Manish Pandit - 03 Jul 2007 04:10 GMT
> 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
RVince - 03 Jul 2007 11:54 GMT
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)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.