Hi all this is my problem:


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

exception

org.apache.jasper.JasperException: Exception in JSP: /DAO.jsp:16

13:
14: Class.forName("oracle.jdbc.driver.OracleDriver");
15:
16: conn = DriverManager.getConnection("jdbc:oracle:thin:vincenzom86@localhost:1521:XE","xxx","xxx");
17:
18: Statement st = conn.createStatement();
19:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

javax.servlet.ServletException: No suitable driver found for jdbc:oracle:thin:vincenzom86@localhost:1521:XE


I use Oracle 10g and Tomcat for web server...i try all config for my connect driver but i'v always the same exception.
Thanks for the warning

Vincenzo

Recommended Answers

All 11 Replies

Place the Oracle Driver jar into tomcats common/lib directory.

thanks for the answer...i ve do it but always the same problem...i'm trying to download another driver.there' s some configuration for 1 xml file to do?because i've read something about server.xml file configuration.

Make sure it is actually the thin driver that you have, and not the oci driver. My first response was incorrect, ClassNotFound is classpath, no suitable driver is a misspelled url, or you have the oci driver installed rather than the thin driver.

Also, I don't believe you want username@hostname, but rather just hostname. i.e.

jdbc:oracle:thin://locahost:1521:dbName

Read the documentation for the driver you do have for the proper url.

masijade thanks for the attention.i've try to change the driver conn with:

jdbc:oracle:thin://PC280631275888:1521:XE","xxx","xxx"

but now i've this error:

14: Class.forName("oracle.jdbc.driver.OracleDriver");
15:
16: conn = DriverManager.getConnection("jdbc:oracle:thin://PC280631275888:1521:XE","vincenzom86","m0lf3tt4");
17:
18: Statement st = conn.createStatement();
19:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

javax.servlet.ServletException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl


i've see the listner.ora file and this is my config:

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = XE)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = XE)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server)
(PROGRAM = extproc)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(ADDRESS = (PROTOCOL = TCP)(HOST = PC280631275888)(PORT = 1521))
)
)

DEFAULT_SERVICE_LISTENER = (XE)


i've also try to reboot server and db but always the same...

Is this the url you're using

jdbc:oracle:thin://PC280631275888:1521:XE

Since you're not using code tags, I can't tell because you keep getting a "smilely" I don't recognise.

Seemingly, though, according to the error message

The Connection descriptor used by the client was:
localhost:1521:orcl

you are using:

jdbc:oracle:thin://localhost:1521:orcl

Maybe in another place in the code, or something?

no...i'use only this string :

[TEX]conn = DriverManager.getConnection("jdbc:oracle:thin://PC280631275888:1521:XE"[/TEX].

scuse me for the emoticons but i'dont know how to format the text..but is XE
i've read that seems to use orcl and not XE but i don't know where...!!!in the tnsnames.ora and listener.ora SID name are all = XE!!!

conn string here :

conn = DriverManager.getConnection("jdbc:oracle:thin://PC280631275888:1521:XE"


sorry again:'(

Surround your code (and the conn line from above) with code tags. i.e.

[code]SID[/code]

will appear as

SID

no...i'use only this string :

[TEX]conn = DriverManager.getConnection("jdbc:oracle:thin://PC280631275888:1521:XE"[/TEX].

scuse me for the emoticons but i'dont know how to format the text..but is XE
i've read that seems to use orcl and not XE but i don't know where...!!!in the tnsnames.ora and listener.ora SID name are all = XE!!!

Then, I can only say that you need to get the Oracle admins to check it out.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <title>DAO</title>
  </head>
  <body>

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

Connection conn = null;

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

conn = DriverManager.getConnection("jdbc:oracle:thin://PC280631275888:1521:XE","vincenzom86","xxx");

Statement st = conn.createStatement();

String Nome = new String (request.getParameter("Nome"));
String Cognome = new String (request.getParameter("Cognome"));
String Retrib_Prog = new String (request.getParameter("Retrib_Prog"));
String Retrib_Spese = new String (request.getParameter("Retrib_Spese"));
String Retrib_Stip_Fer = new String (request.getParameter("Retrib_Stip_Fer"));
String Retrib_Stip_Fest = new String (request.getParameter("Retrib_Stip_Fest"));
String Retrib_Rep = new String (request.getParameter("Retrib_Rep"));
String Retrib_Rep_Ore = new String (request.getParameter("Retrib_Rep_Ore"));
String Retrib_Pos_Cont = new String (request.getParameter("Retrib_Pos_Cont"));
String Retrib_Costo_Fiss = new String (request.getParameter("Retrib_Costo_Fiss"));
String Commenti = new String (request.getParameter("Commenti"));


  
st.executeUpdate("INSERT INTO ValContrattualiDipendenti VALUES ('"+Nome+"','"+Cognome+"','"+Retrib_Prog+"','"+Retrib_Spese+"','"+Retrib_Stip_Fer+"','"+Retrib_Stip_Fest+"','"+Retrib_Rep+"','"+Retrib_Rep_Ore+"','"+Retrib_Pos_Cont+"','"+Retrib_Costo_Fiss+"','"+Commenti+"')");

st.close();
conn.close();
%>
<br><br>
</font>
  </body>
</html>

ty for the info. this is all the .jsp code

Like I say, you need to talk to the admins.

Also, you mistakenly provided m0lf3tt4 in an earlier post, so I would suggest getting your password changed.

Also, this DB code should not be included in a jsp as a scriptlet. It should be placed in a bean. Also, since this seems to be something that takes action, rather than simply presenting data, it should be done by a servlet, not a JSP.

Actions are handled by servlets, data is handled by beans (and other classes outside of the JSP/Servlet classes), and JSP is for the presentation.

MVC

Model -- The Data. "External" objects such as Beans
View -- The Presentation. The delivery of the actual HTML. JSP
Control -- Essentially performing action requested by the user. Servlet.

Edit:

The sql stuff should also take place in a try block with the close lines being placed in the finally block, otherwise, you will leave behind open connections with this code and will soon run out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.