I'm working my way through a book about "Java EE 7 for Glassfish", with the server installed on Fedora Linux.
I have a simple stateless session bean SimpleSessionBean deployed on the server and I am trying to approach that SimpleSessionBean via SessionBeanClient and the Glassfish command line tool appclient, running a client jar. Everything from the book, so it should work. The client however can't find SimpleSessionBean. Apparently a class path issue. In the server logs nothing happened.
I can't find any pointers how Glassfish should be properly installed. Everything works within the server. I can approach installed war files from facelets running in a browser.
It is probably a matter of setting $PATH right or something or some other environment variable. Any pointers to relevant literature?
Thanks in advance for any suggestions!
UPDATE1: error message
From the bash terminal window where I run appclient:
[fedora@localhost bin]$ ./appclient -client /home/fedora/Downloads/6886EN_04_Code/ch04_src/simplesessionbeanclient/target/simplesessionbeanclient.jar
Jul 06, 2017 12:52:57 PM org.glassfish.apf.impl.DefaultErrorHandler error SEVERE: Class [ Lnet/ensode/glassfishbook/SimpleSession; ] not found.
Error while loading [ class net.ensode.glassfishbook.SessionBeanClient ] Exception in thread "main" java.lang.NoClassDefFoundError: net/ensode/glassfishbook/SimpleSession at net.ensode.glassfishbook.SessionBeanClient.invokeSessionBeanMethods(SessionBeanClient.java:12) at net.ensode.glassfishbook.SessionBeanClient.main(SessionBeanClient.java:19) Caused by: java.lang.ClassNotFoundException: net.ensode.glassfishbook.SimpleSession at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at org.glassfish.appclient.client.acc.ACCClassLoader.findClass(ACCClassLoader.java:237) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
UPDATE2: From the Glassfish book:
We are using Maven to build our code. For this example, we used the Maven Assembly plugin (http://maven.apache.org/plugins/maven-assembly-plugin/) to build a client JAR file that includes all dependencies; this frees us from having to specify all the dependent JAR files in the -classpath command-line option of the appclient utility. To build this JAR file, simply invoke mvn assembly:assembly from the command line.
SOLUTION: the missing link was producing a client jar with additional jar's "on board" so to speak. Proceed as follows (at least in Eclipse): select pom.xml > right-click > Run As > Maven build... > enter in Goals field: assembly:assembly> Apply/Run.
The result will be that you will find TWO jars under your target folder: xxxclient.jar and xxxclient-jar-with-dependencies.jar. From the command line in bash execute from the folder with latter jar:
/path_to/appclient -client xxxclient-jar-with-dependencies.jar
After a very long wait (on my $200 mini Linux box) the HelloWorld-ish server EJB gets finally properly called.