Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > java.lang.ClassNotFoundException: com.pointbase.jdbc.jdbcUniversalDriver

Reply
Thread Tools

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

 
 
paul
Guest
Posts: n/a
 
      07-15-2005
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.jdbcUniversalDri ver").newInstance();
String url = "jdbcointbase: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

 
Reply With Quote
 
 
 
 
theath
Guest
Posts: n/a
 
      07-15-2005
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?

 
Reply With Quote
 
 
 
 
paul
Guest
Posts: n/a
 
      07-16-2005
pbclient.jar under the pointbase directory and already set it in my
classpath.
same server ( i use tomcat) , same jdk.

 
Reply With Quote
 
John Currier
Guest
Posts: n/a
 
      07-18-2005
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

 
Reply With Quote
 
steve
Guest
Posts: n/a
 
      07-31-2005
On Fri, 15 Jul 2005 20:14:38 +0800, paul wrote
(in article <. com>):

> 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.jdbcUniversalDri ver").newInstance();
> String url = "jdbcointbase: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());
}
}
}





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57