DB2 java.lang.NoClassDefFoundError:com/ibm/db2/jcc/SQLJContext

1、需要安装DB2的补丁包;

2、将db2下的3个驱动(最新的)拷贝到websphere下;

*********************************************************

ibm 

*********************************************************

Technote (troubleshooting)


Problem(Abstract)

When configuring an IBM® WebSphere® Application Server datasource for DB2® database access using the db2jcc.jar driver (DB2 Universal Java Database Connectivity (JDBC) Driver Provider), an exception might occur when the application tries to access the database, even though "Test Connection" worked fine.

Symptom

When the application tries to access the database for the first time, an exception similar to this is logged in the server's Systemout.log:

[24.07.08 08:32:55:463 CEST] 00000110 SystemOut O - 
reserveHostConnection(String, String) Unexpected Error:
java.lang.NoClassDefFoundError: com/ibm/db2/jcc/SQLJContext 
at java.lang.ClassLoader.defineClass0(Native Method) 

Cause

Check the version of the db2jcc.jar which is used by WebSphere. Some older DB2 drivers do not contain the SQLJContext.class at all.


Check the SystemOut.log for the JDBC driver version:

[25.08.08 09:52:25:506 CEST] 00000110 InternalGener I DSRA8206I: JDBC Driver Version: 1.3.70 
JDBC Driver Version 1.3.70 is the one delivered with DB2 v8.1 Fixpack 3.

The minimum DB2 v8 prereq for WebSphere Application Server v6.0.2 (all modifications) is DB2 v8.1 FP6a, which implements JDBC Driver Version 2.2.49


Resolving the problem

Replace the db2jcc.jar on the Application Server system with a newer driver version that implements SQLJContext.class

Use at least the version which is listed as a prerequisite for your WebSphere Application Server version (see "related URLs" below).


Related information

IBM DB2 JDBC driver versions
Supported DB2 levels for Application Server V6.0.2
Supported DB2 levels for Application Server V6.1

原文地址:https://www.cnblogs.com/duanxz/p/3131811.html