Hi!
pranab wrote:
> I was trying to use the prefix "java:comp/env" to lookup on a
> EJB.
> It doesn't work that way in Jboss2.However it works when doing a plain
> lookup on the EJB JNDI Name.
>
> I used this code to find out whats in there in the jndi context
>
> Context jndiContext = getInitialContext();
> System.out.println("Name:"+
> jndiContext.getNameInNamespace());
> System.out.println("Environment:"+
> jndiContext.getEnvironment());
> javax.naming.NamingEnumeration enum = jndiContext.list("");
> while(enum.hasMore())
> {
> System.out.println("Object:"+enum.next());
> }
> javax.naming.NamingEnumeration enum =
> jndiContext.list("jdbc");
> while(enum.hasMore())
> {
> System.out.println("Object:"+enum.next());
> }
> here is the output
> Object:Hypersonic: org.jboss.jdbc.DataSourceImpl
> Object:jmx: org.jboss.jmx.server.JMXAdaptorImpl
> Object:TravelAgentBean: $Proxy0
> Object:Cabin: $Proxy1
> Object:jdbc: org.jnp.interfaces.NamingContext
> Object:xa.postgresqlPool: org.jboss.minerva.datasource.XAPoolDataSource
> Object:InstantDB: org.jboss.jdbc.DataSourceImpl
> Object:TransactionManager: class org.jboss.tm.TxManager
> initial context :javax.naming.InitialContext@b66cc
> Object:jdbc/postgresql: org.jboss.jdbc.DataSourceImpl
You are listing the root default context. This is exactly how it should
be.
> I think the call getNameInNamespace for the root context is not mapped
> to "java:comp/env"
> string.
Which it should not be.
> Is it how it is supposed to function???????
Yes. You are accessing the default JNDI namespace. If you want to access
the java: namespace then you must lookup the java: namespace. Like this:
Context ctx = new InitialContext().lookup("java:comp/env");
.. and do a listing of that. The contents will be what you specified in
your ejb-jar.xml descriptor. If you haven't specified anything (no
references or environment entries) it will be empty.
/Rickard
--
Rickard �berg
@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]