• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error in 'Remote Java SE Client with JNDI Lookup'

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

I am trying to execute example program in Ivan's note '5.2.4.Remote Java SE Client with JNDI Lookup' page number 84 - 85.

Its written that "Include the GlassFish v3 client runtime library JAR on the classpath. The library can be found in: $GLASSFISH_HOME/modules/gf-client.jar"

I have Glassfish v3 installed but I am unable to find a file names gf-client.jar under the directory modules but there is one at $GLASSFISH_HOME/lib/gf-client.jar

I have included this jar as well as javax.ejb.jar in my classpath.

However on running the main class I am getting an error as below.

*** Starting Remote EJB Lookup... javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325) at javax.naming.InitialContext.lookup(InitialContext.java:392) at com.saurav.scbcd6.seclient.RemoteSESessionBeanClient.lookupEJB(RemoteSESessionBeanClient.java:29) at com.saurav.scbcd6.seclient.RemoteSESessionBeanClient.main(RemoteSESessionBeanClient.java:58)

When I add all the classes present in Glassfish runtime ($GLASSFISH_HOME/modules/*), I am able to run the example.

Please let me know the exact jar that I need to add to run the example above.
 
Kr Saurav
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ok I got the issue. Actually I had copied gf-client.jar into my Java Project and then added that as a jar in the build path.
However gf-client.jar has a lot of dependencies to the jars present in $GLASSFISH_HOME/modules/*.jar

Hence I removed the local jar from the build path and added gf-client.jar as an external jar(specifying path to $GLASSFISH_HOME/lib/gf-client.jar) in my eclipse build path.
That way all the dependent jars were also added automatically to the build path.

Regards,
Saurav
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done and thanks for sharing the solution!

You can find the solution also in the Glassfish EJB FAQ.

Regards,
Frits
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic