6 Replies Latest reply: Feb 13, 2005 11:12 PM by 843836 RSS

    Cannot create PoolableConnectionFactory

    843836
      Dear Friends,
      Can any body suggest something regarding the below problem:

      Exception Occurred :Cannot create PoolableConnectionFactory
      org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory, cause:
      java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
      at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
      at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
      at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:82)
      at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:300)
      at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:838)
      at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:821)
      at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
      at org.apache.jsp.index_jsp.getConnectionInitialised(index_jsp.java:33)
      at org.apache.jsp.index_jsp._jspService(index_jsp.java:109)

      Regards,
      Vishal
        • 1. Re: Cannot create PoolableConnectionFactory
          843836
          I forgot to tell that I am trying to connect to the database from a JSP Page
          using DataSource.
          • 2. Re: Cannot create PoolableConnectionFactory
            843836
            Dear Friends,

            Please Help me in configuring the Tomcat 5.0 with JNDI Datasource,


            I have put the following in the app.xml
             <Resource name="ETaxSenate" type="javax.sql.DataSource"/>
              <ResourceParams name="ETaxSenate">
                    <parameter>
                            <name>factory</name>
                            <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                    </parameter>
                    <parameter>
                            <name>driverClassName</name>
                            <value>oracle.jdbc.driver.OracleDriver</value>
                    </parameter>
                    <parameter>
                            <name>url</name>
                            <value>jdbc:oracle:thin:@localhost:3125:MySDI</value>
                    </parameter>
                    <parameter>
                    <name>validationQuery</name>
                    <value>select "ram" from dual;</value>
                    </parameter>
                    <parameter>
                            <name>username</name>
                            <value>dbuser</value>
                    </parameter>
                    <parameter>
                            <name>password</name>
                            <value>dbpassword</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>
                </ResourceParams>
            In my DAO I Have the following,
            public static Connection getConnection(String dsName)
                    throws Exception {
                      LOG.debug("Entering getConnection with DS name " + dsName);
                      Context initCtx = new InitialContext();
                      DataSource ds = (DataSource) initCtx.lookup("java:comp/env/"+dsName);
                      LOG.debug("Exiting getConnection");
                      return ds.getConnection(); //I get error in this line
                 }
            The error that I get is,

            org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory, cause:
            java.sql.SQLException: ORA-00911: invalid character

            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
            at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
            at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
            at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
            at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:830)
            at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391)
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672)
            at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:572)
            at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:188)
            at org.apache.commons.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:338)
            at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:839)
            at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:821)
            at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
            at com.model.LoginDAO.getConnection(Unknown Source)
            at com.model.LoginDAO.getPassword(Unknown Source)
            at com.controller.actions.LoginAction.execute(Unknown Source)
            at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
            at com.controller.ControllerServlet.process(Unknown Source)
            at com.controller.ControllerServlet.doPost(Unknown Source)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
            at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
            at java.lang.Thread.run(Thread.java:536)


            Please help me in getting over the problem.
            • 3. Re: Cannot create PoolableConnectionFactory
              843836
              i hava the same problem:
              org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io &#24322;&#24120;: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))))
              • 4. Re: Cannot create PoolableConnectionFactory
                794117
                sonofsalem:
                Presumably you have solved the problem already? I would take a look at the SQL you are running. The database connection seems to be created, but it fails when executing your statement.

                jackxu86:
                Error 12505 normally indicates the TNS name you are connecting to doesn't exist. Are you using the oci8 or thin oracle driver? (or a completely different database from oracle?)
                Check the tnsnames.ora file on the machine this is running to check it is defined correctly.

                Cheers,
                evnafets
                • 5. Re: Cannot create PoolableConnectionFactory
                  843838
                  Greetings:

                  The database resource definition has changed significantly from tomcat 4 and tomcat 5. Please see the following link...

                  http://www.evolutionnext.com/blog/2005/10/13/1129259088959.html

                  Good luck to all...
                  • 6. Re: Cannot create PoolableConnectionFactory
                    843840
                    fyi, the mentioned atricle moved here: http://www.evolutionnext.com/blog/date/2005/9/13.html
                    also via http://www.evolutionnext.com/blog/entry/title/org.apache.tomcat.dbcp.dbcp.SQLNestedException.html