JDBC Help - java.lang.ClassNotFoundException

This has been one of the greatest headaches I've had since I started programming 10+ years ago. I've just started learning Java, and I really need to connect to a JDBC database (Sybase). Please, help me!!
I've stripped my code down, because this is the part that's causing the code to generate the error:
import java.sql.*;
import java.io.File;
public class test {
     public static void main() {
          Class.forName("ianywhere.ml.jdbcodbc.IDriver");
}The error message is:
test.java:6: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown
     Class.forName("ianywhere.ml.jdbcodbc.IDriver");
          ^I'm using the following JDBC driver:
http://astronomicus.net/jodbc.jar
I'm typing this in to compile the code:
javac -classpath "%ASANY9%\java\jodbc.jar" test.javaAnd finally, my CLASSPATH is:
.;C:\j2sdk1.4.1_07\bin;%ASANY9%\java\
The driver is located in the "%ASANY9%\java\" directory.
Thank you so much for your help!!!
Message was edited by:
tate_etc
Message was edited by:
tate_etc

Pu the statement in a try catch block.

Similar Messages

  • JDBC,Oracle - java.lang.ClassNotFoundException: oracle.jdbc.driver.Oracle

    I am using JBuilder5 which comes with jdk1.3. I have installed oracle 8.1.7 Enterprise version.
    I am using Win NT 4.0.
    I have set the PATH variable as E:\oracle\ora81\lib; and
    CLASSPATH as : E:\oracle\ora81\jdbc\lib\classes12.zip;E:\oracle\ora81\jdbc\lib\nls_charset12.zip;
    My JDBC code is
    package sample2;
    import java.sql.*;
    public class Two {
    Connection con;
    Statement st;
    public Two() {
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection("jdbc:oracle:oci8:@First","scott","tiger");
    st = con.createStatement();
    ResultSet rs = st.executeQuery("Select * from Book");
    while(rs.next())
    System.out.print(rs.getInt("ID")+"\t");
    System.out.print(rs.getString("title")+"\t");
    System.out.print(rs.getString("author")+"\t");
    System.out.print(rs.getString("subject")+"\t");
    System.out.println(rs.getInt("copies")+"\t");
    st.close();
    con.close();
    catch(Exception ex)
    System.out.println("Exception : " + ex.toString());
    public static void main(String[] args) {
    Two two1 = new Two();
    I am getting this exception:
    Exception : java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    I can understand that the classpath for the driver is the problem here.
    Also, I tried to run this file without JBuilder as a independent file on a notepad. Even then this exception is thrown.
    I have set the PATH to E:\oracle\ora81\bin and also to E:\oracle\ora81\lib.
    I ran "echo %classpath%" from my command prompt and this is what i am getting.
    E:\JBuilder5\jdk1.3\lib\tools.jar;E:\JBuilder5\jdk1.3\dt.jar;E:\oracle\ora81\jdbc\lib\classes12.zip;E:
    \oracle\ora81\jdbc\lib\nls_charset12.zip;
    I searched solution for this probldem in Sun JDC Forum itself. Many of them suggested to unzip classes12.zip and create jar file and add it in the classpath. Alos, some have suggested to copy the classes12.zip in home directory and then include this path in the classpath. I tried those solutions also. But, nothing seem to work.
    Somebody help me fix this problem.
    Thanks in advance.

    Jbuilder5 uses a different means of loading dependent classes. Use menu : Tools -->Configure Libraries - Click New and setup a new named library that points to classes12.zip .
    Then include this in u'r required Libraries of your project using menu Project --> Project Properties - required Libraries tab.
    I don't thnk Jbuilder5 even refers to CLASSPATH set in Windows NT environement. Path may need to be set to include oracle/ora81/bin directory though.
    Hope this helps.

  • Help:java.lang.ClassNotFoundException

    we have one application.We are calling ejb through applet.
    We have sybase EAServer3.6.1 and jaguar 3.6.1.Java code is in jdk118 and ejb1.0.
    Our architacture is: applet<->ejb<->server.
    Our ejb is deployed on server.That we are calling our ejb through applet.Whole code for applet and ejb is lying on server.When we run our application through browser from different m/c we are getting two errors.
    1)com.ms.security.SecurityExceptionEx.
    2)powersoft.powerj.jaguar.InitialContextException: javax.naming lookup failed for component: HelloEJBPackage/HelloEJB
    Exception: [Root exception is [Root exception is java.lang.ClassNotFoundException: java.rmi.Remote]javax.naming.NamingException]javax.naming.NamingException.
    When I set classpath on each m/c.
    i.e (c:/prog/sybase/shard/sun/jdk118/lib/classes.zip) my application is running fine it just gives warning for securiety not for lookup method failed.
    Our system is in production.We can not make setting for individual clients.We need our applet should take classes from server not from client m/c.
    Can anybody help me to solve this problem?

    If the client is created using powerj, pl cross verify the code for the lookup() in the client with component properties in the jaguar server.
    check the component properties , in the installed packages of the jaguarCTS , under jaguar manager of the sybase central java edition.
    kar

  • HELP: java.lang.ClassNotFoundException: oracle.form.engine.Main

    Hello,
    I am trying to run a Form. Very simple form. I need to run the form.
    I am using Windows XP SP3 & IE7.
    I ahve tried many tips before writing here.
    1) I have disabled some Add-Ons on IE7 like google & Ask but also, did not solve the problem.
    2) I installed the JInitiator.
    3) I have tried to work with firefox instead of IE7, but didn't work.
    4) I made sure from the URL to be using the correct port. And, it is something like:
    http://aa.uni.edu:8889/forms90/f90servlet
    What should I do to solve the problem?
    Please, be very detailed when describing the solution as I am very very new to Oracle.
    Thank you.

    Hi!
    In my case when I had similar problem I did the following:
    1) Enforce default settings on IE.
    2) Deinstalled JInitiator
    3) Installed the necessary JInitiator from the application server by opening a form in the IE.
    4) Control Panel -> JInitiator -> Cache -> Clear JAR Cache
    These covered all the problems I had so far...

  • Help me with this  one:java.lang.ClassNotFoundException: com.mysql.jdbc.Dri

    compile and build:Successful
    but when I run it...I got this msg:
    init:
    deps-jar:
    Compiling 1 source file to C:\Documents and Settings\Administrator\Form\build\classes
    compile:
    run:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at my.form.MyDBConnection.init(MyDBConnection.java:26)
    at my.form.FormUI.<init>(FormUI.java:20)
    at my.form.FormUI$40.run(FormUI.java:1094)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    I use two classes
    FormUI.java and MyDBConnection.java
    * MyDBConnection.java
    package my.form;
    import java.sql.*;
    public class MyDBConnection {
    private Connection myConnection;
    /** Creates a new instance of MyDBConnection */
    public MyDBConnection() {
    public void init(){
    Connection connection = null;
    Statement statement = null;
    try{
    Class.forName("com.mysql.jdbc.Driver");
    myConnection=DriverManager.getConnection(
    "jdbc:mysql://localhost:3306/test,'root' "
    catch(SQLException sqlException){
    sqlException.printStackTrace();
    System.exit(1);
    catch ( ClassNotFoundException classNotFound )
    classNotFound.printStackTrace();
    System.exit(1);
    finally
    try
    statement.close();
    connection.close();
    catch ( Exception exception )
    exception.printStackTrace();
    System.exit( 1 );
    public Connection getMyConnection(){
    return myConnection;
    public void close(ResultSet rs){
    if(rs !=null){
    try{
    rs.close();
    catch(Exception e){}
    public void close(java.sql.Statement stmt){
    if(stmt !=null){
    try{
    stmt.close();
    catch(Exception e){}
    public void destroy(){
    if(myConnection !=null){
    try{
    myConnection.close();
    catch(Exception e){}
    * FormUI.java
    * Created on May 2, 2007, 10:33 AM
    package my.form;
    import java.sql.*;
    * @author Administrator
    public class FormUI extends javax.swing.JFrame {
    /** Creates new form FormUI */
    public FormUI() throws Exception {
    mdbc=new MyDBConnection();
    mdbc.init();
    Connection conn=mdbc.getMyConnection();
    stmt=conn.createStatement();
    initComponents();
    * MyDBConnection.java
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jTextField1 = new javax.swing.JTextField();
    jTextField2 = new javax.swing.JTextField();
    jTextField3 = new javax.swing.JTextField();
    jTextField35 = new javax.swing.JTextField();
    jPanel3 = new javax.swing.JPanel();
    jLabel5 = new javax.swing.JLabel();
    jTextField5 = new javax.swing.JTextField();
    jLabel6 = new javax.swing.JLabel();
    jTextField6 = new javax.swing.JTextField();
    jLabel7 = new javax.swing.JLabel();
    jTextField7 = new javax.swing.JTextField();
    jLabel8 = new javax.swing.JLabel();
    jTextField4 = new javax.swing.JTextField();
    jLabel9 = new javax.swing.JLabel();
    jTextField8 = new javax.swing.JTextField();
    jLabel10 = new javax.swing.JLabel();
    jTextField9 = new javax.swing.JTextField();
    jLabel11 = new javax.swing.JLabel();
    jTextField10 = new javax.swing.JTextField();
    jLabel12 = new javax.swing.JLabel();
    jTextField11 = new javax.swing.JTextField();
    jLabel13 = new javax.swing.JLabel();
    jTextField12 = new javax.swing.JTextField();
    jLabel14 = new javax.swing.JLabel();
    jTextField13 = new javax.swing.JTextField();
    jLabel15 = new javax.swing.JLabel();
    jPanel2 = new javax.swing.JPanel();
    jLabel16 = new javax.swing.JLabel();
    jTextField14 = new javax.swing.JTextField();
    jLabel17 = new javax.swing.JLabel();
    jTextField15 = new javax.swing.JTextField();
    jLabel18 = new javax.swing.JLabel();
    jTextField16 = new javax.swing.JTextField();
    jLabel19 = new javax.swing.JLabel();
    jTextField17 = new javax.swing.JTextField();
    jLabel20 = new javax.swing.JLabel();
    jTextField18 = new javax.swing.JTextField();
    jLabel21 = new javax.swing.JLabel();
    jTextField19 = new javax.swing.JTextField();
    jLabel22 = new javax.swing.JLabel();
    jTextField20 = new javax.swing.JTextField();
    jLabel23 = new javax.swing.JLabel();
    jTextField21 = new javax.swing.JTextField();
    jLabel24 = new javax.swing.JLabel();
    jTextField22 = new javax.swing.JTextField();
    jLabel25 = new javax.swing.JLabel();
    jTextField23 = new javax.swing.JTextField();
    jLabel26 = new javax.swing.JLabel();
    jTextField24 = new javax.swing.JTextField();
    jLabel27 = new javax.swing.JLabel();
    jTextField25 = new javax.swing.JTextField();
    jLabel28 = new javax.swing.JLabel();
    jTextField26 = new javax.swing.JTextField();
    jLabel29 = new javax.swing.JLabel();
    jTextField27 = new javax.swing.JTextField();
    jLabel30 = new javax.swing.JLabel();
    jTextField28 = new javax.swing.JTextField();
    jLabel31 = new javax.swing.JLabel();
    jTextField29 = new javax.swing.JTextField();
    jLabel32 = new javax.swing.JLabel();
    jTextField30 = new javax.swing.JTextField();
    jLabel33 = new javax.swing.JLabel();
    jTextField31 = new javax.swing.JTextField();
    jLabel34 = new javax.swing.JLabel();
    jTextField32 = new javax.swing.JTextField();
    jLabel35 = new javax.swing.JLabel();
    jTextField33 = new javax.swing.JTextField();
    jLabel36 = new javax.swing.JLabel();
    jTextField34 = new javax.swing.JTextField();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jLabel37 = new javax.swing.JLabel();
    jLabel38 = new javax.swing.JLabel();
    jTextField37 = new javax.swing.JTextField();
    jTextField36 = new javax.swing.JTextField();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    jPanel1.setBackground(new java.awt.Color(204, 255, 204));
    jLabel1.setText("custID");
    jLabel2.setText("PIN");
    jLabel3.setText("Source");
    jLabel4.setText("SaleDate");
    jTextField1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField1ActionPerformed(evt);
    jTextField2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField2ActionPerformed(evt);
    jTextField3.setText("SourceHub");
    jTextField3.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField3ActionPerformed(evt);
    jTextField35.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField35ActionPerformed(evt);
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGap(28, 28, 28)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel1)
    .addComponent(jLabel2))
    .addGap(15, 15, 15)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE)
    .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 88, Short.MAX_VALUE)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(jLabel3)
    .addComponent(jLabel4))
    .addGap(13, 13, 13)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
    .addComponent(jTextField35)
    .addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE))
    .addGap(198, 198, 198))
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGap(21, 21, 21)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel1)
    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel3))
    .addGap(18, 18, 18)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel4)
    .addComponent(jTextField35, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addContainerGap(23, Short.MAX_VALUE))
    jPanel3.setBackground(new java.awt.Color(204, 255, 204));
    jLabel5.setText("First Name");
    jTextField5.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField5ActionPerformed(evt);
    jLabel6.setText("Last Name");
    jTextField6.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField6ActionPerformed(evt);
    jLabel7.setText("Address");
    jTextField7.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField7ActionPerformed(evt);
    jLabel8.setText("City");
    jTextField4.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField4ActionPerformed(evt);
    jLabel9.setText("ZIP");
    jTextField8.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField8ActionPerformed(evt);
    jLabel10.setText("Sales Rep");
    jTextField9.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField9ActionPerformed(evt);
    jLabel11.setText("Phone");
    jTextField10.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField10ActionPerformed(evt);
    jLabel12.setText("Alt Phone");
    jTextField11.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField11ActionPerformed(evt);
    jLabel13.setText("E-Mail");
    jTextField12.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField12ActionPerformed(evt);
    jLabel14.setText("DateofBirth");
    jTextField13.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField13ActionPerformed(evt);
    jPanel2.setBackground(new java.awt.Color(204, 255, 204));
    jLabel16.setText("AnnualAmount");
    jTextField14.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField14ActionPerformed(evt);
    jLabel17.setText("AnnualDay");
    jTextField15.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField15ActionPerformed(evt);
    jLabel18.setText("AnnualMonth");
    jTextField16.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField16ActionPerformed(evt);
    jLabel19.setText("MonthlyAmount");
    jTextField17.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField17ActionPerformed(evt);
    jLabel20.setText("MonthlyDay");
    jTextField18.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField18ActionPerformed(evt);
    jLabel21.setText("MonthlyStatusDate");
    jTextField19.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField19ActionPerformed(evt);
    jLabel22.setText("AnnualStatus2");
    jTextField20.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField20ActionPerformed(evt);
    jLabel23.setText("MonthlyStatus2");
    jTextField21.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField21ActionPerformed(evt);
    jLabel24.setText("Plan");
    jTextField22.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField22ActionPerformed(evt);
    jLabel25.setText("Bonus Gift");
    jTextField23.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField23ActionPerformed(evt);
    jLabel26.setText("AccountType");
    jTextField24.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField24ActionPerformed(evt);
    jLabel27.setText("AbaNumber");
    jTextField25.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField25ActionPerformed(evt);
    jLabel28.setText("AccountNumber");
    jTextField26.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField26ActionPerformed(evt);
    jLabel29.setText("BankName");
    jTextField27.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField27ActionPerformed(evt);
    jLabel30.setText("Verification Number");
    jTextField28.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField28ActionPerformed(evt);
    jLabel31.setText("Upsale1");
    jTextField29.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField29ActionPerformed(evt);
    jLabel32.setText("Upsale2");
    jTextField30.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField30ActionPerformed(evt);
    jLabel33.setText("UP1BillDate");
    jTextField31.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField31ActionPerformed(evt);
    jLabel34.setText("UP2BillDate");
    jTextField32.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField32ActionPerformed(evt);
    jLabel35.setText("Date-Time");
    jTextField33.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField33ActionPerformed(evt);
    jLabel36.setText("Notes");
    jTextField34.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jTextField34ActionPerformed(evt);
    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel16)
    .addComponent(jLabel19)
    .addComponent(jLabel22)))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGap(34, 34, 34)
    .addComponent(jLabel24))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jLabel26))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGap(23, 23, 23)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel29)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGap(2, 2, 2)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(jLabel31)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel35)
    .addComponent(jLabel33)))))))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
    .addComponent(jTextField24)
    .addComponent(jTextField22)
    .addComponent(jTextField20)
    .addComponent(jTextField17)
    .addComponent(jTextField14, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel17)
    .addComponent(jLabel20))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
    .addComponent(jTextField18)
    .addComponent(jTextField15, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addComponent(jLabel18)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addComponent(jLabel21)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(jLabel27)
    .addComponent(jLabel25)
    .addComponent(jLabel23))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
    .addComponent(jTextField25)
    .addComponent(jTextField23)
    .addComponent(jTextField21, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jTextField28, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addComponent(jLabel28)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jTextField26))))))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
    .addComponent(jTextField31, javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jTextField29, javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jTextField27, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE))
    .addGap(21, 21, 21)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel30)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
    .addComponent(jLabel34)
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addGap(14, 14, 14)
    .addComponent(jTextField34, javax.swing.GroupLayout.DEFAULT_SIZE, 195, Short.MAX_VALUE))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jTextField32, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))))
    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
    .addComponent(jLabel32)
    .addGap(20, 20, 20)
    .addComponent(jTextField30, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))))
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addComponent(jTextField33, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(27, 27, 27)
    .addComponent(jLabel36)))
    .addGap(113, 11

    I am not sure what is the driver for mysql. I just came across the similar kind of problem in the forum and I have given the forum link below. Check if you have the file and then set the classpath.
    [Hyperlinks] http://forum.java.sun.com/thread.jspa?threadID=522873&messageID=2503366
    [HyperLinks]

  • Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.dr

    Hi
    I am trying to use type 4 driver to connect to my Oracle 9i Rel2 database. I downloaded the odbc14.jar from oracle and added in the C:\Oracle9i\jdbc\lib path. As on the website, I setup my environment:
    Setting Up Your Environment
    On Win95/Win98/NT:
    - Add [ORACLE_HOME]\jdbc\lib\classes111.zip and
    [ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH.
    (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is
    used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.)
    - Make sure [ORACLE_HOME]\bin is in your PATH.
    Still I am getting the following error during runtime:
    Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at jdbc.InsertQueryEx.main(InsertQueryEx.java:11)
    Below is the source code:
    import java.sql.*;
    import java.io.*;
    public class InsertQueryEx {
    public static void main(String[] args)throws Exception{
    Class.forName("oracle.jdbc.OracleDriver");
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@Prashy:1521:orcl", "scott", "tiger");
    DataInputStream din = new DataInputStream(System.in);
    Statement stmt = con.createStatement();
    while(true){
    try{
    System.out.println("enter emp name");
    String name = din.readLine();
    System.out.println("enter emp no");
    int no = Integer.parseInt(din.readLine());
    System.out.println("enter emp salary");
    float sal = Float.parseFloat(din.readLine());
    System.out.println("enter emp address");
    String addr = din.readLine();
    int count = stmt.executeUpdate("insert into myemp values("+no+",'"+name+"',"+sal+",'"+addr+"')");
    if(count>0)
    System.out.println("Record added");
    else
    System.out.println("Failed");
    catch (Exception e){
    System.err.println("Exception: "+e.getMessage());
    Any help is appreciated
    Thanks
    Prashant

    I am sorry but I did add those in the classpath but still getting this error:
    This is what I have for user variable in classpath:
    .;C:\Oracle9i\jdbc\lib\ojdbc14.jar;C:\Oracle9i\jdbc\lib\nls_charset12.jar
    error is:
    java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at jdbc.InsertQueryEx.main(InsertQueryEx.java:14)
    Thanks

  • Java.lang.ClassNotFoundException: weblogic/jdbc/mssqlserver4/Driver

    Hello,
    I am moving my database from Sybase to SQL Server. I have a program that ran fine with JConnect driver (Sybase) on both unix and windows. But now when I try to use the weblogic driver to connect to SQL Server the program fails. I am 100% positive that the weblogic drive is in the classpath. Whether the weblogic drive is in the classpath or not I get the same error:
    Unexpected error:java.lang.ClassNotFoundException: weblogic/jdbc/mssqlserver4/Driver
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:124)
    at com.trilogy.tools.core.DBUtil.loadDriver(DBUtil.java:16)
    at com.trilogy.loader.core.LoadInitUtil.<init>(Compiled Code)
    at com.trilogy.loader.mass.MassInitUtil.<init>(MassInitUtil.java:15)
    at com.trilogy.loader.mass.Loader2CLI.execute(Compiled Code)
    at com.trilogy.tools.core.CLIBase.execute(CLIBase.java:45)
    at com.trilogy.loader.mass.Loader2CLI.main(Loader2CLI.java:805)
    java.lang.NullPointerException
    at com.trilogy.loader.mass.Loader2CLI.execute(Compiled Code)
    at com.trilogy.tools.core.CLIBase.execute(CLIBase.java:45)
    at com.trilogy.loader.mass.Loader2CLI.main(Loader2CLI.java:805)
    Pease help me fix this problem. I am not sure why the weblogic driver is not working. Thanks.

    The error message says it can't find a class named "weblogic.jdbc.mssqlserver4.Driver". That looks rather odd to me.
    Are you sure that you defined the connection information correctly in the configuration file?

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

    Hi,
    I am writing an application and am trying to open a connection to Oracle database that is on a server. I am using the following test code to check if it connects to the database.
    import java.sql.*;
    class dbAccess {
      public static void main (String args []) throws SQLException
            String DBurl = "jdbc:oracle:thin:@local:1522:DBORA";
            String user = "test";
            String pwd = "test123";
            Class.forName("oracle.jdbc.driver.OracleDriver");
            con = DriverManager.getConnection(DBurl, user, pwd);
    }On running the above program I keep on getting the following error:
    Error : java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    java.lang.NullPointerException
    If I open the connection using JDeveloper wizard I can see the DB. But if running the above program in the JDev, JCreator or commandline keep on getting the error. Any help is appreciated. Thanks

    How do I set the path for the Oracle Driver. ThanksI dunno. You're supposed to know where that class is (what jar it lives in). You set it up in JDeveloper in the first place, so you must have known where it is. After you know that, it's up to you to figure out how JCreator projects are set up to include jars in a project (just like JDeveloper projects do). For the command-line way, you set the classpath on the command-line arguments:
    java -cp (your classpath here, which must include the jars it needs) ...

  • Re : Error java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDrive

    Hello All,
    I am writing this simple program which connects to Oracle DB ( 10.2 ). The Java version I have is 1.5.0_13 . I do have oracle client installed. When I run the below code ...I get error
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
            at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:164)
            at OraThin.main(OraThin.java:13)The code I have is :
    import java.io.*;
    import java.sql.*;
    public class OraThin {
      public static void main(String[] args) {
        try {
    System.out.println(System.getProperty ("java.class.path") );
          Connection con=null;
          Class.forName("oracle.jdbc.driver.OracleDriver");
          con=DriverManager.getConnection(
            "jdbc:oracle:thin:@hostname:15282:ServiceName",
            "scott",
            "tiger");
          Statement s=con.createStatement();
          s.execute("SELECT SYSDATE FROM DUAL");
          s.close();
          con.close();
      } catch(Exception e){e.printStackTrace();}
    } Please suggest as to what am I missing, I am not that well versed with Java.
    Thanks in advance,
    Sam

    Hello Paul,
    Thanks for you suggestion. Based on it , I did add the exact jar file in the PATH environmental variable in XP.
    Path=C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;C:\oraclexe\a
    pp\oracle\product\10.2.0\server\bin;C:\oracle\product\10.2.0\client_1\bin;C:\Ora
    cle\product\10.1.0\Client_1\bin;C:\Oracle\product\10.1.0\Client_1\jre\1.4.2\bin\
    client;C:\j2sdk1.4.2_06\bin;Even after adding the specific jar file *("C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar")* ..I am getting the exact same error. moreover, to verify this I also tried to import import oracle.jdbc.driver.*.....and now my code would not even complie and I get error *(c:\Program Files\Java\jdk1.5.0_13\bin\OraThin.java:3: package oracle.jdbc.driver*
    does not exist ) . I also rebooted my machine just to make sure ...that didnt work either. Also, I changed these jar to be first in the PATH varibale ..to avoid conflict with any later .jar's classes. The code is :
    import java.io.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    public class OraThin {
      public static void main(String[] args) {
        try {
    System.out.println(System.getProperty ("java.class.path") );
          Connection con=null;
          Class.forName("oracle.jdbc.driver.OracleDriver");
          con=DriverManager.getConnection(
            "jdbc:oracle:thin:@hostname:15282:ServiceName",
            "scott",
            "tiger");
          Statement s=con.createStatement();
          s.execute("SELECT SYSDATE FROM DUAL");
          s.close();
          con.close();
      } catch(Exception e){e.printStackTrace();}
    }What am I missing here!! ?
    Thanks again,
    Sam

  • Java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriveroracle.j

    My compile works just fine: javac mail_create.java
    but when I try to run I get OracleDriver error. Not sure how to fix this. Using RedHat Linux 7.3
    [ora9ias@tautog classes]$ java mail_create
    Error: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriveroracle.j
    dbc.driver.OracleDriver
    [ora9ias@tautog classes]$ pwd
    /home/oracle/9iAS/j2ee/home/default-web-app/WEB-INF/classes
    [ora9ias@tautog classes]$
    Some of my code...
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.sql.*;
    public class mail_create {
    public static void main(String[] arguments) {
    StringTokenizer st1;
         int cnt1, cnt2, cnt3, cnt4, ival, newal;
         String commabv, commemail, comabbrv, commca, commail;
         String comcod []=new String [99];
         String comvar []=new String [800];
         String curabr []=new String [800];
         String comail []=new String [800];
    try {
         Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    .....

    http://search.java.sun.com/search/java/index.jsp?qt=%2Boracledriver+%2Bclassnotfoundexception&nh=10&qp=&rf=1&since=&country=&language=&charset=&variant=&col=javaforums

  • Java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDri

    I am sorry in advance, because I know this topic has been posted many times, but I think after reading all the solutions and trying everything I may have messed myself up worse.
    I am trying to run this simple script to connect to my SQL database
    import java.sql.*;
      * Microsoft SQL Server JDBC test program
    public class Test {
      public Test() throws Exception {
        // Get connection
        DriverManager.registerDriver(new
        com.microsoft.jdbc.sqlserver.SQLServerDriver());
        Connection connection = DriverManager.getConnection(
        "jdbc:microsoft:sqlserver://<Host>:1433","<UID>","<PWD>");
        if (connection != null) {
         System.out.println();
          System.out.println("Successfully connected");
          System.out.println();
          // Meta data
          DatabaseMetaData meta = connection.getMetaData();
          System.out.println("\nDriver Information");
          System.out.println("Driver Name: "
           + meta.getDriverName());
          System.out.println("Driver Version: "
           + meta.getDriverVersion());
          System.out.println("\nDatabase Information ");
          System.out.println("Database Name: "
           + meta.getDatabaseProductName());
          System.out.println("Database Version: "+
          meta.getDatabaseProductVersion());
    } // Test
    public static void main (String args[]) throws Exception {
      Test test = new Test();
    }I have set "PATH" in environmental variables (running windows)to be
    C:\Program Files\Java\jdk1.6.0_04\bin;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jarSo when i Compile i get the error..
    C:\SQLcode>javac Test.java
    Test.java:9: package com.microsoft.jdbc.sqlserver does not exist
        com.microsoft.jdbc.sqlserver.SQLServerDriver());Additionally, when i run
    java com.microsoft.jdbc.sqlserver.SQLServerDriver
    I get
    Exception in thread "main" java.lang.NoClassDefFoundError: com/microsoft/jdbc/sq
    lserver/SQLServerDriver
    Caused by: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLSer
    verDriverFinally, I have even ran javac -classpath "C:\Program Files\Microsoft SQL Server 2000 Driver f
    or JDBC\lib\;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msba
    se.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserve
    r.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar"
    Test.java Which will compile correctly! However when I run the same command just with the java command as opposed to the javac command, I get
    Exception in thread "main" java.lang.NoClassDefFoundError: Test/java
    Caused by: java.lang.ClassNotFoundException: Test.java
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source) While there is a Class file in the directory.. Sorry for such a long post but I have been trying to fix this for two days now.. thank you

    Ok well i tried a number of combinations..
    My code lets say is in a folder C:\SQLCode which was successfully compiled using the command above..
    I tried doing what you suggested and got
    C:\SQLcode>java -cp .;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC
    \lib\;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;
    C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;C
    :\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar Test
    Exception in thread "main" java.lang.NoClassDefFoundError: Files\Microsoft
    Caused by: java.lang.ClassNotFoundException: Files\Microsoft
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)I also tried without the direct links to the .jar files (just put the DIR) and got the same result.Any other suggestions?

  • Error loading driver: java.lang.ClassNotFoundException: oracle.jdbc.driver.

    Hi!!!
    I�m trying to execute a example program included in http://archive.coreservlets.com/, the file is FruitTest.java....this compile very well...but....when i tried to execute it i have the following error:
    Error loading driver: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    Could somebody tell me what i have to add to my classpath?...and how to know if i have to download something and in what link is it?......
    Thanks in advance...
    Mary

    Hi mary,
    Please try following code, but before that please include classes12.zip in ur classpath. This file contains the oracle thin driver.
    Connection connection = null;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    String url = "jdbc:oracle:thin:@dbUrl"
    connection = DriverManager.getConnection(url, "dbName", "password");
    }catch (Exception e){
    e.printStackTrace();
    good luck ...san :-)

  • First Spring Application .Help needed.java.lang.ClassNotFoundException

    Hi
    i am new to this site and java Springs, I couldn't find seprate spring forum so i am posting my question here.
    i hope its not a problem.
    I am very new to Springs and struggeling through my first Spring MVC application. can any one help me here.
    Here is what i have done uptill now.
    WEB.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <servlet>
            <servlet-name>HelloSpring</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
            </servlet>
        <servlet-mapping>
            <servlet-name>HelloSpring</servlet-name>
            <url-pattern>*.htm</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>      
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
         <welcome-file>
                index.jsp
            </welcome-file>
        </welcome-file-list>
    </web-app>
    HelloSpring-servlet.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
        <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                    <prop key="/hello.htm">HelloSpringController</prop>
                </props>
            </property>
        </bean>
        <bean id = "HelloSpringController" class="HelloSpringController" />
    </beans>
    index.jsp
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Hello Spring</title>
        </head>
        <body>
        <form action="hello.htm"  method="POST">
            What is your name?
            <input type="text" name="yourName" value="" />
        </form>
        </body>
    </html>
    welcome.jsp
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Hello Spring</title>
        </head>
        <body>
        Hello <c:out value="${name}" />
        </body>
    </html>
    HelloSpringController.java (in default package)
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.Controller;
    public class HelloSpringController implements Controller {
        public HelloSpringController() {
        public ModelAndView handleRequest(HttpServletRequest httpServletRequest,
                                          HttpServletResponse httpServletResponse)
                                            throws Exception {
            String name = httpServletRequest.getParameter("yourName");
            return new ModelAndView("welcome.jsp", "name", name);
    }After Entering name in the text box of index.jsp, i am getting the following error.
    exception
    javax.servlet.ServletException: Servlet.init() for servlet HelloSpring threw exception
         org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
         org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
         org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         java.lang.Thread.run(Unknown Source)
    root cause
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/HelloSpring-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [HelloSpringController] for bean with name 'HelloSpringController' defined in ServletContext resource [/WEB-INF/HelloSpring-servlet.xml]; nested exception is java.lang.ClassNotFoundException: HelloSpringController
         org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:451)
         org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
         org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
         org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:330)
         org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:266)
         org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:236)
         org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
         javax.servlet.GenericServlet.init(GenericServlet.java:211)
         org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
         org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
         org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         java.lang.Thread.run(Unknown Source)
    root cause
    java.lang.ClassNotFoundException: HelloSpringController
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
         org.springframework.util.ClassUtils.forName(ClassUtils.java:201)
         org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:327)
         org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1066)
         org.springframework.beans.factory.support.AbstractBeanFactory.isBeanClassMatch(AbstractBeanFactory.java:1094)
         org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:354)
         org.springframework.context.support.AbstractApplicationContext.isSingleton(AbstractApplicationContext.java:745)
         org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.registerHandler(AbstractUrlHandlerMapping.java:255)
         org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandlers(SimpleUrlHandlerMapping.java:125)
         org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.initApplicationContext(SimpleUrlHandlerMapping.java:103)
         org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
         org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:72)
         org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:304)
         org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1168)
         org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:428)
         org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
         org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
         org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
         org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
         org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
         org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
         org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:330)
         org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:266)
         org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:236)
         org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
         javax.servlet.GenericServlet.init(GenericServlet.java:211)
         org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
         org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
         org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         java.lang.Thread.run(Unknown Source)Can anybody tell me what is am doing wrong .. it will be a greate help...
    thanks in advance

    vikash_sharma wrote:
    Thanks for another quick reply
    here is the folder structure of war.
    HelloSpring.war
    -----------Bin (empty)Wrong. No need for this. Remove it.
    ------------src/HelloSpringController.javaWrong. Source code doesn't go in WAR.
    ------------WEB-INF/classes(empty)there's your problem. the HelloSpringController.class has to be in there.
    /libWhere are the Spring JARs?
    /META-INF
    /tldDon't need /tld.
    ------------welcome.jsp
    ------------index.jspWhere's your web.xml? Where is the Spring configuration?
    You're still blank. Not even close to correct. You don't seem to know Java well enough to tackle this. You will NOT be able to accomplish this by asking questions here. Go back and learn more basics.
    %

  • [junit] java.lang.ClassNotFoundException HELP!!!!!!!

    Hello,
    I'm trying to get my project running with my ant build.xml file but i get the following error:
    Buildfile: C:\Users\bmesta\Desktop\workspace\Project2\build.xml
    compile:
    testApplication:
    [echo] Running the junit tests...
    [junit] Testsuite: project2.AllTests
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] Null Test:      Caused an ERROR
    [junit] project2.AllTests
    [junit] java.lang.ClassNotFoundException: project2.AllTests
    [junit]      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    [junit]      at java.security.AccessController.doPrivileged(Native Method)
    [junit]      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    [junit]      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    [junit]      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    [junit]      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    [junit]      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    [junit]      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    [junit]      at java.lang.Class.forName0(Native Method)
    [junit]      at java.lang.Class.forName(Class.java:247)
    [junit]      at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    [junit]      at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
    [junit]      at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
    [junit] Test project2.AllTests FAILED
    all:
    BUILD SUCCESSFUL
    Total time: 546 milliseconds
    My build file is the following:
    <project name="Project2" default="all" basedir=".">
         <description>
              Simple build file
         </description>     
         <!-- set global properties for this build -->
         <property name="sourceDir" location="src" />
         <property name="testDir" location="test" />
         <property name="junitLocation" value="C:/Program Files/eclipse/plugins/org.junit4_4.3.1/junit.jar" />          
         <path id="classpath">
             <pathelement location="${junitLocation}" />
         </path>     
         <target name="clean-compile-test">
              <delete verbose="false">
                   <fileset dir="${testDir}" includes="**/*.class" />
              </delete>
         </target>     
         <!-- Compile the java code from ${src} -->     
         <target name="compile" description="compile the source" >
              <javac srcdir="${sourceDir}" verbose="false" debug="true"/>
         </target>     
         <target name="testApplication" depends="compile">
              <echo>Running the junit tests...</echo>
              <junit>
                   <classpath refid="classpath" />
                   <formatter type="brief" usefile="false" />
                   <batchtest>
                        <fileset dir="${testDir}" includes="**/*Tests.class" />
                   </batchtest>
              </junit>
         </target>          
         <target name="all" depends="testApplication" />
         <target name="clean" depends="clean-compile-test" />
    </project>          FYI, the structure of my project is the following:
    Project2
    -src
    -project2 [package]
    GSTCalc.java, GSTCalcMain.java, GSTCalcPanel.java, GSTCalcFrame.java
    -test
    -project2 [package]
    GSTCalcTest.java, GSTCalcPanelTest.java, GSTCalcFrameTest.java, and AllTests.java
    I can't fix this problem for some reason it cant find my AllTests class. If you can hel fix this problem I will be so happy. Im so frustrated and I need to get this working. Btw, this is my first build file that i have wrote.
    Cheers,
    BRUNO

    bmesta wrote:
    well i did a tutorial and cut the sections that i need it for my build.xmlWas it necessary to manually alter the _build.xml? Could you not let Eclipse do that using the right options?                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException

    Hi there Masters
    I am new in Java and I would need your help please..
    I am calling a function in Java passing 1 parameter and returning an XML back but at the point of execution I get an error below... At the end I have attached my java code...PLEASE HELP
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
         at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:78)
         at oracle.sql.OPAQUE.toClass(OPAQUE.java:328)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:278)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:259)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:190)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:117)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1578)
         at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815)
         at hospitaltool.RunAsnIn.runAsnIn(RunAsnIn.java:41)
         at hospitaltool.HospitalTool.main(HospitalTool.java:38)
    Caused by: java.lang.ClassNotFoundException: oracle.xml.parser.v2.XMLParseException
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         ... 10 more
    =====================JAVA CODE====================================
    package hospitaltool;
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.xdb.XMLType;
    public class RunAsnIn {
    public void runAsnIn(Connection con, Boolean fam) throws SQLException {
    System.out.println("RunASNIn Section");
    String messStatus;
    int numRecs = 0; //to hold the number of Records processed
    int totRecs = 0; //to hold the number of total records processed
    ResultSet rs = null;
    Statement stmt = null;
    stmt = con.createStatement();
    //Delete all already caused messages
    try {
    rs = stmt.executeQuery("DELETE FROM asnin WHERE message_num IN(SELECT message_num FROM asnin MINUS SELECT message_num FROM hospital WHERE family = 'ASNIn')");
    //Select all the uncaused messages
    rs = stmt.executeQuery("SELECT message_num FROM hospital WHERE family = 'ASNIn' and rownum <= 1 MINUS SELECT message_num FROM asnin");
    //Go thru the uncaused messages
    } catch (Exception e) {
    while (rs.next()) {
    String messageNum = rs.getString(1);
    // System.out.println("tableName=" + messageNum);
    System.out.println(messageNum);
    //Get the XMLDoc
    XMLType xml = null;
    //Get the XML Doc
    CallableStatement cs1 = null;
    //CallableStatement proc = con.prepareCall("? {call rmsauto.hospitaltool.getmessagedoc(?)}");
    try {
    cs1 = con.prepareCall("{? = call rmsauto.hospitaltool.getmessagedoc(?)}");
    cs1.registerOutParameter(1, OracleTypes.OPAQUE, "SYS.XMLTYPE");
    cs1.setString(2, messageNum);
    cs1.execute();
    } catch (Exception e) {
    xml = (XMLType) cs1.getObject(1);
    System.out.println(xml.getStringVal());
    }

    I did google this and found that I needed a specific jar file called xmlparserv2.jar and I did download it and loaded it on as part of my Libraries the I got a new error... I am using NetBeans
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/binxml/BinXMLMetadataProvider
         at oracle.xdb.XMLTypeFactory.create(XMLTypeFactory.java:78)
         at oracle.sql.OPAQUE.toClass(OPAQUE.java:328)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:278)
         at oracle.sql.OPAQUE.toJdbc(OPAQUE.java:259)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:190)
         at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:117)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1578)
         at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:815)
         at hospitaltool.RunAsnIn.runAsnIn(RunAsnIn.java:41)
         at hospitaltool.HospitalTool.main(HospitalTool.java:38)
    Caused by: java.lang.ClassNotFoundException: oracle.xml.binxml.BinXMLMetadataProvider
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         ... 10 more
    Java Result: 1

Maybe you are looking for

  • How can I combine my SSD + HDD into ONE SSD?

    Hey everyone! I hope this isnt two technical but ill give it a whirl. I currently have a Macbook Pro 15" with a HDD in the Opitcal Drive (1TB) and a 120GB OWC SSD in the Hard Drive Bay. This created two different time machines on my Airport Time Caps

  • How to change mouse pointers?

    I would like to change the mouse pointer (from arrow to hourglass) while the application is doing a certain task. How is this done? thanks!

  • Seven year old iMac connection to cable

    I have a seven year old iMac. A friend would like it for her son, who has no computer but would like to connect to Optimum online. Is that possible considering the age of the computer?

  • DVD burner recommendations

    Hi. I have a dual G5 Mac running 10.4, and I'm looking for DVD burning software (besides iDVD). I need it to be able to: - burn 2-4 hours of video - source from avis or mpegs - build simple menus - (most importantly) burn a disk that will play correc

  • Meta tag keyword

    Is there a limit to the number of words you can put within the keywords section of the meta tags? What other ways can I promote good recongition by search engines?