04-11-05 11:09 PM
I'm running Websphere 6.0 with Rational Application Developer 6. I define a
JDBC DB2 data source and a resource reference (name: test),
then I use a servlet to get the data source and connection, with the code be
low:
try {
InitialContext icx = new InitialContext();
DataSource dataSource =(DataSource)icx.lookup( "java:comp/env/test");
Connection con=dataSource.getConnection("user","password");
con.close();
} catch (Exception e) {
e.printStackTrace();
}
The code throws the exception below:
Exception thrown : java.lang.NoClassDefFoundError: com.ibm.db2.jcc.SQLJConte
xt
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:211)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:147)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:474)
at java.net.URLClassLoader.access$500(URLClassLoader.java:108)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:846)
at java.security.AccessController.doPrivileged(AccessController.java:218)
at java.net.URLClassLoader.findClass(URLClassLoader.java:370)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:103)
at java.lang.ClassLoader.loadClass(ClassLoader.java:601)
at java.lang.ClassLoader.loadClass(ClassLoader.java:560)
at com.ibm.ws.rsadapter.spi.InternalDB2UniversalDataStoreHelper.createJDBCCo
nnectionWrapper(InternalDB2UniversalData
StoreHelper.java:348)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getConnection(WSRdbMa
nagedConnectionImpl.java:2559)
at com.ibm.ejs.j2c.MCWrapper.getConnection(MCWrapper.java:1664)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.ja
va:580)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource
.java:328)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource
.java:506)
at sample.Test.doPost(Test.java:44)
at sample.Test.doGet(Test.java:27)
I could not find anywhere the class com.ibm.db2.jcc.SQLJContext, nor is ment
ioned in any WAS/DB2 documentation. The data source has been tested from WAS
administration and works correctly, and the code & configuration above work
s perfectly on WAS 5.1.x ,
with the same DB2 drivers and configurations. Does anybody have any idea of
what could be causing this problem ?
[ Post a follow-up to this message ]
|