users@glassfish.java.net

deploying and running an app client using glassfish v 2.1

From: <glassfish_at_javadesktop.org>
Date: Mon, 14 Dec 2009 16:52:15 PST

I'm trying to deploy and run an app client using glassfish. I deploy the jar using the following application-client.xml:
[code]
<?xml version="1.0" encoding="UTF-8"?>
<application-client version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application-client_5.xsd">
  <display-name>ApplicationClient1</display-name>
</application-client>
[/code]

But when I try to run the application (through the glassfish admin console) I get the following runtime error:
[code]
Dec 14, 2009 7:36:46 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
java.lang.NoClassDefFoundError: com/foo/bar
        at applicationclient1.Main.main(Main.java:22)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.sun.enterprise.appclient.jws.boot.JWSACCMain.run(JWSACCMain.java:221)
        at com.sun.enterprise.appclient.jws.boot.JWSACCMain.main(JWSACCMain.java:182)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.javaws.Launcher.executeApplication(Launcher.java:1528)
        at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1466)
        at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1277)
        at com.sun.javaws.Launcher.run(Launcher.java:117)
        at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.ClassNotFoundException: com.foo.bar
        at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:738)
        at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:628)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
        ... 22 more
Error launching or running the application
java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.sun.enterprise.appclient.jws.boot.JWSACCMain.run(JWSACCMain.java:221)
        at com.sun.enterprise.appclient.jws.boot.JWSACCMain.main(JWSACCMain.java:182)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.javaws.Launcher.executeApplication(Launcher.java:1528)
        at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1466)
        at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1277)
        at com.sun.javaws.Launcher.run(Launcher.java:117)
        at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:461)
        ... 15 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
        ... 15 more
Caused by: java.lang.NoClassDefFoundError: com/foo/bar
        at applicationclient1.Main.main(Main.java:22)
        ... 21 more
Caused by: java.lang.ClassNotFoundException: com.foo.bar
        at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:738)
        at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:628)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
        ... 22 more
[/code]

the com.foo.bar class being reference is in a jar file called foo.jar. I copied the jar file to the glassfish/lib/ and glassfish/lib/domain/domain/lib/ext/. But I still get the same runtime error. However I'm able to run the application from the command line using the appclient script included with glassfish: ( I had to export the APPCPATH variable so it references the jar file I needed)
[code]
export APPCPATH=foo.jar
./glassfish/bin/appclient -xml sun-acc.xml myApp.jar
[/code]

Thanks,

Jerry
[Message sent by forum member 'djgerbavore' ]

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