Hi,
I have a sample application which has a page where in we can upload some records in database. When I deploy the war file in
Tomcat(with data sources defined in conf/server.xml), everything works fine.
I want to try the same with Glassfish Enterprise server v2.1. I deployed the war file successfully using the GUI provided by the Glassfish server. However I get the below error when I
test the connection (after creating the Connection pool):
Error casting to javax.sql.Datasource :{0} java.lang.ClassCastException: oracle.jdbc.driver.OracleDriver at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:139) at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:93) at com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.java:1315) at com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl.testConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:551) at com.sun.enterprise.connectors.ConnectorRuntime.testConnectionPool
.....
.....
This is what I am using to connect to database:
General Settings:
Name: jdbc/myapp
Datasource Classname: oracle.jdbc.driver.OracleDriver (I have placed ojdbc14.jar in the Sun\AppServer\lib\ directory)
Resource Type: javax.sql.DataSource
Advaced: user: XX
password: XX
URL: <<IP of the database server>> I am using oracle 11i
databaseName: SIDName
portNumber: <<port>>
I did check the sample database configuration at Sun\AppServer\lib\install\templates\resources\jdbc but was unsuccessful in creating the connection.
Am I missing anything?Any other properties I need to add in Advance settings? I was using the GUI provided by the Glassfish server.
Any variable I need to set?
Do I need to create JNDI name first and then connection pool? If so which one I need to create? CUstom or external resource?
Do I need to set any class path setting for the jar file I have added?
Any help on this issue would be appreciated.
Regards,
Kiran.