oracle.jdbc.driver.OracleDriver ClassNotFoundException

后端 未结 8 671
你的背包
你的背包 2020-11-28 14:49

This is my code for which I am getting error. My classes12.jar has been imported as an external jar.

import java.io.IOException;
import java.io.         


        
相关标签:
8条回答
  • 2020-11-28 15:09
       Class.forName("oracle.jdbc.driver.OracleDriver");
    

    This line causes ClassNotFoundException, because you haven't placed ojdbc14.jar file in your lib folder of the project. or YOu haven't set the classpath of the required jar

    0 讨论(0)
  • 2020-11-28 15:09

    1.Right click on your java project.

    2.Select "RUN AS".

    3.Select "RUN CONFIGURATIOS...".

    4.Here select your server at left side of the page and then u would see "CLASS PATH" tab at riht side,just click on it.

    5.Here clilck on "USER ENTRIES" and select "ADD EXTERNAL JARS".

    6.Select "ojdbc14.jar" file.

    7.Click on Apply.

    8.Click on Run.

    9.Finally Restart your server then it would be execute.

    0 讨论(0)
  • 2020-11-28 15:10

    Method 1: Download ojdbc.jar

    add ojdbc6.jar to deployment assembly. Right click on project->properties->select deployment assembly->click on 'Add' ->select 'Archives from File System'->browse to the folder where ojdbc6.jar is saved.->add the jar->click finish->Apply/OK.

    Method 2:

    if you want to add ojdbc.jar to your maven dependencies you follow this link: http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/ . . Even if you're using a maven project it is not necessary to add ojdbc to maven dependencies(method 2), method 1 (adding directly to deployment assembly) works just fine.

    0 讨论(0)
  • 2020-11-28 15:10

    try to add ojdbc6.jar or other version through the server lib "C:\apache-tomcat-7.0.47\lib",

    Then restart the server in eclipse.

    0 讨论(0)
  • 2020-11-28 15:14

    In Eclipse , rightclick on your application

    Run As -> Run configurations -> select your server from type filter text box

    Then in Classpath under Bootstrap Entries add your classes12.jar File and Click on Apply.
    Now, run the file...... This worked for me !!

    0 讨论(0)
  • 2020-11-28 15:15

    In Eclipse,

    When you use JDBC in your servlet, the driver jar must be placed in the WEB-INF/lib directory of your project.

    0 讨论(0)
提交回复
热议问题