EJB, JNDI and java application server 9, PLEASE HELP!!!
Hi
I just started to learn EJB. I bought a book (oreilly's Enterprise JavaBeans 3.0) and started to read. I got to the point of creating my first test. the EJB module deployed correctly in SJAS 9, but I can't make the client application to get the JNDI context.
I read a lot of documentation but nothing I did seemed to work.
I deployed the EJB without descriptor and from what I read in the documentation it resolved to the fully qualified name of the class:
sadmin> list-jndi-entries
Jndi Entriesfor server within root context:
com.titan.travelagent.TravelAgentRemote__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
UserTransaction: com.sun.enterprise.distributedtx.UserTransactionImpl
jdbc: com.sun.enterprise.naming.TransientContext
com.titan.travelagent.TravelAgentRemote: javax.naming.Reference
com.titan.travelagent.TravelAgentRemote#com.titan.travelagent.TravelAgentRemote: javax.naming.Reference
ejb: com.sun.enterprise.naming.TransientContext
jbi: com.sun.enterprise.naming.TransientContext
Command list-jndi-entries executed successfully.
from the above I understand that the name to search is: "com.titan.travelagent.TravelAgentRemote".
Here's the code I have to access the EJB:
publicstatic Context getInitialContext()
throws javax.naming.NamingException{
Properties p =new Properties();
p.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
p.put("java.naming.provider.url","iiop://127.0.0.1:3700" );
returnnew javax.naming.InitialContext(p);
}
/**
* @param args the command line arguments
*/
publicstaticvoid main(String[] args){
try{
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("com.titan.travelagent.TravelAgentRemote");
TravelAgentRemote dao = (TravelAgentRemote) PortableRemoteObject.narrow(ref, TravelAgentRemote.class);
...
but I always get an exception:
javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:44)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.titan.clients.Client.main(Client.java:45)
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
... 4 more
and nothing on the server's log.
can someone PLEASE help?
thanks
--
Haim

