tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: JNDI, DataSource & SingleSignOn but one question!
Date Thu, 12 Aug 2004 15:52:05 GMT
You need a <ResourceLink> in your Context to make GlobalNamingResources
available to your webapps.  You also need the resource-ref in web.xml
per the Spec (and this is well documented), but you already found that

Yoav Shapira
Millennium Research Informatics

>-----Original Message-----
>From: Keith Bottner []
>Sent: Thursday, August 12, 2004 11:44 AM
>Subject: JNDI, DataSource & SingleSignOn but one question!
>Ok, I read the archives, I read past mailings and I still can't get
this to
>work. So here it goes.
>I have a DataSource that I define in the <GlobalNamingResources>
section of
>the server.xml.
>I also define a <Realm> (specifically a DataSourceRealm) in the
>section of the server.xml that references the <GlobalNamingResources>
>section item that I defined above.
>In the <Host> section of the server.xml I define a SingleSignOn valve.
>That ALL WORKS FINE! Here is where it gets weird. So I sign on and then
>later when I am executing a Servlet I try this:
>First I had to add a resource-ref into my web.xml that references the
>naming resource, otherwise when I call lookup it throws a can't find
>Then my servlet code
>Context initCtx = new InitialContext();
>Context envCtx = (Context) initCtx.lookup("java:comp/env");
>DataSource datasource = (DataSource) envCtx.lookup("jdbc/postgres");
>conn = datasource.getConnection();
>Everything works until I call the getConnection() at which time an
>is thrown that says:
>Cannot create JDBC driver of class '' for connect URL 'null'
>Now I know the connection works because the SingleSignOn works!
>In addition if I use code like this:
>StandardServer server = (StandardServer) ServerFactory.getServer();
>Context env = server.getGlobalNamingContext();
>DataSource dataSource = (DataSource) env.lookup("jdbc/postgres");
>conn = dataSource.getConnection();
>The connection is create properly with no exceptions.
>So Why is there a discrepancy between the two methods and how can I get
>to work so that I can share the same data pool connections I am using
>sign on as I am throughout the remainder of the application?
>Thanks in advance for any ideas, I need to fix this something bad!
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message