Does one JAR depend upon another for the ACC? The documentation isn't crystal clear on this, at least so far as I've read.
My understanding is that I need to build an EAR from existing code which I can deploy remotely. This EAR should contain the existing client. All of the code: 1.) the client, 2.) the EJB module and 3.) the remote interface runs on localhost. I've deployed the EJB to a remote Glassfish server.
How do I create an "ant-java-ee project" from Creating and Running an Application Client on the GlassFish Server? The sample I created packages very oddly. Netbeans doesn't seem to have a "ant jar" option which builds it in a familiar way for me. There's no ant jar
target as is typical with Netbeans applications; ant dist
results in:
dist:
BUILD SUCCESSFUL
Total time: 6 seconds
thufir@dur:~/NetBeansProjects/HelloClient$ ll
total 32
drwxrwxr-x 7 thufir thufir 4096 Sep 19 11:51 ./
drwxrwxr-x 16 thufir thufir 4096 Sep 16 09:22 ../
drwxrwxr-x 5 thufir thufir 4096 Sep 19 11:51 build/
-rw-rw-r-- 1 thufir thufir 3654 Sep 13 20:40 build.xml
drwxrwxr-x 2 thufir thufir 4096 Sep 19 11:51 dist/
drwxrwxr-x 3 thufir thufir 4096 Sep 13 20:38 nbproject/
drwxrwxr-x 4 thufir thufir 4096 Sep 13 20:38 src/
drwxrwxr-x 2 thufir thufir 4096 Sep 13 20:38 test/
thufir@dur:~/NetBeansProjects/HelloClient$ ll dist/
total 12
drwxrwxr-x 2 thufir thufir 4096 Sep 19 11:51 ./
drwxrwxr-x 7 thufir thufir 4096 Sep 19 11:51 ../
-rw-rw-r-- 1 thufir thufir 1848 Sep 19 11:51 HelloClient.jar
thufir@dur:~/NetBeansProjects/HelloClient$
thufir@dur:~/NetBeansProjects/HelloClient$
thufir@dur:~/NetBeansProjects/HelloClient$ java -jar dist/HelloClient.jar
Exception in thread "main" java.lang.NoClassDefFoundError: hello/HelloBeanRemote
at helloclient.Main.main(Main.java:11)
Caused by: java.lang.ClassNotFoundException: hello.HelloBeanRemote
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 1 more
thufir@dur:~/NetBeansProjects/HelloClient$
On the other hand, ant run
gives good results:
-run:
[java] hello world
run:
BUILD SUCCESSFUL
Total time: 28 seconds
thufir@dur:~/NetBeansProjects/HelloClient$ ll dist/
total 32
drwxrwxr-x 3 thufir thufir 4096 Sep 19 11:56 ./
drwxrwxr-x 7 thufir thufir 4096 Sep 19 11:56 ../
drwxrwxr-x 2 thufir thufir 4096 Sep 19 11:56 HelloClientClient/
-rw-rw-r-- 1 thufir thufir 13106 Sep 19 11:56 HelloClientClient.jar
-rw-rw-r-- 1 thufir thufir 1848 Sep 19 11:56 HelloClient.jar
thufir@dur:~/NetBeansProjects/HelloClient$
These jar's are not packaged how I would expect:
thufir@dur:~/NetBeansProjects/HelloClient$
thufir@dur:~/NetBeansProjects/HelloClient$ jar -tf dist/HelloClient.jar
META-INF/
META-INF/MANIFEST.MF
helloclient/
META-INF/application-client.xml
helloclient/Main.class
thufir@dur:~/NetBeansProjects/HelloClient$
thufir@dur:~/NetBeansProjects/HelloClient$ jar -tf dist/HelloClientClient.jar
META-INF/MANIFEST.MF
META-INF/application-client.xml
META-INF/glassfish-application-client.xml
META-INF/sun-application-client.xml
org/glassfish/appclient/client/AppClientFacade.class
META-INF/javaee.client.policy
META-INF/restrict.client.policy
thufir@dur:~/NetBeansProjects/HelloClient$
thufir@dur:~/NetBeansProjects/HelloClient$ jar -tf dist/HelloClientClient/HelloClient
HelloClientClient.jar HelloClient.jar
thufir@dur:~/NetBeansProjects/HelloClient$ jar -tf dist/HelloClientClient/HelloClient.jar
META-INF/MANIFEST.MF
META-INF/application-client.xml
helloclient/Main.class
thufir@dur:~/NetBeansProjects/HelloClient$
thufir@dur:~/NetBeansProjects/HelloClient$ jar -tf dist/HelloClientClient/HelloClientClient.jar
META-INF/MANIFEST.MF
META-INF/application-client.xml
META-INF/glassfish-application-client.xml
META-INF/sun-application-client.xml
org/glassfish/appclient/client/AppClientFacade.class
META-INF/javaee.client.policy
META-INF/restrict.client.policy
thufir@dur:~/NetBeansProjects/HelloClient$
I'm unclear as to the relationship between these JAR's. Typically Netbeans will build a "lib" folder for API's. In this case, there's some magic with the ACC. The goal is to package this application as an EAR in order to deploy it to the remote Glassfish server.