list ejb mapped names
hi,
i encountered an odd problem. my ejb 3.0 was working before i left work last night. when i came in this morning, without touching any code, it suddenly gives me an javax.naming.NameNotFoundException. i defined the mapping with @Stateless(mappedName="ejb/MyBean"). what could have happened? is there a way for me to list the ejb mapped names using asadmin? thanks.
this is how i access my EJB 3.0
Hashtable props =new Hashtable();
props.put("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
props.put("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
props.put("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.put("org.omg.CORBA.ORBInitialHost", host_);
props.put("org.omg.CORBA.ORBInitialPort", Integer.toString(port_));
try
{
Context ic =new InitialContext(props);
MyBeanRemote objref = (MyBeanRemote)ic.lookup("ejb/MyBean");
if(objref !=null)
{
return objref;
}
}
it works when i deploy it as an EJB module, but it does not when i deploy as an enterprise application. do i have to do something else? thanks.
regards,
andrew
Message was edited by:
bashdrew
Message was edited by:
bashdrew
[1875 byte] By [
bashdrewa] at [2007-10-3 3:44:43]

Hi Andrew,
First off, we don't recommend hardcoding all the naming properties in your stand-alone client code.It's better to use the no-arg InitialContext() and let the naming provider be bootstrapped automatically from the jndi.properties file we have in appserv-rt.jar.Harcoding the properties is a last resort typically only used when accessing remote ejbs from a non Java EE web server like tomcat or resin. There's more about that in our FAQ.
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB
What do you mean by it doesn't work? What error are you getting and when does the error occur? If there's a stack trace involved please post it in its entirety.
There's no way to list the global JNDI namespace from asadmin but you can inspect it via the admin GUI at http://localhost:4848.
--ken
ksaksa at 2007-7-14 21:41:00 >

hi,
i just checked the stack trace. it states an exceptionregarding the persistence unit that i created but it was deployed successfully. i was trying to access 2 different databases in ejb so i created another unit and unchecked the "use java transaction api" which may be causing the error. so it's not really a jndi problem. sorry for the confusion.it really helps to refer to the logs. thanks again for your help.
regarding the jndi.properties in appserv-rt.jar, do i have to unjar and jar it to edit the jndi.properties? thanks again.
regards,
andrew