You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jo...@fwd.at on 2003/03/29 18:03:21 UTC

Listing all JNDI resources available

Hi there,

Is it somehow possible to look up all JNDI configuration values available 
in a servlet/context?
This would be quite fine for debugging purposes, and it seems there is no 
function available for this, only for looking up a specific value.

thx 
Johannes

Re: Listing all JNDI resources available

Posted by jo...@fwd.at.
Hi Jerome,

I thought about the jdbc and env-entity entries in server.xml and web.xml.
I think it could be quite handy to have a servlet which lists all 
resources available (without having to know the name of each JNDI 
resource).

Of course digging in LDAP directories would make no sense, but I think a 
configuration listing would be quite handy for debugging and info 
purposes.

What do you mean?
Johannes





jerome moliere <jm...@nerim.net> 
29.03.2003 18:36
Please respond to
"Tomcat Users List" <to...@jakarta.apache.org>


To
Tomcat Users List <to...@jakarta.apache.org>
cc

Subject
Re: Listing all JNDI resources available






johannes.fiala@fwd.at wrote:

>Hi there,
>
>Is it somehow possible to look up all JNDI configuration values available 

>in a servlet/context?
>This would be quite fine for debugging purposes, and it seems there is no 

>function available for this, only for looking up a specific value.
>
> 
>
depending from your server config & the corresponding xsource of data 
used as the naming server, this solution could be very expansive
What about listing all resources available in your company LDAP server ?
I think that every other solution should be  preferred to this one...

HTH
Jerome


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



Re: Listing all JNDI resources available

Posted by jerome moliere <jm...@nerim.net>.
johannes.fiala@fwd.at wrote:

>Hi there,
>
>Is it somehow possible to look up all JNDI configuration values available 
>in a servlet/context?
>This would be quite fine for debugging purposes, and it seems there is no 
>function available for this, only for looking up a specific value.
>
>  
>
depending from your server config & the corresponding xsource of data 
used as the naming server, this solution could be very expansive
What about listing all resources available in your company LDAP server ?
I think that every other solution should be  preferred to this one...

HTH
Jerome


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


Re: Listing all JNDI resources available

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sat, 29 Mar 2003 johannes.fiala@fwd.at wrote:

> Date: Sat, 29 Mar 2003 18:03:21 +0100
> From: johannes.fiala@fwd.at
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Listing all JNDI resources available
>
> Hi there,
>
> Is it somehow possible to look up all JNDI configuration values available
> in a servlet/context?

You need to look at the JNDI Javadocs (package javax.naming):

  InitialContext ic = new InitialContext();
  Context resources = ic.lookup("java:comp/env");
  NamingEnumeration ne = resources.listBindings("");
  while (ne.hasMore()) {
    Binding b = ne.next();
    String resourceName = b.getName();
    Object resourceObject = b.getObject();
    ... do whatever you need ...
  }


> This would be quite fine for debugging purposes, and it seems there is no
> function available for this, only for looking up a specific value.
>
> thx
> Johannes

Craig


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


Re: Listing all JNDI resources available

Posted by Phil Steitz <ph...@steitz.com>.
johannes.fiala@fwd.at wrote:
> Hi there,
> 
> Is it somehow possible to look up all JNDI configuration values available 
> in a servlet/context?
> This would be quite fine for debugging purposes, and it seems there is no 
> function available for this, only for looking up a specific value.
> 
> thx 
> Johannes

Johannes,

You can use JNDI APIs to do this.
Check out the Naming example that ships with Tomcat 4.  HTML source is 
in /examples/servlets/jndi.html.

-Phil


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