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

P

paul

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
 
T

theath

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?
 
P

paul

pbclient.jar under the pointbase directory and already set it in my
classpath.
same server ( i use tomcat) , same jdk.
 
J

John Currier

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
 
S

steve

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());
}
}
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top