You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by John Hawkins <ha...@btconnect.com> on 2007/02/07 10:26:52 UTC

Full JNDI path to JCA

Hi,

I've managed to get my servlet to access a JCA when the JCA is deployed first then the war file.
However, in my web.xml file for the servlet I have to have a resource ref. I'd rather not have this - I believe that I can get away without having this IF I know the exact name of the JCA in JNDI - but all my combinations of java:comp/env/eis fail. 

Can anyone confirm that I can get away without the resource ref in my web.xml and, if so, where is the jca deployed to in JNDI?

many thankis,
John.

Re: Full JNDI path to JCA

Posted by David Jencks <da...@yahoo.com>.
On Feb 7, 2007, at 8:03 AM, John Hawkins wrote:

>
> Well, it's not good news - but at least it's authoritative - many  
> thanks.

It's true that for complete portability you'll need to use a plan for  
at least some app servers, however for geronimo you never do for  
resource references if you name everything consistently.

First of all you have to make sure that the resource adapter is  
"visible" to your app by getting it into the ancestor graph of your  
app.  Normally you do this by including a dependency on it in your  
geronimo plan or by deploying it in the same ear.

If your connection factory is deployed with

                 <connectiondefinition-instance>
                     <name>foo/bar/SystemDatasource</name>

then any application for which the connection factory is visible can  
get to it with the spec dd element

<resource-ref>
    <res-ref-name>foo/bar/SystemDatasource</res-ref-name>

and
new InitialContext().lookup("java:comp/env/foo/bar/SystemDatasource");

You do need the spec required spec dd resource-ref element but you  
don't need a resource-ref in the geronimo plan.

thanks
david jencks



>
> Johyn.
>
> -----Original Message-----
> From: ammulder@gmail.com on behalf of Aaron Mulder
> Sent: Wed 07/02/2007 14:53
> To: user@geronimo.apache.org
> Subject: Re: Full JNDI path to JCA
>
> On 2/7/07, John Hawkins <ha...@btconnect.com> wrote:
>> When I deploy my war file to Websphere I don't need to declare  
>> anything in my web.xml or in my geronimo-web.xml equivelant. AND -  
>> I can just use the jndi name that I create the resource with in my  
>> servlet with no pre-fixing.
>
> If you want to be portable and strictly spec-compliant, you have to
> use resource references and java:comp/env/... JNDI names.  The spec
> does not cover global JNDI names, nor offer any standard way to set a
> global JNDI name for an application component, so you'd have to do
> something different for every app server that happens to support
> global JNDI names.  The current Geronimo release is not one of those
> -- it does not include a global JNDI space.
>
> That said, it is a common feature that several other app servers
> support and people use, and it appears to be encouraged somewhat by
> the EE 5 spec, so I think you'll see global JNDI features added to a
> future Geronimo release.  (There's actually a thread on this on the
> dev list today. :)
>
> Thanks,
>        Aaron
>
>> In Geronimo it looks like I have to
>> a) declare the resource references in my web.xml
>> b) declare the instances of those resource references in my  
>> geronimo-web.xml
>> c) I have to prefix the resource jndi lookup name with java:comp/env
>>
>> This doesn't look to nice from where I sit? I hope I'm wrong and  
>> someone's going to tell me that all I have to do is deploy my  
>> web.xml with NO refs pre-defined in it and no refs in the geronimo- 
>> web.xml and that I can just get the resource using it's real name  
>> and not it java:comp/env - Just like I do in Websphere.
>>
>> Is Websphere being quirky here or is it Geronimo OR a combo?
>>
>>
>> thanks,
>> John.
>>
>> -----Original Message-----
>> From: ammulder@gmail.com on behalf of Aaron Mulder
>> Sent: Wed 07/02/2007 12:46
>> To: user@geronimo.apache.org
>> Subject: Re: Full JNDI path to JCA
>>
>> I think you need the resource ref.
>>
>> Thanks,
>>        Aaron
>>
>> On 2/7/07, John Hawkins <ha...@btconnect.com> wrote:
>>> Hi,
>>>
>>> I've managed to get my servlet to access a JCA when the JCA is  
>>> deployed first then the war file.
>>> However, in my web.xml file for the servlet I have to have a  
>>> resource ref. I'd rather not have this - I believe that I can get  
>>> away without having this IF I know the exact name of the JCA in  
>>> JNDI - but all my combinations of java:comp/env/eis fail.
>>>
>>> Can anyone confirm that I can get away without the resource ref  
>>> in my web.xml and, if so, where is the jca deployed to in JNDI?
>>>
>>> many thankis,
>>> John.
>>>
>>
>>
>>
>
> <winmail.dat>


RE: Full JNDI path to JCA

Posted by John Hawkins <ha...@btconnect.com>.
Well, it's not good news - but at least it's authoritative - many thanks.

Johyn.

-----Original Message-----
From: ammulder@gmail.com on behalf of Aaron Mulder
Sent: Wed 07/02/2007 14:53
To: user@geronimo.apache.org
Subject: Re: Full JNDI path to JCA
 
On 2/7/07, John Hawkins <ha...@btconnect.com> wrote:
> When I deploy my war file to Websphere I don't need to declare anything in my web.xml or in my geronimo-web.xml equivelant. AND - I can just use the jndi name that I create the resource with in my servlet with no pre-fixing.

If you want to be portable and strictly spec-compliant, you have to
use resource references and java:comp/env/... JNDI names.  The spec
does not cover global JNDI names, nor offer any standard way to set a
global JNDI name for an application component, so you'd have to do
something different for every app server that happens to support
global JNDI names.  The current Geronimo release is not one of those
-- it does not include a global JNDI space.

That said, it is a common feature that several other app servers
support and people use, and it appears to be encouraged somewhat by
the EE 5 spec, so I think you'll see global JNDI features added to a
future Geronimo release.  (There's actually a thread on this on the
dev list today. :)

Thanks,
       Aaron

> In Geronimo it looks like I have to
> a) declare the resource references in my web.xml
> b) declare the instances of those resource references in my geronimo-web.xml
> c) I have to prefix the resource jndi lookup name with java:comp/env
>
> This doesn't look to nice from where I sit? I hope I'm wrong and someone's going to tell me that all I have to do is deploy my web.xml with NO refs pre-defined in it and no refs in the geronimo-web.xml and that I can just get the resource using it's real name and not it java:comp/env - Just like I do in Websphere.
>
> Is Websphere being quirky here or is it Geronimo OR a combo?
>
>
> thanks,
> John.
>
> -----Original Message-----
> From: ammulder@gmail.com on behalf of Aaron Mulder
> Sent: Wed 07/02/2007 12:46
> To: user@geronimo.apache.org
> Subject: Re: Full JNDI path to JCA
>
> I think you need the resource ref.
>
> Thanks,
>        Aaron
>
> On 2/7/07, John Hawkins <ha...@btconnect.com> wrote:
> > Hi,
> >
> > I've managed to get my servlet to access a JCA when the JCA is deployed first then the war file.
> > However, in my web.xml file for the servlet I have to have a resource ref. I'd rather not have this - I believe that I can get away without having this IF I know the exact name of the JCA in JNDI - but all my combinations of java:comp/env/eis fail.
> >
> > Can anyone confirm that I can get away without the resource ref in my web.xml and, if so, where is the jca deployed to in JNDI?
> >
> > many thankis,
> > John.
> >
>
>
>


Re: Full JNDI path to JCA

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
On 2/7/07, John Hawkins <ha...@btconnect.com> wrote:
> When I deploy my war file to Websphere I don't need to declare anything in my web.xml or in my geronimo-web.xml equivelant. AND - I can just use the jndi name that I create the resource with in my servlet with no pre-fixing.

If you want to be portable and strictly spec-compliant, you have to
use resource references and java:comp/env/... JNDI names.  The spec
does not cover global JNDI names, nor offer any standard way to set a
global JNDI name for an application component, so you'd have to do
something different for every app server that happens to support
global JNDI names.  The current Geronimo release is not one of those
-- it does not include a global JNDI space.

That said, it is a common feature that several other app servers
support and people use, and it appears to be encouraged somewhat by
the EE 5 spec, so I think you'll see global JNDI features added to a
future Geronimo release.  (There's actually a thread on this on the
dev list today. :)

Thanks,
       Aaron

> In Geronimo it looks like I have to
> a) declare the resource references in my web.xml
> b) declare the instances of those resource references in my geronimo-web.xml
> c) I have to prefix the resource jndi lookup name with java:comp/env
>
> This doesn't look to nice from where I sit? I hope I'm wrong and someone's going to tell me that all I have to do is deploy my web.xml with NO refs pre-defined in it and no refs in the geronimo-web.xml and that I can just get the resource using it's real name and not it java:comp/env - Just like I do in Websphere.
>
> Is Websphere being quirky here or is it Geronimo OR a combo?
>
>
> thanks,
> John.
>
> -----Original Message-----
> From: ammulder@gmail.com on behalf of Aaron Mulder
> Sent: Wed 07/02/2007 12:46
> To: user@geronimo.apache.org
> Subject: Re: Full JNDI path to JCA
>
> I think you need the resource ref.
>
> Thanks,
>        Aaron
>
> On 2/7/07, John Hawkins <ha...@btconnect.com> wrote:
> > Hi,
> >
> > I've managed to get my servlet to access a JCA when the JCA is deployed first then the war file.
> > However, in my web.xml file for the servlet I have to have a resource ref. I'd rather not have this - I believe that I can get away without having this IF I know the exact name of the JCA in JNDI - but all my combinations of java:comp/env/eis fail.
> >
> > Can anyone confirm that I can get away without the resource ref in my web.xml and, if so, where is the jca deployed to in JNDI?
> >
> > many thankis,
> > John.
> >
>
>
>

RE: Full JNDI path to JCA

Posted by John Hawkins <ha...@btconnect.com>.
When I deploy my war file to Websphere I don't need to declare anything in my web.xml or in my geronimo-web.xml equivelant. AND - I can just use the jndi name that I create the resource with in my servlet with no pre-fixing.

So - 

In Geronimo it looks like I have to 
a) declare the resource references in my web.xml
b) declare the instances of those resource references in my geronimo-web.xml
c) I have to prefix the resource jndi lookup name with java:comp/env

This doesn't look to nice from where I sit? I hope I'm wrong and someone's going to tell me that all I have to do is deploy my web.xml with NO refs pre-defined in it and no refs in the geronimo-web.xml and that I can just get the resource using it's real name and not it java:comp/env - Just like I do in Websphere.

Is Websphere being quirky here or is it Geronimo OR a combo?


thanks,
John.

-----Original Message-----
From: ammulder@gmail.com on behalf of Aaron Mulder
Sent: Wed 07/02/2007 12:46
To: user@geronimo.apache.org
Subject: Re: Full JNDI path to JCA
 
I think you need the resource ref.

Thanks,
       Aaron

On 2/7/07, John Hawkins <ha...@btconnect.com> wrote:
> Hi,
>
> I've managed to get my servlet to access a JCA when the JCA is deployed first then the war file.
> However, in my web.xml file for the servlet I have to have a resource ref. I'd rather not have this - I believe that I can get away without having this IF I know the exact name of the JCA in JNDI - but all my combinations of java:comp/env/eis fail.
>
> Can anyone confirm that I can get away without the resource ref in my web.xml and, if so, where is the jca deployed to in JNDI?
>
> many thankis,
> John.
>


Re: Full JNDI path to JCA

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
I think you need the resource ref.

Thanks,
       Aaron

On 2/7/07, John Hawkins <ha...@btconnect.com> wrote:
> Hi,
>
> I've managed to get my servlet to access a JCA when the JCA is deployed first then the war file.
> However, in my web.xml file for the servlet I have to have a resource ref. I'd rather not have this - I believe that I can get away without having this IF I know the exact name of the JCA in JNDI - but all my combinations of java:comp/env/eis fail.
>
> Can anyone confirm that I can get away without the resource ref in my web.xml and, if so, where is the jca deployed to in JNDI?
>
> many thankis,
> John.
>