You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Narahari 'n' Savitha <sa...@gmail.com> on 2010/03/18 04:31:18 UTC

jndi global look up questions

Friends:

I have the following setup.

A Jar file with a class called DBConnectionUtil that reads a specific string
for lookup "jdbc/windsDS".

This jar is being used inside of Websphere7 and it works fine.

Inside of Tomcat 6, the same context look up for the jndi of jdbc/windsDS
does NOT work.

Tomcat expects

Context parentcontext = new InitialContext();
Context childContext = parentcontext.lookup("java:comp/env");
Datasource ds = childContext.lookup("jdbc/windsDS");

All the xml entries are right since the above snippet works.

I want to make the direct global look up  aka jdbc/windsDS to work.

Context parentcontext = new InitialContext();
Datasource ds = context.lookup("jdbc/windsDS");

Is there a way to do jndli direct global lookup ?

-Narahari

RE: jndi global look up questions

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Narahari 'n' Savitha [mailto:savithari@gmail.com]
> Subject: Re: jndi global look up questions
> 
> So if thee is a setting in Tomcat to say "allow shabby programming
> practices to get thru", it will be great.
> 
> What do you say ?  Any ideas ;)

I can't think of any way to do this via configuration, so will have to think about it for a bit.  Can't promise anything.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jndi global look up questions

Posted by Narahari 'n' Savitha <sa...@gmail.com>.
Unfortunately dont have choice over this.  Since Websphere allows this the
team that provides this JAR file has used shabby programming practices.  Now
I am trying to make this app work in Tomcat.

So if thee is a setting in Tomcat to say "allow shabby programming practices
to get thru", it will be great.

What do you say ?  Any ideas ;)

-Narahari

On Thu, Mar 18, 2010 at 9:41 AM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:

> > From: Narahari 'n' Savitha [mailto:savithari@gmail.com]
> > Subject: Re: jndi global look up questions
> >
> > Bingo.  Exactly.  Is there a way to "kludge" Tomcat into doing this ?
>
> Better to change your code to be spec-compliant, and not dependent on the
> illogical (and illegal) behavior of certain app servers.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: jndi global look up questions

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Narahari 'n' Savitha [mailto:savithari@gmail.com]
> Subject: Re: jndi global look up questions
> 
> Bingo.  Exactly.  Is there a way to "kludge" Tomcat into doing this ?

Better to change your code to be spec-compliant, and not dependent on the illogical (and illegal) behavior of certain app servers.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jndi global look up questions

Posted by Narahari 'n' Savitha <sa...@gmail.com>.
Bingo.  Exactly.  Is there a way to "kludge" Tomcat into doing this ?
Please...............................

-Narahari

On Thu, Mar 18, 2010 at 9:05 AM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:

> > From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com]
> > Subject: Re: jndi global look up questions
> >
> > What do you mean by "global" JNDI access.
>
> Judging from the example code supplied by the OP, he or she wants a kludge
> in Tomcat to so that it presumes the presence of the java:comp/env prefix.
>  If we can believe the original message, it appears that WebSphere allows
> sloppy, non-spec-compliant programming to get away with this.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: jndi global look up questions

Posted by Narahari 'n' Savitha <sa...@gmail.com>.
Right but do you know how to do this.

On Thu, Mar 18, 2010 at 10:43 AM, Filip Hanik - Dev Lists <
devlists@hanik.com> wrote:

> On 03/18/2010 07:05 AM, Caldarale, Charles R wrote:
>
>> From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com]
>>> Subject: Re: jndi global look up questions
>>>
>>> What do you mean by "global" JNDI access.
>>>
>>>
>> Judging from the example code supplied by the OP, he or she wants a kludge
>> in Tomcat to so that it presumes the presence of the java:comp/env prefix.
>>  If we can believe the original message, it appears that WebSphere allows
>> sloppy, non-spec-compliant programming to get away with this.
>>
>>
> almost all app servers allows access to the global jndi registry, the
> resource link is a pain in the rear very often :)
>
>
>
>   - Chuck
>>
>>
>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>> MATERIAL and is thus for use only by the intended recipient. If you received
>> this in error, please contact the sender and delete the e-mail and its
>> attachments from all computers.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: jndi global look up questions

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
On 03/18/2010 07:05 AM, Caldarale, Charles R wrote:
>> From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com]
>> Subject: Re: jndi global look up questions
>>
>> What do you mean by "global" JNDI access.
>>      
> Judging from the example code supplied by the OP, he or she wants a kludge in Tomcat to so that it presumes the presence of the java:comp/env prefix.  If we can believe the original message, it appears that WebSphere allows sloppy, non-spec-compliant programming to get away with this.
>    
almost all app servers allows access to the global jndi registry, the 
resource link is a pain in the rear very often :)


>   - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: jndi global look up questions

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com]
> Subject: Re: jndi global look up questions
> 
> What do you mean by "global" JNDI access.

Judging from the example code supplied by the OP, he or she wants a kludge in Tomcat to so that it presumes the presence of the java:comp/env prefix.  If we can believe the original message, it appears that WebSphere allows sloppy, non-spec-compliant programming to get away with this.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jndi global look up questions

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/3/18 Narahari 'n' Savitha <sa...@gmail.com>:
> If anyone has had this direct global JNDI access need could you share that
> info ?

What do you mean by "global" JNDI access.

Note that, IIRC, you cannot access resources defined in server.xml's
GlobalResources, unless you add a <ResourceLink> element to your
context.xml

http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jndi global look up questions

Posted by Narahari 'n' Savitha <sa...@gmail.com>.
Thank you for the answer.  I have had gone thru it before asking question
and after.  If there is a specific area that you want me to look at let me
know.

If anyone has had this direct global JNDI access need could you share that
info ?

A hack, a round about.  I dont have access to the source code that is doing
direct JNDI access and how to configure Tomcat to allow to do that.

-Narahari

On Thu, Mar 18, 2010 at 2:58 AM, Gurkan Erdogdu <cg...@gmail.com>wrote:

> Please have a look
>
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
>
> Thanks;
>
> --Gurkan
>
> 2010/3/18 Narahari 'n' Savitha <sa...@gmail.com>
>
> > Friends:
> >
> > I have the following setup.
> >
> > A Jar file with a class called DBConnectionUtil that reads a specific
> > string
> > for lookup "jdbc/windsDS".
> >
> > This jar is being used inside of Websphere7 and it works fine.
> >
> > Inside of Tomcat 6, the same context look up for the jndi of jdbc/windsDS
> > does NOT work.
> >
> > Tomcat expects
> >
> > Context parentcontext = new InitialContext();
> > Context childContext = parentcontext.lookup("java:comp/env");
> > Datasource ds = childContext.lookup("jdbc/windsDS");
> >
> > All the xml entries are right since the above snippet works.
> >
> > I want to make the direct global look up  aka jdbc/windsDS to work.
> >
> > Context parentcontext = new InitialContext();
> > Datasource ds = context.lookup("jdbc/windsDS");
> >
> > Is there a way to do jndli direct global lookup ?
> >
> > -Narahari
> >
>
>
>
> --
> Gurkan Erdogdu
> http://gurkanerdogdu.blogspot.com
>

Re: jndi global look up questions

Posted by Gurkan Erdogdu <cg...@gmail.com>.
Please have a look

http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

Thanks;

--Gurkan

2010/3/18 Narahari 'n' Savitha <sa...@gmail.com>

> Friends:
>
> I have the following setup.
>
> A Jar file with a class called DBConnectionUtil that reads a specific
> string
> for lookup "jdbc/windsDS".
>
> This jar is being used inside of Websphere7 and it works fine.
>
> Inside of Tomcat 6, the same context look up for the jndi of jdbc/windsDS
> does NOT work.
>
> Tomcat expects
>
> Context parentcontext = new InitialContext();
> Context childContext = parentcontext.lookup("java:comp/env");
> Datasource ds = childContext.lookup("jdbc/windsDS");
>
> All the xml entries are right since the above snippet works.
>
> I want to make the direct global look up  aka jdbc/windsDS to work.
>
> Context parentcontext = new InitialContext();
> Datasource ds = context.lookup("jdbc/windsDS");
>
> Is there a way to do jndli direct global lookup ?
>
> -Narahari
>



-- 
Gurkan Erdogdu
http://gurkanerdogdu.blogspot.com