EJB and JNDI problem
Hi
I'm trying to learn EJB, so I downloaded the AppServer 9, bought a book (Oreilly's Enterprise JavaBeans 3.0) and started to read. now I've got to the point where I have to run some EJB's and I'm stuck.
I deployed the Bean with the following descriptor:
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>TravelAgentBean</ejb-name>
<jndi-name>ejb/TravelAgentRemote</jndi-name>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
(at first I tried without a descriptor at all but the result was the same).
Here's the list of my Server's jndi entries:
asadmin> list-jndi-entries --context ejb
Jndi Entries for server within ejb context:
TravelAgentRemote#com.titan.travelagent.TravelAgentRemote: javax.naming.Reference
mgmt: com.sun.enterprise.naming.TransientContext
TravelAgentRemote: javax.naming.Reference
TravelAgentRemote__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
Command list-jndi-entries executed successfully.
now, when I try to access the ejb from a remote stand-alone client with the following code:
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("ejb/TravelAgentRemote");
TravelAgentRemote dao = (TravelAgentRemote) PortableRemoteObject.narrow(ref, TravelAgentRemote.class);
I get this 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
Can anybody PLEASE help me on this? I tried reading the developer guide, searching the forum, etc... for the last 2 days and nothing helped.
Thanks
--
Haim

