Skip to main content



      Home
Home » Newcomers » Newcomers » java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added(getting a class not found exception for DB2Driver even though db2jcc4.jar is added as library.)
java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added [message #1385350] Thu, 05 June 2014 14:47 Go to next message
Eclipse UserFriend
I am getting a java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though the db2jcc4.jar is added as a library.

The using class can import com.ibm.db2.jcc.DB2Driver just fine. I also have a test case to test the method in question and it completes successfully.

Any idea what the problem could be?
Re: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added [message #1385392 is a reply to message #1385350] Fri, 06 June 2014 02:38 Go to previous messageGo to next message
Eclipse UserFriend
Do you have a more complete stack trace? Whatever's trying to find the class isn't using the classpath that was used to launch your Java Application.
Re: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added [message #1386169 is a reply to message #1385392] Fri, 13 June 2014 20:03 Go to previous messageGo to next message
Eclipse UserFriend
Strange. For some reason the db2jcc4.jar isn't getting deployed with the rest of the files. I had to manually add it to glassfish's lib and then do a full stop and clean. This all despite the fact that I have the jar marked for export (if this doesn't have anything to do with making it available to glassfish, would someone please tell me?).
Re: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added [message #1386177 is a reply to message #1386169] Sat, 14 June 2014 02:25 Go to previous messageGo to next message
Eclipse UserFriend
Marked for export? Where?
Re: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added [message #1386195 is a reply to message #1386177] Sat, 14 June 2014 13:27 Go to previous messageGo to next message
Eclipse UserFriend
In the Java Build Path section of the project properties, under the Order and Export tab, db2jcc4.jar is checked. It was added as an external jar. Another weird thing is that I used to not have to copy any files around. I don't remember what I did right before the problem started happening, so unfortunately I don't know how to reproduce the problem...
Re: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added [message #1386313 is a reply to message #1386195] Mon, 16 June 2014 09:18 Go to previous messageGo to next message
Eclipse UserFriend
If this is a Dynamic Web project, you should check its Deployment Assembly (in the project properties dialog). The packaged app doesn't necessarily use libraries that are exported from the build path; they must be included in a place that is part of the Deployment Assembly (which is basically the configuration of what Eclipse will package into the app/WAR when it's building and deploying it).
Re: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added [message #1386324 is a reply to message #1386313] Mon, 16 June 2014 10:33 Go to previous messageGo to next message
Eclipse UserFriend
The Order and Export property page states that "Exported entries are contributed to dependent projects", meaning they're visible to other projects that depend on this one. It has no relation to anything else. If your web application requires a jar that isn't already exposed to all web apps through the app server, you should physically put them into the project's WEB-INF/lib folder if possible--assuming the app server itself is not the one trying to load the driver class.
Re: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added [message #1386464 is a reply to message #1386324] Tue, 17 June 2014 13:41 Go to previous messageGo to next message
Eclipse UserFriend
Thank you two for your replies. I placed the jar in the WEB-INF/lib folder in the project ( and removed it from the build path ), which solved the problem. Is this the preferred way to do things? I did not have to change anything in the Deployment Assembly properties window, which only includes /src ( Source ), WEB-INF/classes ( Deploy Path ); /WebContent ( Source ), / ( Deploy Path ).
Re: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver even though db2jcc4.jar lib added [message #1386473 is a reply to message #1386464] Tue, 17 June 2014 14:18 Go to previous message
Eclipse UserFriend
It is the preferred way. At runtime, jars in WEB-INF/lib are automatically added to the web app's classpath.
Previous Topic:Marketplace updates for closed network.
Next Topic:cannot create extension.... blerg
Goto Forum:
  


Current Time: Wed Jul 16 19:29:27 EDT 2025

Powered by FUDForum. Page generated in 0.34259 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top