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]
# 1
Do you use Sunone Application Server? I guess you have not set the JNDI for the EJB on Enterprise Application project. I think you can set the JNDI to ejb/MyBeanEnterprise for the EJB. I use Websphere Server.
evilknighthka at 2007-7-14 21:41:00 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

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 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

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

bashdrewa at 2007-7-14 21:41:00 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4

Hi Andrew,

You should never need to edit the jndi.properties file in appserv-rt.jar.The only values you might need to override are host/port, which can be set as -D properties when starting the client JVM. See steps 4 and 5 from the stand-alone client access portion of the ejb faq :

https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB

ksaksa at 2007-7-14 21:41:00 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
Hello i think i found a case where you need to overwrite the jndi.properties. I use Java webstart for my standalone clients. I think it is not possible to use -d Flags. Perhaps you/anybody knows a workaround.Best regards
sebastian.puhla at 2007-7-14 21:41:00 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...