users@glassfish.java.net

Re: Standalone client of GlassFish v3

From: <glassfish_at_javadesktop.org>
Date: Wed, 10 Mar 2010 11:33:07 PST

I am not sure what your original problem was - maybe I missed exactly what NetBeans problem you were running into.

I have attached a zip file containing an example that works for me with NetBeans 6.8 and a very current build of GlassFish 3.1. The example simply gets a Date object for the current date and time from the server's stateless session bean and then the client displays the string equivalent.

The zip contains three projects:

SimpleTest - an EAR with an EJB submodule and an app client submodule (although the app client is not really needed for your use case)

SimpleTestCommon - a library JAR containing the EJB's remote interface

SimpleTestSA - a Java SE project containing the Java SE client


I added SimpleTestCommon as a library to the SimpleTest EJB submodule and to the SimpleTestSA Java SE client project. I also added the gf-client.jar from my GlassFish installation as a library to SimpleTestSA.

NetBeans copied the two library JARs into the SimpleTestSA/dist/lib folder - and added Class-Path references to them to the SimpleTestSA manifest.

[b]Note that we cannot rely on that copy of gf-client.jar, because of its own relative references to other GlassFish JARs which NetBeans does not copy into the dist/lib folder.[/b]

I was able to run the Java SE client from inside NetBeans normally. I could also run it successfully from outside NetBeans by using

java -classpath (path-to-my-gf-client.jar):(path-to-SimpleTestSA/dist/SimpleTestSA.jar) simpletestsa.Main

It is only by adding my installation's gf-client.jar to the runtime classpath that I made all those JARs referenced from gf-client's manifest available.

Lastly, note that I used the Java EE 6 portable JNDI name to look up the resource, as suggested by the EJB FAQ which Ken pointed to earlier.

Hope this helps.

- Tim
[Message sent by forum member 'tjquinn' (timothy.quinn_at_sun.com)]

http://forums.java.net/jive/thread.jspa?messageID=391092