3 Replies Latest reply on Nov 25, 2008 7:07 AM by 843859

    Problem in using connection pooling

    801514

      Hello Everyone ,
      I am developing an application using struts 1.2.9 in netbeans 6.0. I have used connection pooling.I have already run my project once & everything was working fine.But now I am getting error during deployment on apache tomcat.This is the stack trace.I am really new to this technology.Any
      help in this is highly appreciated.Thanx in advance.

      org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory ([ibm][db2][jcc][t4][2043][11550] Exception java.net.ConnectException: Error opening socket to server localhost/127.0.0.1 on port 50,000 with message: Connection refused: connect.)
      at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
      at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:959)
      at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:808)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:335)
      at javax.servlet.GenericServlet.init(GenericServlet.java:212)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4045)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4351)
      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.deployDescriptor(HostConfig.java:626)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:511)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1220)
      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:1458)
      at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:820)
      at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:348)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:196)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      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:175)
      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:263)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: com.ibm.db2.jcc.b.DisconnectException: [ibm][db2][jcc][t4][2043][11550] Exception java.net.ConnectException: Error opening socket to server localhost/127.0.0.1 on port 50,000 with message: Connection refused: connect.
      at com.ibm.db2.jcc.c.ac.a(ac.java:375)
      at com.ibm.db2.jcc.c.ac.<init>(ac.java:76)
      at com.ibm.db2.jcc.c.a.v(a.java:254)
      at com.ibm.db2.jcc.c.b.a(b.java:1709)
      at com.ibm.db2.jcc.b.v.a(v.java:360)
      at com.ibm.db2.jcc.b.v.<init>(v.java:414)
      at com.ibm.db2.jcc.c.b.<init>(b.java:258)
      at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:163)
      at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
      at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
      at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
      at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
      ... 42 more
      Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      at java.net.Socket.connect(Socket.java:518)
      at com.ibm.db2.jcc.c.bb.run(bb.java:34)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.ibm.db2.jcc.c.ac.a(ac.java:369)

        • 1. Re: Problem in using connection pooling
          843859
          Caused by: java.net.ConnectException: Connection refused: connect

          Means the database server in question cannot be physically connected to from the place you are trying to connect from.

          Check for firewalls blocking you. And check that you are going to the correct server and port.
          • 2. Re: Problem in using connection pooling
            801514
            Hello cotton.m,
            Thanx for replying.My database is installed on the same system & for db2 we use port no 50,000.Regarding firewall I don't think so it is blocking my Db2.As I have already mentioned it was running properly when I ran it last time.

            Thanx & regards,

            Brain-Friendly
            • 3. Re: Problem in using connection pooling
              843859
              Brain-Friendly wrote:
              Hello cotton.m,
              Thanx for replying.My database is installed on the same system & for db2 we use port no 50,000.Regarding firewall I don't think so it is blocking my Db2.As I have already mentioned it was running properly when I ran it last time.

              Thanx & regards,

              Brain-Friendly
              Well regardless of you think might be happening "Connection refused" means it couldn't open a Socket. This is a networking related issue and has nothing to do with connection pooling.

              If you are using the right server name (or IP) and port then there is a firewall blocking you.