aspose file tools*
The moose likes Websphere and the fly likes NoClassDefFoundError for driver in db2java.zip Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "NoClassDefFoundError for driver in db2java.zip" Watch "NoClassDefFoundError for driver in db2java.zip" New topic
Author

NoClassDefFoundError for driver in db2java.zip

Anne Forumer
Ranch Hand

Joined: Apr 19, 2004
Posts: 72
Windows 2000, WAS Express 5.0.2, WSAD5.1

I have deployed my first application with some servlets in WAS5.0.2 as an ear with only a web-module in it. jars and zips that this application uses are under WEB-INF/lib directory. This lib also has db2java.zip that the seemingly missing class is in! I am stumped why lib directory is not being looked up! I printed "java.class.path" in a SnoopServlet and was surprised to find that none of the jars under WEB-INF/lib are listed! A section of error-trace is included below.

I'll appreciate any help.


java.lang.NoClassDefFoundError: COM/ibm/db2/jdbc/app/DB2Driver
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at com.company.database.DatabaseConnectionPool.makeNewConnection(DatabaseConnectionPool.java:686)


Thanks
emm raha
Ranch Hand

Joined: Mar 18, 2003
Posts: 57
Double check Properties --> Java Build Path --> Libraries that the jars/zips in /lib are listed. If they are and its still failing, try dropping db2jcc.jar (newer DB2 driver) in there too.
Anne Forumer
Ranch Hand

Joined: Apr 19, 2004
Posts: 72
Thanks for your reply.

But that won't help because our application is looking for COM/ibm/db2/jdbc/app/DB2Driver and db2jcc.jar has com/ibm/db2/jcc/DB2Driver!

Any comments?

Do you know if "zip" in db2java.zip, instead of "jar" could be causing problems? I have seen some mention of it in other postings.

What else could I do to test?

Thanks
emm raha
Ranch Hand

Joined: Mar 18, 2003
Posts: 57
Can't really think of what the issue could be - zip/jar shouldn't matter. How have you created the datasource on your server instance? I did the following which worked for me:
(1) JDBC Provider - DB2 Universal JDBC Driver Provider
(2) make sure the DB2UNIVERSAL_JDBC_DRIVER_PATH is set
(3) drop db2jcc.jar into the project's lib folder, for some reason it can't see it if its elsewhere

HTH.
Anne Forumer
Ranch Hand

Joined: Apr 19, 2004
Posts: 72
I am not using a datasource created in AppServer. I am porting a working application from WAS3.5. The application has it's own datasource and connection-pooling.

By the way, do you know if there is a faster way to "export" an application to ear in WSAD5.1. When I export it seems to rebuild the application from scratch, which takes a long time.

Thanks for your help.
emm raha
Ranch Hand

Joined: Mar 18, 2003
Posts: 57
I'm all out of suggestions - last resort you could create the datasources on the server instance and edit your code to do JNDI lookups for the datasources.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefFoundError for driver in db2java.zip