|Running Application Client Project in IDE [message #169999]
||Wed, 24 May 2006 01:06
Originally posted by: gsmith.gregsmith.com|
I have a simple test program that runs as an Application Client Project;
nothing fancy, just some System.out.println of information that's looked
up via JNDI. The application server is the Sun Appserver 8.1, hooked into
Eclipse 3.1.2/WTP 1.0.1 via the Glassfish plug-in 0.21 (which isn't
compatible with WTP 1.0.2 yet)
If I try to use "Run On Server", it says "No launchable artifact could be
found in the selection", which I guess makes sense; I didn't expect an
Application client to run by itself there. Running the code within
Eclipse using Run As/Java Application, it kicks back this error:
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
From the FAQ at http://docs.sun.com/source/819-0789/tsg-faq.html , it
seems this is because the server requires that the appserv-rt.jar library
be in the classpath for JNDI to work. It's not included when I browse
through the listing of libraries for the "Sun Application Server 8.1"
entry within Eclipse.
I can confirm that the code that Eclipse builds works correctly. If I go
into the temporary directory it uses to build the EAR and run something
java -cp ./test.jar;SERVER/appservrt.jar;SERVER/lib/j2ee.jar Main
the program launches perfectly.
As I'm very new to WTP/J2EE, I'm at a loss as to the correct way to deal
with all these facts, and would appreciate some advice. Questions that
pop into my head here include:
1) What is the right way to run an Application Client?
2) Can I just manually add appservrt.jar into the classpath somehow within
Eclipse? I've tried importing it from the filesystem into the build tree
the way I've successfully added library JARs in the past, but haven't had
any success; no change in the error message. If there's a way to do it I
haven't figured it out yet.
3) Should the fact that appservrt.jar is missing from the library listing
be considered a bug I might report? If so, is it a bug in Glassfish or
4) Might this problem go away with Sun App Server 8.2? (time intensive to
test, and I doubt it will)
* Greg Smith firstname.lastname@example.org http://www.gregsmith.com Baltimore, MD
Powered by FUDForum
. Page generated in 0.04204 seconds