I'm getting a ClassNotFoundException when I change my database to DB2Z
I get
java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:605)
at com.ibm.team.repository.service.db.provider.AbstractDbProvider.loadDriver(AbstractDbProvider.java:121)
and
java.lang.IllegalStateException: CRJAZ1840W The driver "com.ibm.db2.jcc.DB2Driver" could not be loaded and registered. This JDBC driver jar must be provided in a path configured by the server scripts. Please ensure that the driver is in the expected location of "C:\Jts\JazzTeamServer\server\db2z\db2jcc.jar;C:\Jts\JazzTeamServer\server\db2z\db2jcc_license_cisuz.jar;C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip" or consult product setup instructions to change the location.
java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:605)
at com.ibm.team.repository.service.db.provider.AbstractDbProvider.loadDriver(AbstractDbProvider.java:121)
and
java.lang.IllegalStateException: CRJAZ1840W The driver "com.ibm.db2.jcc.DB2Driver" could not be loaded and registered. This JDBC driver jar must be provided in a path configured by the server scripts. Please ensure that the driver is in the expected location of "C:\Jts\JazzTeamServer\server\db2z\db2jcc.jar;C:\Jts\JazzTeamServer\server\db2z\db2jcc_license_cisuz.jar;C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip" or consult product setup instructions to change the location.
2 answers
The issue is in the way the variable DB2Z_ABSPATH is set. This variable is meant to be an absolute path not a class path. So you need it to be
DB2Z_ABSPATH=c:\Jts\JazzTeamServer\db2z.
The system will then look in the the db2z for the relevant jar files. The word location in the above message means directory, not jar file.
The db2z directory is the default directory for finding the driver jar files. So in this case, you don't need to set the variable at all. The code below in server.startup.bat will set the variable for you.
if "%DB2Z_ABSPATH%"=="" goto :default_db2z
set DB2Z_JDBC=%DB2Z_ABSPATH%
goto :after_db2z
:default_db2z
set DB2Z_JDBC=%START_DIR%\db2z
:after_db2z
DB2Z_ABSPATH=c:\Jts\JazzTeamServer\db2z.
The system will then look in the the db2z for the relevant jar files. The word location in the above message means directory, not jar file.
The db2z directory is the default directory for finding the driver jar files. So in this case, you don't need to set the variable at all. The code below in server.startup.bat will set the variable for you.
if "%DB2Z_ABSPATH%"=="" goto :default_db2z
set DB2Z_JDBC=%DB2Z_ABSPATH%
goto :after_db2z
:default_db2z
set DB2Z_JDBC=%START_DIR%\db2z
:after_db2z