Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    2

    Unanswered: Connectivity b/w JSP & Oracle XE

    Hi Guys,

    I need to develop network based inventory management system using JSP and Oracle.I've got Oracle XE installed on my system and Tomcat 5 server.

    The problem is i'm unable to connect Oracle.

    I'm using the following Javascript, as a test case.
    I've configured oracle XE to listen at 8081 and my db login & password is "abeer".

    Code:
    <%@ page import="java.lang.*" language="java"%>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    
    
    <%
    
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:8081:XE","abeer","abeer");
    Statement stmt=conn.createStatement();
    stmt.close();
    conn.close();
    
    %>
    As i try to run this script i get the error

    HTTP Status 500 -

    type Exception report

    message

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

    exception
    org.apache.jasper.JasperException: Exception in JSP: /simple.jsp:8

    5:
    6: <%
    7:
    8: Class.forName("oracle.jdbc.driver.OracleDriver");
    9: Connection conn = DriverManager.getConnection("jdbc: oracle:thin:@localhost:8081:XE","abeer","abeer");
    10: Statement stmt=conn.createStatement();
    11: stmt.close();


    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:504)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

    root cause
    javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver
    org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:858)
    org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:791)
    org.apache.jsp.simple_jsp._jspService(simple_jsp.j ava:64)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:332)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

    root cause
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1352)
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1198)
    org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:127)
    org.apache.jasper.servlet.JasperLoader.loadClass(J asperLoader.java:65)
    java.lang.ClassLoader.loadClassInternal(Unknown Source)
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Unknown Source)
    org.apache.jsp.simple_jsp._jspService(simple_jsp.j ava:52)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:332)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)


    I've set the enviorment variables as
    CLASSPATH=F:\oraclexe\app\oracle\product\10.2.0\se rver\classes12.jar
    JAVA_HOME = D:\jdk1.5.0_07

    Can anybody tell me why is this error occouring ???

    Best Regards,

  2. #2
    Join Date
    Jul 2006
    Posts
    8
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

    Tomcat 5 have not found your OracleDriver. Dont use the class path for the class files for DriverManager, copy the .jar / .zip files from your OraxXX/jdbc to the source WEB-INF/lib directory and deploy with it.

    Tomcat will find every class in the WEB-INF/lib jakarta source tree.

  3. #3
    Join Date
    Jul 2006
    Posts
    2
    Okay that helped, thanx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •