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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]