HELP! JNDI DataSource Name

2008-09-19 Thread rde8026

Hello,

I'm sorry to post to message; I've seen a bunch of messages like this posted
but everything I've read and tried doesn't seem to work and I have no idea
why.

I'm trying to get a reference to a Container Managed DataSource (configured
in my openejb.xml file).  I can get the reference via the @Resource
annotation but I am unable to get the resource via standard JNDI.

here is my code




Object obj1 = new
javax.naming.InitialContext().lookup("java:openejb/Resource/JTADS");
I've also tried it like this:
Properties props = new Properties();
props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
javax.naming.Context ctx = new javax.naming.InitialContext(props);
Object obj1 = ctx.lookup("java:openejb/Resource/JTADS");

I always get this error: NameNotFoundException: Name
"java:openejb/Resource/JTADS" not found.

Now the reason I need to understand the correct JNDI name is so I can use it
as a Hibernate Property (hibernate.connection.datasource).

I'm using openejb 3.1 SNAPSHOT and Hibernate hibernate-3.2.5.ga.

Any ideas?  I'm totally lost...as I understand it this should just work...
Thanks in advance



-- 
View this message in context: 
http://www.nabble.com/HELP%21-JNDI-DataSource-Name-tp19579867p19579867.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: Problem during deployment with ejb-jar.xml

2008-09-19 Thread Fred59

Hello David,

Thanks for the answer.
In fact The "MySessionImpl" bean is packaged in a EJB-JAR located in the
classpath of an other EJB project. I want to override its persistence
context in order to use it with the persistence unit of the second project.
I don't know if it helps

Anyway if I add an  tag and I don't get the exception anymore.
I still continue my work on that case. Thanks again.

Fred


David Blevins wrote:
> 
> On Sep 18, 2008, at 3:21 AM, Fred59 wrote:
> 
>>
>> Hi all,
>>
>> I'm using OpenEJB 3.0. I try to override a persistence context  
>> defined in a
>> session. Hereafter the ejb-jar.xml content
>>
>> 
>> http://java.sun.com/xml/ns/javaee";
>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>  http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd";
>>  version="3.0">
>> 
>>
>>  MySessionImpl
>>
>>
>> core.impl.MySessionImpl/em> persistence-context-ref-name>
>>myDomainExt> name>
>>
>>
>> 
>> 
>>
> 
> It's fine to leave the  tag off as the annotated bean with  
> the same name can fill in that data, but in this case it looks like  
> there is no bean with the ejb-name MySessionImpl and therefore it  
> isn't overriding anything.
> 
> -David
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-during-deployment-with-ejb-jar.xml-tp19549842p19567786.html
Sent from the OpenEJB User mailing list archive at Nabble.com.