{"action":"created","issue":{"url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/1101","repository_url":"https://api.github.com/repos/brettwooldridge/HikariCP","labels_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/1101/labels{/name}","comments_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/1101/comments","events_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/1101/events","html_url":"https://github.com/brettwooldridge/HikariCP/issues/1101","id":300601605,"number":1101,"title":"Unable to use PGSimpleDataSource","user":{"login":"rgupta2","id":15010133,"avatar_url":"https://avatars0.githubusercontent.com/u/15010133?v=4","gravatar_id":"","url":"https://api.github.com/users/rgupta2","html_url":"https://github.com/rgupta2","followers_url":"https://api.github.com/users/rgupta2/followers","following_url":"https://api.github.com/users/rgupta2/following{/other_user}","gists_url":"https://api.github.com/users/rgupta2/gists{/gist_id}","starred_url":"https://api.github.com/users/rgupta2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgupta2/subscriptions","organizations_url":"https://api.github.com/users/rgupta2/orgs","repos_url":"https://api.github.com/users/rgupta2/repos","events_url":"https://api.github.com/users/rgupta2/events{/privacy}","received_events_url":"https://api.github.com/users/rgupta2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-27T11:56:52Z","updated_at":"2018-03-05T05:38:20Z","closed_at":null,"author_association":"NONE","body":"#### Environment\r\n```\r\nHikariCP version: 2.7.4\r\nJDK version     : 1.8.0_101\r\nDatabase        : PostgreSQL\r\nDriver version  : 42.1.4 (org.postgresql:postgresql)\r\n```\r\n-----------------------------------------------------------------------------------------\r\nI am trying to use **datasource.hikari.data-source-class-name: org.postgresql.ds.PGSimpleDataSource** \r\nin place of **datasource.driver-class-name: org.postgresql.Driver** while rest of the config remaining same as shown below -\r\n\r\n```\r\ndatasource:\r\n    type: com.zaxxer.hikari.HikariDataSource\r\n    url: jdbc:postgresql://127.0.0.1/mydb\r\n    username: mydb_user\r\n    password: 'mydb_password'\r\n    hikari:\r\n      auto-commit: true\r\n      data-source-properties: stringtype=unspecified\r\n      **data-source-class-name: org.postgresql.ds.PGSimpleDataSource**\r\n```\r\n\r\n**I did go through old related HikariCP issues** and came to know that **either driver-class-name or data-source-class-name must be specified**. I am following the same but not sure why am still getting the error below -\r\n\r\n```\r\n2018-02-27T17:10:25.093Z  INFO <> --- [main                ] o.f.core.internal.util.VersionPrinter    : Flyway 4.0.3 by Boxfuse\r\n2018-02-27T17:10:25.098Z ERROR <> --- [main                ] com.zaxxer.hikari.HikariConfig           : HikariPool-1 - cannot use driverClassName and dataSourceClassName together.\r\n2018-02-27T17:10:25.099Z  WARN <> --- [main                ] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: cannot use driverClassName and dataSourceClassName together.\r\n2018-02-27T17:10:25.142Z ERROR <> --- [main                ] o.s.boot.SpringApplication               : Application startup failed\r\n```\r\n\r\n\r\nNOTE: I am trying to use PGSimpleDatasource because I was getting issue with broken PgConnection and I learnt that one should PGSimpleDatasource to avoid 2 connections pools problem - Hikari and Postgres.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/comments/370315014","html_url":"https://github.com/brettwooldridge/HikariCP/issues/1101#issuecomment-370315014","issue_url":"https://api.github.com/repos/brettwooldridge/HikariCP/issues/1101","id":370315014,"user":{"login":"rgupta2","id":15010133,"avatar_url":"https://avatars0.githubusercontent.com/u/15010133?v=4","gravatar_id":"","url":"https://api.github.com/users/rgupta2","html_url":"https://github.com/rgupta2","followers_url":"https://api.github.com/users/rgupta2/followers","following_url":"https://api.github.com/users/rgupta2/following{/other_user}","gists_url":"https://api.github.com/users/rgupta2/gists{/gist_id}","starred_url":"https://api.github.com/users/rgupta2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgupta2/subscriptions","organizations_url":"https://api.github.com/users/rgupta2/orgs","repos_url":"https://api.github.com/users/rgupta2/repos","events_url":"https://api.github.com/users/rgupta2/events{/privacy}","received_events_url":"https://api.github.com/users/rgupta2/received_events","type":"User","site_admin":false},"created_at":"2018-03-05T05:38:20Z","updated_at":"2018-03-05T05:38:20Z","author_association":"NONE","body":"@brettwooldridge That was very helpful but I am still having the problem of broken connection. Could you suggest any other reason why my application must be experiencing it? Earlier I read that we should use PGSimpleDataSource so that connection pooling happens only at Hikari level else following error occurs. But using PGSimpleDataSource doesn't seem to help resolve the issue.\r\n\r\n`\r\norg.postgresql.jdbc.PgConnection         : Validating connection.\r\norg.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.\r\nat org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:327)\r\nat org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)\r\nat org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)\r\nat org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169)\r\nat org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:136)\r\nat org.postgresql.jdbc.PgConnection.isValid(PgConnection.java:1311)\r\nat com.zaxxer.hikari.pool.PoolBase.isConnectionAlive(PoolBase.java:160)\r\nat com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:171)\r\nat com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:147)\r\nat com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:85)\r\nat org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)\r\nat org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:386)\r\nat org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:87)\r\nat org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:112)\r\nat org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:47)\r\nat org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)\r\nat org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)\r\nat org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148)\r\nat org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1929)\r\nat org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1898)\r\nat org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1876)\r\nat org.hibernate.loader.Loader.doQuery(Loader.java:919)\r\nat org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)\r\nat org.hibernate.loader.Loader.doList(Loader.java:2617)\r\nat org.hibernate.loader.Loader.doList(Loader.java:2600)\r\nat org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2429)\r\nat org.hibernate.loader.Loader.list(Loader.java:2424)\r\nat org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:336)\r\nat org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1967)\r\nat org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:322)\r\nat org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:125)\r\nat org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)\r\nat org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:529)\r\nat sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)\r\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\nat java.lang.reflect.Method.invoke(Method.java:498)\r\nat org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:372)\r\nat com.sun.proxy.$Proxy168.getSingleResult(Unknown Source)\r\nat org.springframework.data.jpa.repository.query.JpaQueryExecution$SingleEntityExecution.doExecute(JpaQueryExecution.java:206)\r\nat org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:85)\r\nat org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:116)\r\nat org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:106)\r\nat org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:483)\r\nat org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461)\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\r\nat org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56)\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\r\nat org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)\r\nat org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)\r\nat org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\r\nat org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\r\nat org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\r\nat org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\r\nat org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)\r\nat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\r\nat org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)\r\nat com.sun.proxy.$Proxy158.getATask(Unknown Source)\r\nat com.myorg.abcdatacollector.services.SocialTaskService.getATask(SocialTaskService.java:22)\r\nat com.myorg.abcdatacollector.services.SocialTaskService$$FastClassBySpringCGLIB$$89db3636.invoke(<generated>)\r\nat org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)\r\nat org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:669)\r\nat com.myorg.abcdatacollector.services.tasks.FacebookActivityTaskService$$EnhancerBySpringCGLIB$$520003d4.getATask(<generated>)\r\nat com.myorg.abcdatacollector.executors.CollectorService.buildStore(CollectorService.java:46)\r\nat com.myorg.abcdatacollector.application.ApplicationLoader.<init>(ApplicationLoader.java:11)\r\nat com.myorg.abcdatacollector.RspDataCollectorApplication.createLoader(RspDataCollectorApplication.java:38)\r\nat com.myorg.abcdatacollector.RspDataCollectorApplication$$EnhancerBySpringCGLIB$$d884bf28.CGLIB$createLoader$1(<generated>)\r\nat com.myorg.abcdatacollector.RspDataCollectorApplication$$EnhancerBySpringCGLIB$$d884bf28$$FastClassBySpringCGLIB$$28d9845a.invoke(<generated>)\r\nat org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)\r\nat org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)\r\nat com.myorg.abcdatacollector.RspDataCollectorApplication$$EnhancerBySpringCGLIB$$d884bf28.createLoader(<generated>)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\nat java.lang.reflect.Method.invoke(Method.java:498)\r\nat org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)\r\nat org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)\r\nat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)\r\nat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)\r\nat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)\r\nat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)\r\nat org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)\r\nat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)\r\nat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)\r\nat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)\r\nat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)\r\nat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)\r\nat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)\r\nat org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)\r\nat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)\r\nat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)\r\nat org.springframework.boot.SpringApplication.run(SpringApplication.java:303)\r\nat org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)\r\nat org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)\r\nat com.myorg.abcdatacollector.RspDataCollectorApplication.main(RspDataCollectorApplication.java:28)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\nat java.lang.reflect.Method.invoke(Method.java:498)\r\nat org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)\r\nat org.springframework.boot.loader.Launcher.launch(Launcher.java:87)\r\nat org.springframework.boot.loader.Launcher.launch(Launcher.java:50)\r\nat org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)\r\nCaused by: java.net.SocketException: Connection reset\r\nat java.net.SocketInputStream.read(SocketInputStream.java:210)\r\nat java.net.SocketInputStream.read(SocketInputStream.java:141)\r\nat org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:140)\r\nat org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:109)\r\nat org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:67)\r\nat org.postgresql.core.PGStream.receiveChar(PGStream.java:288)\r\nat org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1963)\r\nat org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)\r\n... 105 common frames omitted\r\n`"}}
{"actor":{"display_login":"rgupta2"}}