Hi, The following program is servlet with Jdbc connection. Iam using oracle 9i as databse. There are no errors while compiling. When i run on tomcat server http://localhost/servlet/servletwithjdbc iam not getting any thing on explorer. Iam getting empty page. How can i run this program to get results. Program:
when you start Tomcat you have a dos window opened. Check there. In case you run it as service and don't have a window, check Tomcat log files.
Lakshmi siri
Ranch Hand
Joined: Feb 06, 2004
Posts: 44
posted
0
Hi, In console i saw the following error. Exception: oracle.jdbc.driver.OracleDriver Exception: null do i need to write any classpath? Thanks for your help. --Lakshmi
Welcome to the Ranch "lakshmi"! You'll find this forum a great place to seek help on servlets, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it. In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Thanks! bear Forum Bartender
To pin down the error, add e.printStackTrace() in try/catch.
Lakshmi siri
Ranch Hand
Joined: Feb 06, 2004
Posts: 44
posted
0
Hi, i add e.getStackTrace in the catch block catch(SQLException e) { e.getStackTrace(); } I got the following message on explorer.
type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception java.lang.NullPointerException servletwithjdbc.doGet(servletwithjdbc.java:32) javax.servlet.http.HttpServlet.service(HttpServlet.java:743) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:466) org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180) javax.servlet.http.HttpServlet.service(HttpServlet.java:743) javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs. --Lakshmi
danny liu
Ranch Hand
Joined: Jan 22, 2004
Posts: 185
posted
0
Use System.err.println("Ecception: "+e.getStackTrace());
In general, Oracle provide two drivers, are you using the correct one? Dan
danny liu
Ranch Hand
Joined: Jan 22, 2004
Posts: 185
posted
0
Check the following line con=connect(); check if con is null. If it is, then the connection is not build due to error parameters. Dan
"Lakshmi", Please see Bear's post above. Accounts with invalid display names get deleted. Please change your display name to something valid or your account will be deleted very soon. thanks, Dave.
Satheesh Chandra
Greenhorn
Joined: Feb 19, 2004
Posts: 2
posted
0
Hi, It following line shows that the line no 32 may have error. Please execute your qry as sql and check you sql is correct and returning atleast one row. servletwithjdbc.doGet(servletwithjdbc.java:32)
Lakshmi siri
Ranch Hand
Joined: Feb 06, 2004
Posts: 44
posted
0
Hi all, Now i got result.I set the classpath in Tomcat setclasspath.Now my program is running. Thanks for your help. --Lakshmi