Hi David, thank you for your hint, I tried this, but still got exception: In the code for intialisation of openejb:
initialContext.bind("java:operativDS", new javax.naming.LinkRef("java:openejb/Resource/operativDS")); In the test Code: // this is ok DataSource operativDS = (DataSource) initialContext.lookup("java:openejb/operativDS"); // this one fails, but this is the lookup I need DataSource operativDS = (DataSource) initialContext.lookup("java:/operativDS"); So is there a possibility to bind directly to java: and not to java:openejb? It seems to me like java:openejb is kind of hardcoded? Regards, Andreas David Blevins wrote: > > > On Sep 9, 2008, at 5:53 AM, Andreas Karalus wrote: > >> >> hello, >> >> i've configured a datasource like this >> >> <Resource id="operativDS" type="DataSource"> >> JdbcDriver oracle.jdbc.driver.OracleDriver >> JdbcUrl jdbc:oracle:thin:@localhost:1521:orcl >> UserName scott >> Password tiger >> </Resource> >> >> >> is it possible to bind the datasource to a specific jndi name? >> especially, I >> would like to bind the datasource to "java:/operativDS" > > Everything in the config is bound to something that closely matches > its path in the openejb.xml file. So for example: > > <openejb> > <Resource id="operativDS" ...> > > Is bound to: > > new InitialContext().lookup("java:openejb/Resource/operativDS"); > > If you wanted to make it available at a different name, you could > easily add the link yourself with some code like this after OpenEJB > has been embedded: > > InitialContext context = new InitialContext(); > context.bind("java:operativDS", new > javax.naming.LinkRef("java:openejb/Resource/operativDS")); > > -David > > > -- View this message in context: http://www.nabble.com/Bind-Datasource-to-specific-jndi-name-tp19391707p19509314.html Sent from the OpenEJB User mailing list archive at Nabble.com.