• Post Reply Bookmark Topic Watch Topic
  • New Topic

Glassfish InitialContext From App  RSS feed

 
George Berish
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving from JBoss to GlassFish, and all I want to do is to have my local app get an InitialContext from my Glassfish running on my local machine. Defeat plagues me!

So, will anyone help me get the simple example below to work?
I think it would be a big help to all who follow.
My code now produces this error message:
ERROR: NoInitialContextException
Cannot instantiate class: com.sun.appserv.naming.S1ASCtxFactory

If my attemp seems dumb .. well obviously it is, because it doesn't work.
But it would still be helpful to many if it was made smart.
Thanks.

PS: getProp(String[] array) at the bottom just lets me use the cute way to show key:value prop pairs I'm using.


 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cannot instantiate class: com.sun.appserv.naming.S1ASCtxFactory


Do you have the jar file containing the com.sun.appserv.naming.S1ASCtxFactory class in the client's classpath? You will find that jar file somewhere in the Glassfish installation.
 
George Berish
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
No I Didn't have: com.sun.appserv.naming.S1ASCtxFactory
Now I do. For reference it lives in:{GlassfishServer Home}\lib\appserv-rt.jar

Now my program's printline outputs:
ERROR: RuntimeException
Cannot Proceed. No Endpoints specified.

And the System.err print stream outputs:
Sep 2, 2009 9:34:19 AM com.sun.appserv.naming.RoundRobinPolicy setClusterInstanceInfo
WARNING: NAM1005 : No Endpoints selected. Please specify using system property com.sun.appserv.iiop.endpoints.
Sep 2, 2009 9:34:19 AM com.sun.appserv.naming.RoundRobinPolicy getEndpointForProviderURL
WARNING: NAM1002 : Exception : (0) thrown for bad provider URL String: http://localhost:8080
Sep 2, 2009 9:34:19 AM com.sun.appserv.naming.S1ASCtxFactory getInitialContext
SEVERE: NAM1005 : No Endpoints selected. Please specify using system property com.sun.appserv.iiop.endpoints.


I looked up the first warning and found a suggestion that I needed to chage my URL property to:
FM: java.naming.provider.url=http://localhost:8080
TO: java.naming.provider.url=iiop://localhost:3700 [Also tried 8080 and 4848 with same result-failure]

That changed the System.err print stream output to:
Sep 2, 2009 9:46:22 AM com.sun.appserv.naming.RoundRobinPolicy setClusterInstanceInfo
WARNING: NAM1005 : No Endpoints selected. Please specify using system property com.sun.appserv.iiop.endpoints.
Sep 2, 2009 9:46:22 AM com.sun.appserv.naming.RoundRobinPolicy getEndpointForProviderURL
WARNING: NAM1001: No Endpoints selected in com.sun.appserv.iiop.endpoints property. Using JNDI Provider URL iiop://localhost:3700 instead
Exception in thread "main" java.lang.NoClassDefFoundError: javax/security/jacc/PolicyContextException
at com.sun.enterprise.security.SSLUtils.<clinit>(SSLUtils.java:102)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.<init>(IIOPSSLSocketFactory.java:182)


Now all I have it the "No Endpoints" warning. Anyone know what that is.

And the instruction to Using JNDI Provider URL iiop://localhost:3700 instead is confusing, because that is what I tried.

Help.
GLB
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!