java.lang.ClassNotFoundException: com.pointbase.jdbc.jdbcUniversalDriver

Discussion in 'Java' started by paul, Jul 15, 2005.

  1. paul

    paul Guest

    hi all,

    i am new to use servlet, however, i wrote the program below but the
    error shown as subject.

    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;

    public class InventoryServlet extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
    String id = req.getParameter("id");
    PrintWriter out = res.getWriter();
    try {
    // create a connection

    Class.forName("com.pointbase.jdbc.jdbcUniversalDriver").newInstance();
    String url = "jdbc:pointbase:server://localhost/mt811";
    String uid = "pbpublic";
    String pwd = "pbpublic";
    Connection Con = DriverManager.getConnection(url, uid, pwd);
    Statement stm = Con.createStatement();

    String sql = "SELECT * FROM Inventory";
    // get the customer info
    ResultSet result = stm.executeQuery(sql);

    out.println("<html><head><title>tsting</title></head></html>");
    out.println("<h2>database</h2>");
    while (result.next()) {
    // out.println(result.getString("Name"));
    // out.println(result.getInt("Quantity"));
    out.print(result.getInt("Quantity"));
    out.println(result.getString("InventoryID"));
    out.println(result.getString("Name"));
    }
    // Clean up
    result.close();
    stm.close();
    Con.close();

    } catch (Exception e) {
    out.println(e.toString());}
    }
    public void doPost(HttpServletRequest request, HttpServletResponse
    response)
    throws IOException, ServletException {
    doGet(request, response);
    }
    }

    the same driver , login, passwd can be used in another program and
    successfully.

    pls advise.

    paul
     
    paul, Jul 15, 2005
    #1
    1. Advertising

  2. paul

    theath Guest

    where is the jdbc jar relative to your app? on your other program, was
    it bundled in there with it, or is your jar in your appserver's lib
    directory?
     
    theath, Jul 15, 2005
    #2
    1. Advertising

  3. paul

    paul Guest

    pbclient.jar under the pointbase directory and already set it in my
    classpath.
    same server ( i use tomcat) , same jdk.
     
    paul, Jul 16, 2005
    #3
  4. paul

    John Currier Guest

    As theath indicated the exception is fairly descriptive in what's
    wrong: the classloader isn't able to find the class you're trying to
    load. Have you compared the configurations of the two Tomcat servers?
    One of them points to an appropriate pbclient.jar...one doesn't.

    John
    http://schemaspy.sourceforge.net
     
    John Currier, Jul 18, 2005
    #4
  5. paul

    steve Guest

    On Fri, 15 Jul 2005 20:14:38 +0800, paul wrote
    (in article <>):

    > hi all,
    >
    > i am new to use servlet, however, i wrote the program below but the
    > error shown as subject.
    >
    > import java.sql.*;
    > import java.io.*;
    > import java.util.*;
    > import javax.servlet.*;
    > import javax.servlet.http.*;
    >
    > public class InventoryServlet extends HttpServlet {
    > public void doGet(HttpServletRequest req, HttpServletResponse res)
    > throws ServletException, IOException {
    > String id = req.getParameter("id");
    > PrintWriter out = res.getWriter();
    > try {
    > // create a connection
    >
    > Class.forName("com.pointbase.jdbc.jdbcUniversalDriver").newInstance();
    > String url = "jdbc:pointbase:server://localhost/mt811";
    > String uid = "pbpublic";
    > String pwd = "pbpublic";
    > Connection Con = DriverManager.getConnection(url, uid, pwd);
    > Statement stm = Con.createStatement();
    >
    > String sql = "SELECT * FROM Inventory";
    > // get the customer info
    > ResultSet result = stm.executeQuery(sql);
    >
    > out.println("<html><head><title>tsting</title></head></html>");
    > out.println("<h2>database</h2>");
    > while (result.next()) {
    > // out.println(result.getString("Name"));
    > // out.println(result.getInt("Quantity"));
    > out.print(result.getInt("Quantity"));
    > out.println(result.getString("InventoryID"));
    > out.println(result.getString("Name"));
    > }
    > // Clean up
    > result.close();
    > stm.close();
    > Con.close();
    >
    > } catch (Exception e) {
    > out.println(e.toString());}
    > }
    > public void doPost(HttpServletRequest request, HttpServletResponse
    > response)
    > throws IOException, ServletException {
    > doGet(request, response);
    > }
    > }
    >
    > the same driver , login, passwd can be used in another program and
    > successfully.
    >
    > pls advise.
    >
    > paul
    >


    sloppy very sloppy !!

    } finally{
    closeports( Con,result, stm);
    }


    }

    public static void closeports(
    .........) {
    if (.. != null) {
    try {
    ...close();
    } catch (Exception ex) {
    out.println(ex.toString());
    }
    }

    if (... != null) {
    try {
    ...close();
    } catch (Exception ex) {
    out.println(ex.toString());
    }
    }

    if (.....!= null) {
    try {
    ..close();
    } catch (Exception ex) {
    out.println(ex.toString());
    }
    }
    }
     
    steve, Jul 31, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. zhao
    Replies:
    3
    Views:
    3,299
    Roedy Green
    Jul 16, 2003
  2. gmercer
    Replies:
    2
    Views:
    411
    HalcyonWild
    Apr 1, 2005
  3. Replies:
    3
    Views:
    11,771
  4. Replies:
    2
    Views:
    557
    freemind
    May 16, 2006
  5. steven acer
    Replies:
    14
    Views:
    1,122
    steven acer
    Jul 15, 2009
Loading...

Share This Page