tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: JNDI, DataSource & SingleSignOn but one question!
Date Thu, 12 Aug 2004 15:52:05 GMT
Hi,
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
out.


Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Keith Bottner [mailto:kbottner@comcast.net]
>Sent: Thursday, August 12, 2004 11:44 AM
>To: tomcat-user@jakarta.apache.org
>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
<Engine>
>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
>Global
>naming resource, otherwise when I call lookup it throws a can't find
naming
>exception.
>
>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
>exception
>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
>this
>to work so that I can share the same data pool connections I am using
to
>sign on as I am throughout the remainder of the application?
>
>Thanks in advance for any ideas, I need to fix this something bad!
>
>Keith
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


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


Mime
View raw message