OK. I've tried to make sure of due diligence on this. I just came from
following up on the
http://www.nabble.com/EJB-access-from-remote-application-client-to10167085.html#a10167296
EJB access from remote application client from last year. I have read the
articles referenced (
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB
EJB FAQ >> How Do I Access A Remote EJB from a stand-alone java client? ;
http://java.sun.com/javaee/5/docs/tutorial/doc/bnboc.html The Java EE 5
Tutorial Chapter 22 ; and the
http://docs.sun.com/app/docs/doc/819-3659/bealk?q=java+ee+5&a=browse Sun
Java System Application Server Platform Edition 9 Developer's Guide ) as
well as reading (hopefully pertinent parts) and searching though O'REILLY's
Enterprise JavaBeans 3.0 (5th Edition - Covers Java Persistence), MANNING's
EJB3 IN ACTION, APRESS' Pro EJB 3: Java Persistence API, and Wiley's
Mastering Enterprise JavaBeans (Third Edition (EJB2.1)). My guess is that I
just need another set of eyes to help.
Here's what I have so far. Using Netbeans 6.1 I created a Persistence Unit
(named EJBTestPU) and a session beans which utilizes the Persistence
capability (EnrollSessionBean) having the Remote interface
(EnrollSessionRemote). I have written, compiled, and deployed this NB6.1
project - EJBTest.jar - to my host server. So far so good (I hope).
Next I modified an old Test program written in java and am attempting to
allow it to use the the Remote EJB/PU to persist the enrollment information
gathered by the Test program to the database. I have the following code
snippet rolled into the old Test program:
Class variables:
private Context jndiCtx = null;
private EnrollSessionBean enrollSessBean;
In main:
try
{
jndiCtx = new InitialContext();
System.out.println( "Initial Context ["+jndiCtx.toString()+"]");
enrollSessBean = ( EnrollSessionBean) jndiCtx.lookup( "EnrollSessionBean");
System.out.println( "Enroll Session Bean ["+enrollSessBean.toString()+"]");
}
catch (NamingException ex)
{
TestLogger.log( Level.SEVERE, program, ex);
System.out.println( "Naming Exception:");
ex.printStackTrace();
}
When I execute the program I get the following stack trace:
Initial Context [javax.naming.InitialContext_at_166afb3]
Naming Exception:
javax.naming.NameNotFoundException: EnrollSessionBean not found
at
com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at
com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at
com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
at
com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:129)
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:585)
at
com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at
com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
at
com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
at
com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
at
com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
According to
https://glassfish.dev.java.net/javaee5/ejb/examples/Sless.html#JavaClient
GlassFish Project - Simple Enterprise JavaBeansTM (EJB) 3.0 Stateless
Session Bean Example I am only required to have the jndi.properties file
correctly set and provide classpath access to the appserv-rt.jar and
javaee.jar (if I understand correctly). No other files (xml descriptors)
are required according to this quote from the article:
There is no need to define any SUN App Server-specific deployment
descrpitors (e.g. sun-ejb-jar.xml, sun-application-client.xml) for this
example.
What did I miss, or what do I need to do different?
Thank you.
rdb
--
View this message in context: http://www.nabble.com/EJB-access-from-remote-Stand-Alone-Client-tp18120676p18120676.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.