Nikola Milutinovic wrote:

> Hi all.
> 
> PostgreSQL 7.2
> PostgreSQL JDBC 7.2
> Tomcat 4.0.1
> 
> Problem: When I try to lookup a resource regularely (I think) defined, I 
> get "null". The JDBC resource is defined as per Tomcat docs and general 
> advice on this list.
> 
> I have made some test, I can lookup the following:
> 
> java:comp
> java:comp/env
> java:comp/env/jdbc
> 
> But when I try "java:jdbc/env/jdbc/AddressBookDB" I get "null". The 
> resource in question should be OK.
> 
> Is there a way to see what goes on in Tomcat's JNDI tree? Some sort of 
> JNDI browser?

So, I decided to write my own JNDI browser, after all, I have Java, JSP and JNDI 
in Tomcat. :-)

Relatively simple code:

<p>Context looked up: <strong><%= contextPath %></strong></p>
<%
InitialContext initCtx;
Context envCtx;

initCtx = new InitialContext();
NamingEnumeration enum = initCtx.listBindings( contextPath );
int i = 1;
%>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<%
   while( enum.hasMore() ) {
%>
   <tr>
     <td><%= i %></td>
     <td><%= ((Binding)enum.next()).toString() %></td>
   </tr>
<%
   }
%>
</table>

This is what I get when I set context to "java:comp/env/jdbc":

----------------------------------------------
Context looked up: java:comp/env/jdbc

1 AddressBookDB: org.apache.naming.ResourceRef:Reference Class Name: 
javax.sql.DataSource Type: scope Content: Shareable Type: auth Content: Container
----------------------------------------------

So, it is there. Why does "lookup()" on that particular resource return "null"?

Nix.


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to