Results 1 to 5 of 5
  1. #1
    shweta is offline Member
    Join Date
    May 2008
    Posts
    2
    Rep Power
    0

    Default Datasource & JNDI error

    hi all,

    i am working on application using Tomcat 5.0 and Oracle 10g.

    I am using DataSource for database connection. but it is giving me following error.

    org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '
    ' for connect URL 'null'
    I am in single processing
    java.lang.NullPointerException
    at com.tcs.perc.perimeter.web.Execute_Transaction_Mix .doPost(Execute_Tra
    nsaction_Mix.java:103)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(Appl
    icationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationF
    ilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperV
    alve.java:214)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.jav
    a:520)
    at org.apache.catalina.core.StandardContextValve.invo keInternal(Standard
    ContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextV
    alve.java:152)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.jav
    a:520)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.j
    ava:137)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.j
    ava:118)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValv
    eContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.jav
    a:520)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineVal
    ve.java:109)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.jav
    a:520)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)

    at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:16
    0)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java
    :799)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.proce
    ssConnection(Http11Protocol.java:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java
    :577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadP
    ool.java:683)
    at java.lang.Thread.run(Thread.java:595)


    it is working great upto datasource lookup. it is also providing me datasource like follows.

    ds === org.apache.commons.dbcp.BasicDataSource@1568654

    but while calling the function ds.getConnection()
    it is giving me error..

    my context.xml contains

    <Context path="/Perimeter_with_datasource" docBase="C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\Perimeter_with_datasource" crossContext="true"
    debug="5" reloadable="true" crossContext="true">

    <!-- maxActive: Maximum number of dB connections in pool. Make sure you
    configure your mysqld max_connections large enough to handle
    all of your db connections. Set to 0 for no limit.
    -->

    <!-- maxIdle: Maximum number of idle dB connections to retain in pool.
    Set to -1 for no limit. See also the DBCP documentation on this
    and the minEvictableIdleTimeMillis configuration parameter.
    -->

    <!-- maxWait: Maximum time to wait for a dB connection to become available
    in ms, in this example 10 seconds. An Exception is thrown if
    this timeout is exceeded. Set to -1 to wait indefinitely.
    -->

    <!-- username and password: MySQL dB username and password for dB connections -->

    <!-- driverClassName: Class name for the old mm.mysql JDBC driver is
    org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
    Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
    -->

    <!-- url: The JDBC connection url for connecting to your MySQL dB.
    The autoReconnect=true argument to the url makes sure that the
    mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
    connection. mysqld by default closes idle connections after 8 hours.
    -->

    <Resource name="jdbc/oracle" auth="Container" type="javax.sql.DataSource">
    <ResourceParams>

    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFact ory</value>
    </parameter>

    <parameter>
    <name>driverClassName</name>
    <value>oracle.jdbc.OracleDriver</value>
    </parameter>

    <parameter>
    <name>url</name>
    <value>jdbc:oracle:thin:@192.168.140.109:1521:orac le</value>
    </parameter>

    <parameter>
    <name>username</name>
    <value>perf</value>
    </parameter>

    <parameter>
    <name>password</name>
    <value>oracle</value>
    </parameter>

    <parameter>
    <name>maxActive</name>
    <value>20</value>
    </parameter>

    <parameter>
    <name>maxIdle</name>
    <value>10</value>
    </parameter>

    <parameter>
    <name>maxWait</name>
    <value>-1</value>
    </parameter>

    <parameter>
    <name>removeAbandoned</name>
    <value>true</value>
    </parameter>

    <parameter>
    <name>removeAbandonedTimeout</name>
    <value>60</value>
    </parameter>

    <parameter>
    <name>logAbandoned</name>
    <value>true</value>
    </parameter>

    </ResourceParams>
    </Resource>
    </Context>



    can you help me on this???

  2. #2
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    i dont know Tomcat but i have a experience in working with Oracle10g. I have a few questions.
    Have you installed the Oracle Connector "classes12.jar" to your JDK? Have you tried connecting to it using java?

    Your connection String is Fine. Can you post your code please.

  3. #3
    shweta is offline Member
    Join Date
    May 2008
    Posts
    2
    Rep Power
    0

    Default

    thanks Eku
    it really helped
    my promblem is solved. i put "classes12.jar" in appliction server's lib
    and it worked !!!

    Thanks !!!!

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  5. #5
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    Your Welcome. ^_^
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

Similar Threads

  1. how to configure a JNDI URL resource
    By rinks in forum Advanced Java
    Replies: 0
    Last Post: 03-12-2008, 04:57 PM
  2. Jndi lookup _Need help(URGENT)
    By j satya in forum Enterprise JavaBeans (EJB)
    Replies: 0
    Last Post: 01-14-2008, 03:48 AM
  3. error in JNDI naming
    By jitendra.ibs in forum Java Servlet
    Replies: 0
    Last Post: 06-08-2007, 05:23 PM
  4. Replies: 1
    Last Post: 06-06-2007, 03:36 AM

Posting Permissions

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