This is a discussion on Weblogic DataSource/Tomcat JSP issue - Weblogic ; Hi, I'm having an issue retieving a connection from a data source object on a Weblogic server via a tomcat client and I hope someone may have seen this before. To reproduce this issue I have created a java class ...
I'm having an issue retieving a connection from a data source object
on a Weblogic server via a tomcat client and I hope someone may have
seen this before.
To reproduce this issue I have created a java class below:
public class ConnectionTester
public void TestConnection()
InitialContext ic = null;
Hashtable ht = new Hashtable();
// Create initial context.
ic = new InitialContext(ht);
// Get data source.
DataSource ds = (DataSource)ic.lookup("ISSUER_DS_TX");
// Get connection.
Connection conn = ds.getConnection();
System.out.println("Success! Got database connection");
When I create a simple java client test class and call
ConnectionTester.TestConnection, the test is successful. However, when
I create a simple jsp page on Tomcat and call the TestConnecter object
with the following code:
<% oConnectionTester.TestConnection(); %>
....Tomcat complains and the following exception is raised:
java.lang.ClassCastException: Assigning instance of class $Proxy2 to
I can see that the object returned from the lookup is of type $Proxy2
and when it tries to do a cast to a DataSource object, the cast fails.
I cannot explain why the returned object is of type $Proxy2.
I'm using Tomcat v4.0.3, Weblogic Server v7, Oracle 9.0.2 on SunOS
I would be grateful for any assistance that anyone can provide.