This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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)
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
Joined: Apr 19, 2004
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.
Joined: Mar 18, 2003
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.