Hi Guys,
         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

 I think the call getNameInNamespace for the root context is not mapped
to "java:comp/env"
 string.

 Is it how it is supposed to function???????

PKD
Rickard �berg wrote:
> 
> Hi!
> 
> Dan Christopherson wrote:
> > But if your arbitrary name (quux, say) shows up under
> > java:comp/env/ejb/quux in one container and under /quux under another,
> > isn't that a problem?
> 
> Yes, 'cause then one of them would be buggy ;-)
> 
> The prefix is always "java:comp/env". The suffix is always the ejb-name
> that is defined for the EJB-reference in the ejb-jar.xml file. So if
> *you* specify "ejb/Foo" the name is going to be "java:comp/env/ejb/Foo",
> and if *you* specify "Foo" the name is going to be "java:comp/env/Foo".
> 
> There is no arbitray choice for the container to make. Everything is
> deterministic.
> 
> Clear? :-)
> 
> /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]


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to