Home > Mobile >  Java Hikari How to solve SSL factory error when using org.postgresql.ssl.jdbc4.LibPQFactory
Java Hikari How to solve SSL factory error when using org.postgresql.ssl.jdbc4.LibPQFactory

Time:07-16

I'm trying to create a DB connection using Hikari data source this is my Parameters, i need to use a sslfactory when i use LibPQFactor it fails with the error below, how can i solve it ? i want to clarify that i must NOT use org.postgresql.ssl.NonValidatingFactory so Please dont offer it

Thoese are the SSL params I use to concatenate to my JDBC URL:

"?sslmode=verify-ca&ssl=true&sslrootcert=/opt/datorama/cert/global-bundle.pem&sslfactory=org.postgresql.ssl.jdbc4.LibPQFactor";

This is the stack trace

Error creating bean with name 'hikariConfigDataSource' defined in com.datorama.datasource.OLTPHikariDatasourceConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariConfig]: Factory method 'dataSource' threw exception; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The SSLSocketFactory class provided org.postgresql.ssl.jdbc4.LibPQFactor could not be instantiated.

full stack trace

s org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceBase' defined in com.company.datasource.OLTPHikariDatasourceConfig: Unsatisfied dependency expressed through method 'buildHikariDataSource' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hikariConfigDataSource' defined in com.company.datasource.OLTPHikariDatasourceConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariConfig]: Factory method 'dataSource' threw exception; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The SSLSocketFactory class provided org.postgresql.ssl.jdbc4.LibPQFactor could not be instantiated.
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:706)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:197)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1361)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcesso…","_serviceName":"dtr-company-web"}*

CodePudding user response:

Thanks to Jjanes i had a typo and missing a y in the factory name

?sslmode=verify-ca&ssl=true&sslrootcert=/var/lib/jetty/global-bundle.pem&sslfactory=org.postgresql.ssl.jdbc4.LibPQFactory
  • Related