cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

ankur_garg5
Active Contributor
0 Kudos

Hi,

We are working on NW 7.3 and trying to connect a Web Dynpro application to Oracle 10g Database. The JDK version is 1.6. We are getting the following error during Runtime:

Exception:java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver ------------------------- Loader Info ------------------------- ClassLoader name: [demo.sap.com/testwd] Loader hash code: 48c3794 Living status: alive Direct parent loaders:   [system:Frame]   [interface:webservices]   [interface:cross]   [interface:security]   [interface:transactionext]   [library:webservices_lib]   [library:opensql]   [library:jms]   [library:ejb20]   [service:p4]   [service:ejb]   [service:servlet_jsp]   [library:tc~bl~logging~api]   [library:tc~aii~base~offline~facade]   [library:tc~cmi]   [library:tc~ddic~runtime~facade]   [sap.com/tc~wd~api]   [library:tc~bl~exception~lib] Resources:   E:\usr\sap\CEX\J10\j2ee\cluster\apps\demo.sap.com\testwd\servlet_jsp\webdynpro\resources\demo.sap.com\testwd\root\WEB-INF\lib\demo.sap.com~testwd.jar

Let me explain what I have done till now:

1) Downloaded the Oracle 10g JDBC driver using the following link: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-10201-088211.html

Please note that there is no specific driver available for JDK 1.6. Hence I have used ojdbc14.jar. Searched everywhere on net but did not find a specific Oracle 10g JDBC driver for JDK 1.6.

2) Created a Web Dynpro project and added ojdbc14.jar as an External Library under Java Build Path of the project.

3) Also added the jar in the lib folder of the Web Dynpro folder.

4) Wrote a single line of code in the wdDoInit() method of the Component Controller:

Class.forName("oracle.jdbc.driver.OracleDriver");

5) Build and deploy the application.

For information, I tried performing the exact same steps in NW 7.0 with same Oracle version and JDK version as 1.4. I am successfully able to connect to the DB and fetch the data.

Request anyone to please share any information that can be useful for resolving this issue. Also, I am not looking to use EJBs as a middle layer between WD and Database.

Thanks & Regards,

Ankur Garg

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos
you just put the jar build path, it is not enough. it is only available at design time.
you have to know how to use external lib.
search in sdn you find a lot.
ankur_garg5
Active Contributor
0 Kudos

Hi Jun,

Thanks for your reply. I have already searched a lot on sdn but not for creating an external lib.

The following thread has been resolved by you by recommending to put the jar file in the lib folder along with putting it in build path: http://scn.sap.com/thread/3145699

I will try to do it using the external lib, but I cannot believe that without external lib, this is not possible. The same thing is working in NWDS 7.0 without external lib.

Anyways, thanks for your reply.

Thanks & Regards,

Ankur Garg

junwu
Active Contributor
0 Kudos
how you did that in nw7?
ankur_garg5
Active Contributor
0 Kudos

I added ojdbc14.jar in the Java Build Path as external jar. I also added the jar in the lib folder of the Web Dynpro project. After that I just wrote the JDBC code in Component Controller and built and deployed the application. No error was received and I was able to get data from the database.

junwu
Active Contributor
0 Kudos

yes, that's nw7 project,

there is no project in nw7.3, all are DC. the build path is determined by DC dependency, manually adding jar to the build path will not work

ankur_garg5
Active Contributor
0 Kudos

Hi Jun,

I tried using the external library this time but still getting the same error:

Exception:java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver ------------------------- Loader Info ------------------------- ClassLoader name: [demo.sap.com/testwd] Loader hash code: 7c583538 Living status: alive Direct parent loaders:   [system:Frame]   [interface:webservices]   [interface:cross]   [interface:security]   [interface:transactionext]   [library:webservices_lib]   [library:opensql]   [library:jms]   [library:ejb20]   [service:p4]   [service:ejb]   [service:servlet_jsp]   [library:tc~bl~logging~api]   [library:tc~aii~base~offline~facade]   [library:tc~cmi]   [library:tc~ddic~runtime~facade]   [demo.sap.com/oradbear]   [sap.com/tc~wd~api]   [library:tc~bl~exception~lib] Resources:   E:\usr\sap\CEX\J10\j2ee\cluster\apps\demo.sap.com\testwd\servlet_jsp\webdynpro\resources\demo.sap.com\testwd\root\WEB-INF\lib\demo.sap.com~oracledb~oracleJDBC_assembly.jar   E:\usr\sap\CEX\J10\j2ee\cluster\apps\demo.sap.com\testwd\servlet_jsp\webdynpro\resources\demo.sap.com\testwd\root\WEB-INF\lib\demo.sap.com~testwd.jar

I removed the jar from the web dynpro build path and lib folder. And then I followed the steps given in the following tutorial: http://scn.sap.com/docs/DOC-7637

Any idea what might be going wrong now?

Thanks & Regards,

Ankur Garg

ankur_garg5
Active Contributor
0 Kudos

I have finally been able to run my application without any errors. Apart from the tutorial (http://scn.sap.com/docs/DOC-7637), the following thread proved to be a life saver: http://scn.sap.com/thread/1724661

Thanks Jun for your help.

junwu
Active Contributor
0 Kudos

good to know you have overcome the issue:)

Answers (0)