Re: Bind Datasource to specific jndi name

2008-09-16 Thread David Blevins


On Sep 16, 2008, at 3:42 AM, Andreas Karalus wrote:



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?


Right, internally we depend on things being at a known place  
(java:openejb).  We could bind things to additional places but we will  
still need to maintain the java:openejb namespace. The use of LinkRef  
should allow you to have all the extra JNDI names you need, we just  
need to figure out what might be happening.


Is it possible you can post the complete initialization stacktrace as  
long as some sample code that shows how you are constructing the  
InitialContext you are using to do the binding/lookup?


-David





Re: Bind Datasource to specific jndi name

2008-09-16 Thread Andreas Karalus

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
>>
>> 
>>JdbcDriver  oracle.jdbc.driver.OracleDriver
>>JdbcUrl  jdbc:oracle:thin:@localhost:1521:orcl
>>UserNamescott
>>Passwordtiger
>> 
>>
>>
>> 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:
> 
> 
>
> 
> 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.



Re: Bind Datasource to specific jndi name

2008-09-15 Thread David Blevins


On Sep 9, 2008, at 5:53 AM, Andreas Karalus wrote:



hello,

i've configured a datasource like this


   JdbcDriver  oracle.jdbc.driver.OracleDriver
   JdbcUrl  jdbc:oracle:thin:@localhost:1521:orcl
   UserNamescott
   Passwordtiger



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:



  

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



Bind Datasource to specific jndi name

2008-09-09 Thread Andreas Karalus

hello,

i've configured a datasource like this

 
JdbcDriver  oracle.jdbc.driver.OracleDriver
JdbcUrl  jdbc:oracle:thin:@localhost:1521:orcl
UserNamescott
Passwordtiger



is it possible to bind the datasource to a specific jndi name? especially, I
would like to bind the datasource to "java:/operativDS"

thx in advance,
andreas
-- 
View this message in context: 
http://www.nabble.com/Bind-Datasource-to-specific-jndi-name-tp19391707p19391707.html
Sent from the OpenEJB User mailing list archive at Nabble.com.