ejb@glassfish.java.net

must remote interface class in classpath of the EJB3 remote client ????

From: Zhi Liu <zhi.liu_at_thoranet.de>
Date: Fri, 14 Jul 2006 14:51:27 +0200

Hello ,
   
I have followed your EJB FAQ and tried to access a Remote EJB from a stand-alone jave client from another machine.
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB
   
Following is code snap of my client:
------------------------------------------------------------------------
 Context jndiContext = new InitialContext();
 com.ejb3test.TimeTellerRemote ttb = (com.ejb3test.TimeTellerRemote) jndiContext.lookup("com.ejb3test.TimeTellerRemote");
 System.out.println(ttb.tell_time());
---------------------------------------------------------------------------
TimeTellerRemote is the remote bussiness interface.
  
The problem is , if I run the client as you described in EJB FAQ like following:
          java -Dorg.omg.CORBA.ORBInitialHost=servername
         -classpath $APS_HOME/lib/appserv-rt.jar:$APS_HOME/lib/javaee.jar:/home/user1/myclientclasses MyClient
   
I get following Errors:
------------------------------------------------------------------------------------------------------------------------------------------
javax.naming.NamingException: ejb ref resolution error for remote business interface com.ejb3test.TimeTellerRemote
[Root exception is java.lang.ClassNotFoundException: com.ejb3test.TimeTellerRemote]
-------------------------------------------------------------------------------------------------------------------------------------------
Seems the remote business interface can not be found using JNDI, but following jndi entries are on the server through asadmin list-jndi-entries :
   
> asadmin list-jndi-entries
------------------------------------------------------------------------------------------
Jndi Entries for server within root context:
UserTransaction: com.sun.enterprise.distributedtx.UserTransactionImpl
com.ejb3test.TimeTellerRemote__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
com.ejb3test.TimeTellerRemote: javax.naming.Reference
com.ejb3test.TimeTellerRemote#com.ejb3test.TimeTellerRemote: javax.naming.Reference
jdbc: com.sun.enterprise.naming.TransientContext
ejb: com.sun.enterprise.naming.TransientContext
jbi: com.sun.enterprise.naming.TransientContext
Command list-jndi-entries executed successfully.
---------------------------------------------------------------------------------------------
If I include the class of remote interface in classpath, It works. But in your EJB FAQ you didn't mention that. It said in EJB FAQ :
Our implementation uses a feature called "Dynamic RMI-IIOP" that creates any necessary RMI stubs at runtime in a way that is completely hidden from the application.
If I don't misunderstand with the Dynamic RMI-IIOP Feature I don't need the stub and don't need the remote interface class in classpath, is that right?
   
Thank you for you helf
   
best regards
   
zhi