trying to loosely follow:
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
steps 1 & 2:
import javax.naming.InitialContext;
import javax.naming.NamingException;
public final class SessionBeanClient {
private static SimpleSession simpleSession;
private void invokeSessionBeanMethods() {
System.out.println(simpleSession.getMessage());
System.out.println("\nSimpleSession is of type: "+simpleSession.getClass().getName());
}
public final static void main (final String[] args) throws NamingException {
final InitialContext ctx = new InitialContext();
simpleSession=(SimpleSession)ctx.lookup("SimpleSessionBean");
new SessionBeanClient().invokeSessionBeanMethods();
}
}
step 3 - add appserv-rt - but appserv-rt is not in glassfish, i have been adding jars one at a time:
#!/bin/bash
export PATH=${PATH}:~/glassfish/glassfishv3/glassfish/bin
export CLASSPATH=/usr/java/jre/lib/rt.jar:~/glassfish/glassfishv3/glassfish/modules/javax.ejb.jar::~/glassfish/glassfishv3/glassfish/modules/glassfish-naming.jar::~/glassfish/glassfishv3/glassfish/modules/internal-api.jar::~/glassfish/glassfishv3/glassfish/modules/hk2-core.jar::~/glassfish/glassfishv3/glassfish/modules/auto-depends.jar::~/glassfish/glassfishv3/glassfish/modules/glassfish-api.jar:../Bean/SimpleSessionBean.jar:.
java SessionBeanClient
but now - i have an error that i don't know how to fix:
Exception in thread "main" java.lang.LinkageError: Failed to inject class com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl from sun.misc.Launcher$AppClassLoader_at_601bb1
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:163)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:166)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:90)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:87)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at org.jvnet.hk2.component.Habitat.getByContract(Habitat.java:570)
at com.sun.enterprise.naming.impl.NamedNamingObjectManager.checkAndLoadProxies(NamedNamingObjectManager.java:66)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:387)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at SessionBeanClient.main(SessionBeanClient.java:15)
Caused by: java.lang.NoClassDefFoundError: org/jvnet/tiger_types/Types
at com.sun.hk2.component.AbstractWombImpl$1.getValue(AbstractWombImpl.java:122)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:81)
... 13 more
Caused by: java.lang.ClassNotFoundException: org.jvnet.tiger_types.Types
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 15 more
any help would be appreciated.
[Message sent by forum member 'xdavidx' (dscott_at_pathworkdx.com)]
http://forums.java.net/jive/thread.jspa?messageID=363408