jsp give me this error javax.servlet.ServletException: oracle.jdbc.driver.O

[nobr]Hi master

Sir I use orace 9i easily in java class with following code

===========

import java.sql.*;

public class ttst {

public ttst() {

public static void main (String args [])

{

try{

Class.forName("oracle.jdbc.driver.OracleDriver");

Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");

Statement stmt = conn.createStatement();

ResultSet rset = stmt.executeQuery("select accid from accbal where accid='K1101'");

System.out.println ("going for connection");

while (rset.next())

s= rset.getString("accid");

System.out.println (s);

}

catch(Exception e){

e.printStackTrace();

}

}

system give me right result

and when I use jsp with this code

<HTML>

<%@ page import="java.sql.*,java.util.*" %>

<% String url="jdbc:oracle:thin:@fahim:1521:aamir";

Connection con;

Statement stmt;

ResultSet rs;

Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();

con = DriverManager.getConnection(url,"muhammad","mfa786");

stmt=con.createStatement();

%>

<%

%>

<select name="ltpid">

<%

try{

rs= stmt.executeQuery("select accid,title from chartofacc");

while (rs.next()){

%>

<option Value=<%=rs.getString(1)%>> <%=rs.getString(2) %> </option>

<%

}

}

catch(Exception e){}

%>

</select>

TEST DONE!

</HTML>

sir I have class12.zip and class11.zip I same folder

but system give me this error

Apache Tomcat/4.0.6 - HTTP Status 500 - Internal Server Error

type Exception report

message Internal Server Error

description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver

at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471)

at org.apache.jsp.bistest$jsp._jspService(bistest$jsp.java:128)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:173)

at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:246)

at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:226)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:148)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)

at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)

at java.lang.Thread.run(Thread.java:534)

root cause

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

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1406)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1254)

at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:198)

at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:141)

at org.apache.jsp.bistest$jsp._jspService(bistest$jsp.java:70)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:173)

at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:246)

at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:226)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:148)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)

at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)

at java.lang.Thread.run(Thread.java:534)

but jsp page not run

please give me idea how I how my oracle data in jsp page

thank

aamir

[/nobr]

[10314 byte] By [mfa786a] at [2007-11-26 15:54:46]
# 1
the ojdbc14.jar is not in your classpath.. ojdc14.jar/classes.jar are the drivers for oracle database
jgalacambraa at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
>sir I have class12.zip and class11.zip I same folderdo not place them in the same folder.place it under <WEB_APPLICATION> \ WEB-INF\ lib folder & try it out again....REGARDS,RaHuL
RahulSharnaa at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
thank you for your replysir i past both file in me applecato folder f:\fahim "i past ojdbc14.jar and ojdbc14.jar.zip in same but not run page"but jsp page not runplease give me idea how i run my pagethank's aamir
mfa786a at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
it seems that you are using netbeans, try to find the answer in on this [url http://www.netbeans.org/kb/50/using-netbeans/index.html]site[/url]
jgalacambraa at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Thank you for your replySir I cod not understand with under <WEB_APPLICATION> \ WEB-INF\ lib folder your codeHow I use this in jsp for oracle connectionPlease give me idea how show oracle data in jsp pagethank youaamir
mfa786a at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
what the other poster suggest is putting the ojdbc14.jar in the WEB-INF/lib directory of your application.. it doesn't have to do with the codings
jgalacambraa at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

sir thank you very much

i putting the ojdbc14.jar in the WEB-INF/lib directory

the jsp page show data on my computer

but when i run ths page on other computer the page run and show lable and button but not show oracle data

i put my jsp file in inetpubwwwroot and use following command in browser

http://localhost\fahim.jsp

browser run page not give any error but not show the oracle data

how i show my oracle data in client computer i am use local network or work group

please give me idea

thank

aamir

mfa786a at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
you mean, the application was access by your peer on your network?firewall on your machine must be down and accessing your apps must be like this: http://<your-ip-address>/myapp/yourJsps.jsp http://<your-pc-host-Name>/myapp/yourJsps.jsp
jgalacambraa at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9

sir thank you for your reply

sir i am understand with ip-adress and myjspfile.jsp

but i am not understand with /myapp what is this or which folder name

or it my inetpub name

that is this

please guid me

thank you

aamir

http://<your-ip-address>/myapp/yourJsps.jsp

http://<your-pc-host-Name>/myapp/yourJsps.jsp

mfa786a at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10

hi master

sir i use this command in client browser

http://fahim.iqra.edu.pk/WebDB/bistest.jsp

but client browser give me this error

Database Log In Failed

TNS could not resolve service name

Verify that the TNS name in the connectstring entry of the DAD for this URL is valid.

please give me idea how i show data in jap page

thank's

aamir

mfa786a at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11
on your machine where your db is installed, start the tnslistener of your database, make sure that your connection string is pointing to that machinejdbc:oracle:thin:@<ip or hostname of machine where your db is installed>:1521:aamir
jgalacambraa at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 12
sir thank you for your reply sir how i check and start my tnslistener where i check and edit my required code please give me idea and step thankaamir
mfa786a at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 13

the tnslistener is a database thing ask your DBA on how to start it, if you you are using windows, go to control panel/administrative tools-->services then look for oracle...listener, then start it, now for unix like OS you can search [url http://www.google.com.ph/search?q=starting+oracle+tnslistener&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a]google[/url]

jgalacambraa at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 14

sir i post my problem but they reply me it java problem not oracle problem

*** oracle reply**********

You metioned that you use

jdbc:oracle:thin:@<ip or hostname of machine where your db is installed>: 1521:aamir , description to connect the remote database. So, I think it's not related to your tnsname.ora problem. It's only java oracle thin connection string. Please check this string, make sure the ip and database service name is right.

one more thing, use sqlplus check your tnsname.ora, if ok, then try to check jdbc and make sure the jdbc driver match to oracle server.

*********************

sir please give me idea how i show my oracle data in clinet browser

thank's

aamir

mfa786a at 2007-7-8 22:15:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 15

the problem that you have is to broad to look at.. it will be easier if you will post the stack trace.. i cannot tell if that is a database thing or the connection string has wrong parameters on it: jdbc connection string must be look like this:

jdbc:oracle:thin:@<hostname>:<port>:<SID>

example:

jdbc:oracle:thin:@192.168.0.1:1521:Scott

jdbc:oracle:thin:@MyComputerName:1521:Scott

jgalacambraa at 2007-7-21 16:36:42 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...