|
Home > Archive > WebSphere Application Server > April 2005 > WebSphere 6.0 exception with JDBC datasource (com.ibm.db2.jcc.SQLJContext)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
WebSphere 6.0 exception with JDBC datasource (com.ibm.db2.jcc.SQLJContext)
|
|
|
| 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 below:
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.SQLJContext
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. createJDBCConnectionWrapper(InternalDB2U
niversalDataStoreHelper.java:348)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl. getConnection(WSRdbManagedConnectionImpl
.java:2559)
at com.ibm.ejs.j2c.MCWrapper.getConnection(MCWrapper.java:1664)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java: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 mentioned in any WAS/DB2 documentation. The data source has been tested from WAS administration and works correctly, and the code & configuration above works 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 ?
| |
| Ken Hygh 2005-04-11, 6:09 pm |
| paolo_dettori@hotmail.com wrote:
>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 below:
>
>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.SQLJContext
> 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. createJDBCConnectionWrapper(InternalDB2U
niversalDataStoreHelper.java:348)
> at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl. getConnection(WSRdbManagedConnectionImpl
.java:2559)
> at com.ibm.ejs.j2c.MCWrapper.getConnection(MCWrapper.java:1664)
> at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java: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 mentioned in any WAS/DB2 documentation. The data source has been tested from WAS administration and works correctly, and the code & configuration above works 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 ?
>
>
Looks like it's in DB2's db2jcc.jar in my DB2 8.2 installation
Ken
| |
| Mike Burmeister 2005-04-12, 6:03 pm |
| You need to have DB2 8.1.6 or higher or you will get this message. This
class will be in the jar file if you have version 8.1.6 or higher.
Mike
"Ken Hygh" <kenhygh@nc.rr.com> wrote in message
news:d3ej74$6st2$1@news.boulder.ibm.com...
> paolo_dettori@hotmail.com wrote:
>
> Looks like it's in DB2's db2jcc.jar in my DB2 8.2 installation
> Ken
| |
| vikas_kumar_24 2005-04-13, 8:03 am |
| Hi Guys,
The same problem i am also getting. I am able to connect to the datasource created through the Websphere Admin Console, and the same setup worked with Websphere 5.1.
1. I am not able to locate that com.ibm.db2.jcc.SQLJContext class in DB28.1.2 Jars.
2. I tried locating the aboce class in Websphere jars( actually not supposed to be here).
3. The only point that looks to be possible is that With Wesphere's 6.0 implementation of DataSource, it looks for that class at the Client side.
So any thing with respect to DB2cc.jar or anything new from DB2 shipped, where we can find the above class?
Rgds
Vikas
|
|
|
|
|