CastException: Tomcat 4.1.27, Oracle 9i, dbcp

I have Tomcat 4.2.17 running and try to configure dbcp to access my Oracle 9i database. I exactly configured my server.xml and web.xml like in http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html explained for a Oracle 8i database. When I start Tomcat, I get the message "java.lang.ClassCastException: org.apache.commons.dbcp.BasicDataSource" in my error logs. Does anyone have an idea what the reason for these problem is?
Thanks in advance, Peter

Not based on what you've posted.
I've got a Web app running under Tomcat 4.1.27 that connects to Oracle 9i via a JNDI data source just fine, so I know it works.
"...I exactly configured my server.xml and web.xml..." - sounds like something is still incorrect. - MOD

Similar Messages

  • Tomcat 5.5.20 / Oracle  JDBC connection error

    Hi All,
    I am using Eclipse 3.2/ Tomcat 5.5.20/ Oracle 8i
    Inside my java class; right after finding the context, it gives error on line:
    conn = dataSource.getConnection();
    my server.xml <Resource> settings are proper within one tag...
    I am loosing my hair faster... please someone help me..
    Error Stack:
    javax.servlet.ServletException
         org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NullPointerException
         com.nibtt.beans.ConnectionBean.getConnection(ConnectionBean.java:80)
         com.nibtt.actions.LoginAction.execute(LoginAction.java:44)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Regards
    Hepzi

    Hi Zadok,
    I am going insane. Thank God you replied. I am pasting my code here.
    I have setup Tomcat5.5.20 <resource> tag as follows: for connection pooling
    <Resource      name="jdbc/TestStrutsDB" auth="Container"
              type="javax.sql.DataSource" factory="org.apache.commons.dbcp.BasicDataSourceFactory"
              username="SCOTT" password="TIGER"
              driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@111.1.1.1:1521:TEST"
              maxActive="8" maxIdle="4"/>
    my application web.xml code:
    <resource-ref>
    <description>Oracle DB Connection</description>
    <res-ref-name>jdbc/TestStrutsDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    my java code:
    public Connection getConnection() throws Exception{
              Context ctx = new InitialContext();
    Context envContext = (Context)ctx.lookup("java:/comp/env");
    javax.sql.DataSource dataSource = null;
         ResultSet rst = null;
         Statement stmt = null;
         try {
              if(envContext == null ) {
         System.out.println( "context is NULL");
              } else
         System.out.println( "context is NOT NULL");
    dataSource = (javax.sql.DataSource)envContext.lookup("jdbc/TestStrutsDB");
              if (dataSource != null) {
                   System.out.println( "before actual connection to database: "+dataSource.toString() );
                   try {
                        conn = dataSource.getConnection();
                   } catch (Exception connEx) {
                        System.out.println( connEx.getStackTrace());
              if(conn != null) {
         System.out.println( "Got Connection "+conn.toString());
         stmt=conn.createStatement();
         rst=stmt.executeQuery("select username from testTomcat");
         while(rst.next()){
              System.out.println("User Name is: " + rst.getString("username"));
         rst.close();
         rst = null;
         stmt.close();
    stmt = null;
    conn.close();
         conn = null;
         // do what you wish with Connection
         } catch (SQLException e) {
              while((e = e.getNextException()) != null) {
                        System.out.println("SQLException: " + e.getMessage());
                        System.out.println("SQLState: " + e.getSQLState());
                        System.out.println("VendorError: " + e.getErrorCode());
                        System.out.println(e.getStackTrace());
         } finally {
         try {
         conn.close();
         } catch (SQLException ex) {
              System.out.println(ex.getStackTrace());
              return conn;
         } //End of Connection function
    Please let me know if had gone wrong somewhere
    Thanks in advance
    Regards
    Hepzi

  • Tomcat 4.0 and Oracle 10g takes 100% CPU and grinds to a halt

    Hi, I have a system to support that is currently running on Tomcat 4.0 on a Windows Server 2003 R2 SP2 machine with 3.06Ghz, 4Gb Memory, 2Gb Page file connecting to an Oracle 8.1.6 database on a Windows NT 4 virtual server with 3.2Ghz, 1152Mb Memory, 1536Mb Page file.
    I have another Windows virtual server 2003 R2 SP2 machine with 2Gb of memory and a 4Gb page. This server has Tomcat 4.0 and an Oracle 10.2.0.3.0 database. I have made sure that the Oracle 10g classes12.jar file is used.
    I am trying to run the application on the new server. In some tests I had users logging on one by one for the first 5 users - performance was great and the application ran faster than the current live system. When I then got another 10 - 15 people logging on the CPU stuck at 100% on the server, even exploring the server was almost impossible, and the application slowed down to unworkable.
    We dont know if the problem lies with the very fact that we are trying to connect to a 10g database which is cost based and the application was written using rule based Oracle 8. Or is it the virtual server? Or is it the fact that we have both the application and the database on the same server.
    I dont know if it is possible to have another Tomcat4.0 server running on our live server but connecting to the 10g database - what would happen with classes12.zip and classes12.jar? would there be a conflict?
    I would really appreciate some help here. You should know though that I am not a hardened java programmer - I can dabble, but am an Oracle Forms, Reports, Discoverer, SQL person by trade. I am also a trainee DBA, so again am not an expert by any means.
    Thanks in advance for your help
    Lizzie

    lizzie8 wrote:
    Hi, I have a system to support that is currently running on Tomcat 4.0 on a Windows Server 2003 R2 SP2 machine with 3.06Ghz, 4Gb Memory, 2Gb Page file connecting to an Oracle 8.1.6 database on a Windows NT 4 virtual server with 3.2Ghz, 1152Mb Memory, 1536Mb Page file.Tomcat 4? We're up to Tomcat 6. The important difference is the JDK supported. What JDK are you using for Tomcat?
    >
    I have another Windows virtual server 2003 R2 SP2 machine with 2Gb of memory and a 4Gb page. This server has Tomcat 4.0 and an Oracle 10.2.0.3.0 database. I have made sure that the Oracle 10g classes12.jar file is used.classes12.jar is pretty old technology. The JAR should match your JDK and version of Oracle.
    I am trying to run the application on the new server. In some tests I had users logging on one by one for the first 5 users - performance was great and the application ran faster than the current live system. When I then got another 10 - 15 people logging on the CPU stuck at 100% on the server, even exploring the server was almost impossible, and the application slowed down to unworkable.You don't say anything about the whether or not you're using a connection pool or what's happening to the open connections and cursors. If you find that those are drifting up over time, it's likely that the code isn't closing resources properly.
    We dont know if the problem lies with the very fact that we are trying to connect to a 10g database which is cost based and the application was written using rule based Oracle 8. Or is it the virtual server? Or is it the fact that we have both the application and the database on the same server.Database and app server should be separated, IMO.
    I dont know if it is possible to have another Tomcat4.0 server running on our live server but connecting to the 10g database - what would happen with classes12.zip and classes12.jar? would there be a conflict?
    I would really appreciate some help here. You should know though that I am not a hardened java programmer - I can dabble, but am an Oracle Forms, Reports, Discoverer, SQL person by trade. I am also a trainee DBA, so again am not an expert by any means.You need more data. Get some tools to see where the time is being spent. Start monitoring your Oracle connections and cursors to see what's going on. Install some filters to get raw timings on your Java calls. Without data, you're guessing in the dark.
    %

  • JNDI lookups on Tomcat 5.5 and Oracle XE

    Hi there!
    I'm using Oracle 10g XE and Tomcat 5.5.9. I just wanna get advice on how to do JNDI lookups. I know XE doesn't have native support for Java and servlets and I noticed the "jndi.jar" file is missing in XE, unlike in Oracle 10g EE. Is "jndi.jar" required for JNDI functionality on XE, or can I just use Tomcat's JNDI functionality to do the lookups? Any input would be appreciated. Tnx!
    Leslie

    Hmmm
    After some search and restart the oracle-xe and checking the "alert_XE.log" file I found some strange!
    Some lib files was missing (no link was made in the /usr/lib path)
    And the dbf file "/usr/lib/oracle/xe/oradata/XE/control.dbf" was missing......
    I remove the installation (rpm -e oracle-xe)
    and then reinstall it.
    Run the config and now I can access the host!
    It seams that the installation scripts is not perfect!
    I hope this will help some other.
    //TEW

  • Tomcat 5 con pool, Oracle, servlet error on Connection ocon = ds.getConnect

    Hello,
    I am trying to create a connection pool to my Oracle db using the documentation provided for
    Tomcat 5. In the servlet shown below, the servlet fails at this line:
    Connection ocon = ds.getConnection();
    The servlet stops with no error message. Also, I'm not sure what is supposed to go in
    this line:
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    which may be where the real problem begins. Any suggestions are greatly appreciated.
    Here is the servlet:
    package CraigsClasses;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import java.net.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.Date;
    import java.text.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    public class CraigsMain extends HttpServlet {
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    // Process the http Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException {
    try {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    Context initContext = new InitialContext();
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    DataSource ds = (DataSource)envContext.lookup("jdbc/CraigsList");
    Connection ocon = ds.getConnection();
    String sql = "select formtitle from checkboxforms where cbformid = 157";
    PreparedStatement pStmt = ocon.prepareStatement(sql);
    ResultSet rs1 = pStmt.executeQuery();
    rs1.next();
    out.println("<br><br><br>" + rs1.getString(1) + "<br>");
    } catch(SQLException sqle) {
    System.err.println("sql exception error: " + sqle);
    } catch(NamingException sqln) {
    System.err.println("naming exception error: " + sqln);
    // A post request calls the get request because they do the same thing
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    Thank you,
    Logan

    Hello,
    I am trying to create a connection pool to my Oracle db using the documentation provided for
    Tomcat 5. In the servlet shown below, the servlet fails at this line:
    Connection ocon = ds.getConnection();
    The servlet stops with no error message. Also, I'm not sure what is supposed to go in
    this line:
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    which may be where the real problem begins. Any suggestions are greatly appreciated.
    Here is the servlet:
    package CraigsClasses;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import java.net.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.Date;
    import java.text.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    public class CraigsMain extends HttpServlet {
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    // Process the http Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException {
    try {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    Context initContext = new InitialContext();
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    DataSource ds = (DataSource)envContext.lookup("jdbc/CraigsList");
    Connection ocon = ds.getConnection();
    String sql = "select formtitle from checkboxforms where cbformid = 157";
    PreparedStatement pStmt = ocon.prepareStatement(sql);
    ResultSet rs1 = pStmt.executeQuery();
    rs1.next();
    out.println("<br><br><br>" + rs1.getString(1) + "<br>");
    } catch(SQLException sqle) {
    System.err.println("sql exception error: " + sqle);
    } catch(NamingException sqln) {
    System.err.println("naming exception error: " + sqln);
    // A post request calls the get request because they do the same thing
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    Thank you,
    Logan

  • Tomcat: java.lang.NoClassDefFoundError: oracle/sql/NUMBER

    hi,
    i have managed to come this far with my "simple" webapplication under tomcat.
    the exception is:
    java.lang.NoClassDefFoundError: oracle/sql/NUMBER
    since i have tried to put the classes12.jar in every reasonable directory without effect, i have to bother this forum. does anyone know "where the dog is burried"(german saying)?
    greetz
    Selim Keser

    Hi yves,
    This class is in the jdev_home/jdbc.lib/ojdbc14.jar.
    But prior to deploying your ADF application, did you install the ADF runtime libraries to Tomact as explained here?:
    http://www.oracle.com/webapps/online-help/jdeveloper/10.1.3?topic=j2ee_ptomcatdeploy_html
    Thanks
    Prasanth

  • Tomcat can't find oracle classes12.jar what to do?

    hi,
    i have managed to come this far with my "simple" webapplication under tomcat that i can see the application startpage but when i click browse the following
    exception is thrown:
    java.lang.NoClassDefFoundError: oracle/sql/NUMBER
    since i have tried to put the classes12.jar in every reasonable directory without effect, i have to bother this forum. does anyone know "where the dog is burried"(german saying)?
    greetz
    Selim Keser

    I'm sorry I wasn't clear.
    I have a feeling you might not have to do this because you wouldn't have gotten so far without knowing how.
    "chown" is a command in UNIX like systems to change the owner of a file or directory.
    When I was having problems similar to yours, I noticed that all of the files that I copied onto my server listed the owner as root and the group as root.
    The version of Tomcat I am running on Linux requires that the files be owned by "apache". So by changing to the directory where the files in question are located, you can run the UNIX command "chown apache:apache *" and it will change the owner/group to apache.
    If you're running in some other OS (Windows) I can't really help since I've never successfully installed and invoked Tomcat on Windows.
    HTH.
    Thanks, George

  • Connection Problem with Oracle and Tomcat.

    I was able to enter Oracle using scott/tiger when I did not connect Tomcat.But when I connect tomcat I am unable to log onto Oracle.
    When I logged to the database then I tried to start the Tomcat but it gave an exception.So I went to the task manager and ended the running processes like isqlplus.exe, oracle.exe, tomcat.exe, apache.exe.When I ended all the processes except oracle.exe, tomcat gave an exception. But when I ended oracle.exe Tomcat started working but Oracle stopped working. I don't know what the problem is.
    Can anyone help me out?
    Thanks,
    Sravanthi.

    > Can anyone help me out?
    Yeah sure. Is there a SQL or PL/SQL related question in there.. somewhere.. hiding away?
    After all, you do realise that the name of this forum is SQL and PL/SQL and that it deals with the SQL and PL/SQL languages in the Oracle server.. right?

  • Oracle 8i jdbc/Tomcat connection issues

    Tomcat 4.1.8
    Oracle 8i JDBC Driver
    I have been able to create the DataSource as a global resource and as a local resource inside the context of the application.
    The code hangs when it attempts to create a connection. I have been able to connect to the database and perform the necessary query in a standalone application to ensure that I actually can connect.
    JSP Code:
    <html>
    <head>
    <title>VTW App</title>
    </head>
    <body>
    <%
    vtw.VTWApp tst = new vtw.VTWApp();
    tst.init();
    %>
    <h2>Results</h2>
    <%= tst.getList() %>
    </body>
    </html>
    Java Code (Class called by JSP):
    package vtw;
    import javax.naming.*;
    import javax.sql.*;
    import java.sql.*;
    public class VTWApp {
    String list = "EMPTY";
    public void init() {
    try{
    Context ctx = new InitialContext();
    if(ctx == null )
    throw new Exception("Boom - No Context");
    System.out.println("Context Created ...");
    DataSource ds =
    (DataSource)ctx.lookup(
    "java:comp/env/jdbc/oracleDB");
    if (ds != null) {
              System.out.println("DataSource Created ...");
    Connection conn = ds.getConnection();
    System.out.println("Connection Pulled");
    if(conn != null) {
                   System.out.println("Connection Good");
                   Statement st = conn.createStatement();
                   String query = "";
                   query += "select grpid, to_char(min(dtlastendtime),'mm-dd-yyyy hh24:mi:ss') ";
                   query += "from calc_table where equipmentsernum in (";
                   query += "'888000','888001'";
                   query += ") group by grpid";
                   ResultSet rs = st.executeQuery(query);
                   if(rs != null) {
                        list = "";
                        while(rs.next()) {
                             list += (rs.getString(1) + "," + rs.getString(2));
                   rs.close();
                   conn.close();
                   System.out.println("Connection Closed");
              } else {
                   System.out.println("Connection Not Established");
    }catch(Exception e) {
    e.printStackTrace();
    public String getList() { return list; }
    }

    I figured out the issue ...
    In the server.xml file the resource & resource params needed to be modified..
    1. Set type to oracle.jdbc.pool.OracleDataSource
    2. Set factory to oracle.jdbc.pool.OracleDataSourceFactory
    3. In the Java code cast the context lookup to an OracleDataSource instead of a java.sql.DataSource
    Oracles DataSource does not subclass the jdbc DataSource for its OracleDataSource class everything works fine now.
    <Resource name="jdbc/mydb" scope="Shareable" type="oracle.jdbc.pool.OracleDataSource"/>
    <ResourceParams name="jdbc/mydb">
    <parameter>
    <name>validationQuery</name>
    <value></value>
    </parameter>
                   <parameter>
                        <name>factory</name>
                        <value>oracle.jdbc.pool.OracleDataSourceFactory</value>
                   </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>oracle.jdbc.driver.OracleDriver</value>
    </parameter>
    <parameter>
         <name>url</name>
         <value>jdbc:oracle:thin:@server.company.com:1521:dbname</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>guest</value>
    </parameter>
                   <parameter>
                        <name>maxWait</name>
                        <value>10000</value>
                   </parameter>
                   <parameter>
                        <name>maxActive</name>
                        <value>100</value>
                   </parameter>
    <parameter>
    <name>user</name>
    <value>guest</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>2</value>
    </parameter>
    </ResourceParams>

  • Old Oracle Session with Tomcat is not kiiling automatically

    Hi,
    I am facing a problem of increasing inactive oracle sessions with tomcat, Old Oracle sessions with tomcat are visible with new one.
    if somebaody did not restarted tomcat gracefully, then does Oracle keep the session connected or is there any way that whenever any one restarted tomcat abnormally, Oracle session can be killed.
    I had restart the database to kill session.

    Could you please tell me that where do i set this parameter in parameter file or sql net file and what is the recommended value, do you have any document on this.
    Another thing tomcat is in other server machine and my database is in different server machine, killing process in tomcat server machine manually may not kill linux process on oracle database machine and therefore oracle sessions are still there.
    Is it possible?
    Edited by: user605066 on 28-Aug-2008 04:59

  • Tomcat 7 and Oracle 11g

    Hello Everyone,
    I am facing a strange issue with tomcat 7 connectivity with Oracle 11g. I am using the below versions
    JDK1.7.0_03
    Tomcat 7
    Oracle 11g
    I used to connect to oracle9 with the thin driver, everything was fine, but when I try to connect to 11g, tomcat throws the error CONNECTION REFUSED. I created a seperate standalone java application to test the connection with the same peice of code, and I can see Oracle sends the connection, but with Tomcat 7 it throws the error. I have placed all the correct jar files in the tomcat lib directory and classpath. I am little lost as it works well as an individual application but not from Tomcat. No exception or other error is thrown by Tomcat
    Can anyone help me on this
    Thanks in advance

    926901,
    I am havnig what I think is a very similar issue. I am brand new to java and to configuring any kind of server at all. I am using the versions below:
    JDK 1.7.0_04 - on my local machine
    JRE 7 - on my local machine
    Tomcat 7 - installed on my local machine
    Oracle 11g - on a different server on my company's network
    I created a login page using scriptlets in a jps file and could connect using the following, but it is not on a tomcat server (on my company's development box):
    String dbURL = "jdbc:oracle:thin:@10.5.20.101:1521:myDB";
    String dbUser = "*****";
    String dbPass = "*****";
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection(dbURL,dbUser,dbPass);
    I am now trying to do the same login, connecting to the same DB (same url/UN/PW) using servlets from the tomcat server on my machine. I am writing the code in Eclipse also, and have pointed eclipse to the JDK and JRE folders. You mentioned that you have placed all the correct jar files in tomcat lib directory. Would you please tell me what jar files you used? I am finding a lot of people saying I need to put the oracle driver into the WEB-INF/lib folder directly in the specific web app, and some say it is fine in the tomcat lib folder, and I am seriously frustrated with it. I am not sure if I should be using the class12.jar file or the ojbdc14.jar file either. Please, any advice you can give me would be appreciated. I have been going in circles for days and nothing seems to let me connect to the DB from a servlet running in Eclipse on tomcat. The code I am trying to use on tomcat in the servlet is:
    import java.sql.*;
    import java.util.*;
    import oracle.jdbc.*;
    public class ConnectionManager
         static Connection con;
         static String dbURL;
         public static Connection getConnection()
              try
                   String dbURL = "jdbc:oracle:thin:@//10.5.20.101:1521:myDB";
                   String dbUser = "*****";
                   String dbPass = "*****";
                   // assuming "DataSource" is your DataSource name
                   Class.forName("oracle.jdbc.OracleDriver");
                   DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
                   //try
                        con = DriverManager.getConnection(dbURL,dbUser,dbPass);
                   //catch (SQLException ex)
                   //     ex.printStackTrace();
              catch(ClassNotFoundException e)
                   System.out.println(e);
              return con;
    }

  • Running JSP on TOMCAT 7.0.50 cannot Oracle 12c on Windows 8.1 returns ORA-12505

    I have installed and configured and using JSP, Tomcat 7.0.50 , Oracle 12c running Windows 8.1
    Oracle driver - ojdbc7.jar
    I am running a basic JSP test which is failing with
    Basic Test SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    This is weird because I can connect using sqlplus
    SQL> conn dreamhome/dreamhome@pdborcl
    Connected.
    I can also connect using system to ORCL (as system). Howver PDBORCL is still  failing through TOMCAT
    JSP Connection call
    <%@ page import="java.sql.*" %>
    Basic Test
    <%
        Connection conn = null;
        try
            Class.forName("oracle.jdbc.driver.OracleDriver");
            conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:pdborcl", "dreamhome", "dreamhome");
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM dreamhome_users");
            //Print start of table and column headers out.println("");
            out.println("");
            out.println(" "); //Loop through results of query.
            while(rs.next())
                out.println("");
                out.println("LOGIN_ID USERNAME            PASSWORD" + rs.getString("LOGIN_ID") + "    " + rs.getString("USERNAME") + "    " + rs.getString("PASSWORD") + "");           
    TNSPING
    ..\product\12.1.0\dbhome_1\NETWORK\ADMIN>tnsping pdborcl
    TNS Ping Utility for 64-bit Windows: Version 12.1.0.1.0 - Production on 16-JAN-2
    014 05:41:15
    Copyright (c) 1997, 2013, Oracle.  All rights reserved.
    Used parameter files:
    ..\product\12.1.0\dbhome_1\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdborcl)))
    OK (10 msec)
    ..\product\12.1.0\dbhome_1\NETWORK\ADMIN>
    TNSNAMES.ORA (extract)
    ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
    PDBORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = pdborcl)
    Database queries
    SQL> select PDB from v$services;
    PDB
    PDBORCL
    CDB$ROOT
    CDB$ROOT
    CDB$ROOT
    CDB$ROOT
    SQLPLUS example
    SQL> conn dreamhome/dreamhome@pdborcl
    Connected.
    A working example
    <%
        Connection conn = null;
        try
            Class.forName("oracle.jdbc.driver.OracleDriver");
            conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:orcl", "system", "password");
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM dreamhome_users");
            //Print start of table and column headers out.println("");
            out.println("");
            out.println(" "); //Loop through results of query.
            while(rs.next())
    Basic Test SQLException: ORA-00942: table or view does not exist
    Failing example
    <%
        Connection conn = null;
        try
            Class.forName("oracle.jdbc.driver.OracleDriver");
            conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:pdborcl", "system", "password");
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM dreamhome_users");
            //Print start of table and column headers out.println("");
            out.println("");
            out.println(" "); //Loop through results of query.
            while(rs.next())
                out.println("");
                out.println("LOGIN_ID USERNAME            PASSWORD" + rs.getString("LOGIN_ID") + "    " + rs.getString("USERNAME") + "    " + rs.getString("PASSWORD") + "");           
    Basic Test SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    TOMCAT config files
    server.xml extract
    <Resource name="jdbc/Oracle12C"
    auth="Container"
    type="oracle.jdbc.pool.OracleDataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    factory="oracle.jdbc.pool.OracleDataSourceFactory"
    url="jdbc:oracle:thin:@localhost:1521:pdborcl"
    user="dreamhome"
    password="dreamhome"
    maxActive="20"
    maxIdle="10"
    maxWait="-1" />
    Any suggestions?

    I have installed and configured and using JSP, Tomcat 7.0.50 , Oracle 12c running Windows 8.1
    Oracle driver - ojdbc7.jar
    I am running a basic JSP test which is failing with
    Basic Test SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    This is weird because I can connect using sqlplus
    SQL> conn dreamhome/dreamhome@pdborcl
    Connected.
    I can also connect using system to ORCL (as system). Howver PDBORCL is still  failing through TOMCAT
    JSP Connection call
    <%@ page import="java.sql.*" %>
    Basic Test
    <%
        Connection conn = null;
        try
            Class.forName("oracle.jdbc.driver.OracleDriver");
            conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:pdborcl", "dreamhome", "dreamhome");
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM dreamhome_users");
            //Print start of table and column headers out.println("");
            out.println("");
            out.println(" "); //Loop through results of query.
            while(rs.next())
                out.println("");
                out.println("LOGIN_ID USERNAME            PASSWORD" + rs.getString("LOGIN_ID") + "    " + rs.getString("USERNAME") + "    " + rs.getString("PASSWORD") + "");           
    TNSPING
    ..\product\12.1.0\dbhome_1\NETWORK\ADMIN>tnsping pdborcl
    TNS Ping Utility for 64-bit Windows: Version 12.1.0.1.0 - Production on 16-JAN-2
    014 05:41:15
    Copyright (c) 1997, 2013, Oracle.  All rights reserved.
    Used parameter files:
    ..\product\12.1.0\dbhome_1\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdborcl)))
    OK (10 msec)
    ..\product\12.1.0\dbhome_1\NETWORK\ADMIN>
    TNSNAMES.ORA (extract)
    ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
    PDBORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = pdborcl)
    Database queries
    SQL> select PDB from v$services;
    PDB
    PDBORCL
    CDB$ROOT
    CDB$ROOT
    CDB$ROOT
    CDB$ROOT
    SQLPLUS example
    SQL> conn dreamhome/dreamhome@pdborcl
    Connected.
    A working example
    <%
        Connection conn = null;
        try
            Class.forName("oracle.jdbc.driver.OracleDriver");
            conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:orcl", "system", "password");
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM dreamhome_users");
            //Print start of table and column headers out.println("");
            out.println("");
            out.println(" "); //Loop through results of query.
            while(rs.next())
    Basic Test SQLException: ORA-00942: table or view does not exist
    Failing example
    <%
        Connection conn = null;
        try
            Class.forName("oracle.jdbc.driver.OracleDriver");
            conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:pdborcl", "system", "password");
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM dreamhome_users");
            //Print start of table and column headers out.println("");
            out.println("");
            out.println(" "); //Loop through results of query.
            while(rs.next())
                out.println("");
                out.println("LOGIN_ID USERNAME            PASSWORD" + rs.getString("LOGIN_ID") + "    " + rs.getString("USERNAME") + "    " + rs.getString("PASSWORD") + "");           
    Basic Test SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    TOMCAT config files
    server.xml extract
    <Resource name="jdbc/Oracle12C"
    auth="Container"
    type="oracle.jdbc.pool.OracleDataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    factory="oracle.jdbc.pool.OracleDataSourceFactory"
    url="jdbc:oracle:thin:@localhost:1521:pdborcl"
    user="dreamhome"
    password="dreamhome"
    maxActive="20"
    maxIdle="10"
    maxWait="-1" />
    Any suggestions?

  • Oracle driver jdbc

    hi,
    I have problems to use it ojdbc14.jar with tomcat 4.1 and oracle 9i 2.0.
    I configured server.xml with tag <ResourceParams> ....
    and web.xml with the tag <resource-ref>.
    The lib common/lib contains ojdbc14.jar commons-collections.jar, commons-dbcp-1.1.jar and
    commons-pool-1.1.jar.
    the context of the web application is found and the name jndi too. But I always have the message
    "Cannot create JDBC driver of class 'oracle.jdbc ... ' for connect URL '...'" when I recover connection
    somebody already encountered this problem?
    help!!!
    thank you

    oracle.jdbc.driver.OracleDriver is located in the JDBC classes file. You don't say what platform you are using but for Solaris 7, I have 8.0.5 JDBC drivers installed with the 8.0.5 client. In this case, I modified my CLASSS_PATH env variable to include $ORACLE_HOME/jdbc/lib/classes111.zip. You also need to add $ORACLE_HOME/lib and $ORACLE_HOME/jdbc/lib to the LD_LIBRARY_PATH env variable.
    If you have your database configured using Net8 (and thus in tnsnames.ora), you just need to specify the service name. Go to the documentation section of this site and locate the "Oracle8i JDBC Developer's Guide and Reference".

  • DBCP borrowObject failed: java.sql.SQLException: Io exception: The Network

    My web application connection to Oracle is successful and displays proper output but sometimes i get this error and then i am not able to login to application.But again if I try logging in after sometime then there's no error and application works fine.
    Can anyone advice me on why only sometimes I get the error
    DBCP borrowObject failed: java.sql.SQLException: Io exception: The Network .I am using tomcat server and jdbc:oracle:thin driver for connect
    Thanks .
    Pallavi

    My web application connection to Oracle is successful
    and displays proper output but sometimes i get this
    error and then i am not able to login to
    application.But again if I try logging in after
    sometime then there's no error and application works
    fine.
    Can anyone advice me on why only sometimes I get the
    error
    DBCP borrowObject failed: java.sql.SQLException: Io
    exception: The Network .I am using tomcat server and
    jdbc:oracle:thin driver for connect
    Thanks .
    PallaviIt seems it has to do with the network not working properly; sometimes it works and sometimes just not. So DBCP sometimes can't get any connection to give you.
    You can probably configure dbcp (or Tomcat if you are using its built-in datasource) to retry until it can get a "good" connection, but for this you' ll have to look at dbcp or Tomcat docs (if you never heard of DBCP you it is probably useless to look in its docs, because probably Tomcat is responsible for its configuration).

  • Problem to deploy ADF application on tomcat server

    Hi all,
    i 'm using this tutorial link to deploy adf application on tomcat server.
    https://blogs.oracle.com/dana/entry/how_to_deploy_a_11g_adf_applic_1
    but when i have run my application i have got following error
    java.sql.SQLException: invalid arguments in call
    log-
    Jul 29, 2013 11:35:16 AM com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Initializing Sun's JavaServer Faces implementation (1.2_04-b07-FCS) for context '/TestApacheApp_ViewController_webapp1'
    Jul 29, 2013 11:35:19 AM oracle.adf.mbean.share.connection.ADFConnectionLifeCycleCallBack contextInitialized
    SEVERE: ADFConnection mbean not registered for defaultApplicationName.
    Jul 29, 2013 11:35:19 AM oracle.adf.mbean.share.connection.ADFConnectionLifeCycleCallBack contextInitialized
    SEVERE:
    oracle.jrf.UnknownPlatformException: JRF is unable to determine the current application server platform.
      at oracle.jrf.ServerPlatformSupportFactory.getInstance(ServerPlatformSupportFactory.java:79)
      at oracle.adf.mbean.share.connection.ADFConnectionLifeCycleCallBack.contextInitialized(ADFConnectionLifeCycleCallBack.java:82)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:515)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1231)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1471)
      at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:243)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
      at java.lang.Thread.run(Thread.java:662)
    Jul 29, 2013 11:35:19 AM oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack contextInitialized
    SEVERE: Failed to register config mbean for defaultApplicationName.
    Jul 29, 2013 11:35:19 AM oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack contextInitialized
    SEVERE:
    oracle.jrf.UnknownPlatformException: JRF is unable to determine the current application server platform.
      at oracle.jrf.ServerPlatformSupportFactory.getInstance(ServerPlatformSupportFactory.java:79)
      at oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack.contextInitialized(ADFConfigLifeCycleCallBack.java:79)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:515)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1231)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1471)
      at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:243)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
      at java.lang.Thread.run(Thread.java:662)
    Jul 29, 2013 11:35:19 AM oracle.bc4j.mbean.BC4JConfigLifeCycleCallBack contextInitialized
    SEVERE: Not able to get Deployment Name
    Jul 29, 2013 11:35:28 AM oracle.adfinternal.controller.state.ControllerState initializeRequest
    WARNING: ADFc: Deserialization of session state detected but ADF scope HA support is not enabled.  Please enable ADF scope HA support in the adf-config.xml file to ensure correct functioning of your applicaiton.
    Jul 29, 2013 11:35:28 AM oracle.adf.share.http.ServletADFContext initialize
    WARNING: Found wrong applictionScope sticking to oldContext for oldApplication defaultApplicationName, while the current one is null
    Jul 29, 2013 11:35:28 AM oracle.jbo.uicli.mom.CpxUtils$Visitor logMainApplicationCpx
    INFO: jndi:/localhost/TestApacheApp_ViewController_webapp1/WEB-INF/classes/com/in/jagran/view/DataBindings.cpx
    Jul 29, 2013 11:35:28 AM oracle.adf.share.jndi.MDSBackingStore documentExists
    INFO: MDS-00013: no metadata found for metadata object "/META-INF/connections.xml"
    Jul 29, 2013 11:35:32 AM oracle.adf.share.http.ServletADFContext initialize
    WARNING: Found wrong applictionScope sticking to oldContext for oldApplication defaultApplicationName, while the current one is null
    Jul 29, 2013 11:35:33 AM oracle.adf.share.http.ServletADFContext initialize
    WARNING: Found wrong applictionScope sticking to oldContext for oldApplication defaultApplicationName, while the current one is null
    Jul 29, 2013 11:35:47 AM org.apache.coyote.http11.Http11AprProtocol pause
    INFO: Pausing Coyote HTTP/1.1 on http-8086
    Jul 29, 2013 11:35:47 AM org.apache.coyote.ajp.AjpAprProtocol pause
    INFO: Pausing Coyote AJP/1.3 on ajp-8009
    Jul 29, 2013 11:35:48 AM org.apache.catalina.core.StandardService stop
    INFO: Stopping service Catalina
    Jul 29, 2013 11:35:48 AM org.apache.coyote.http11.Http11AprProtocol destroy
    INFO: Stopping Coyote HTTP/1.1 on http-8086
    Jul 29, 2013 11:35:48 AM org.apache.coyote.ajp.AjpAprProtocol destroy
    INFO: Stopping Coyote AJP/1.3 on ajp-8009

    There is no guideline I know of as this depends on the app itself.
    What you should do is to deploy the application onto a test server and check the metrics of the app over a defined period of time with a defined amount of traffic.
    Timo

Maybe you are looking for

  • Layout Issue for Operation

    HI All, I am facing an issue of Operation  Layout differ in both Client. Suppose  i i have two client 200 and 201 in that  I am getting an activity type and unloading Point in one client and another client earliest start date and  end date soboth lay

  • Issue in Product configurator component on Clicking DONE button - Session hung up

    Hi All, In our environment, eCommunications and eProdCFGObjMgr are separately configured in different servers.. When we place order and take through product configurator to customize the product and click DONE button, the eCommunication session itsel

  • Arrow Keys Won't Work on Many Websites

    On many game sites, the arrow keys won't work at all, so I'm not able to play. The hardware is fine, they work fine in email and Word, just not on the game sites. Do I have a setting wrong? I've checked everything (I think....) Thanks!!!

  • In grid not accept same code again

    Hi master Sir I have grid my user feed data in grid Sir problem is when my user feed one code one time then not again feed same code again in next row system check pervious row I found that code then give error massage Please give me idea Thank Aamir

  • Setting report layout to A4 wide?

    How can we set report layout to A4 wide? Thanks in advance. Regards,