DISTRIBUTION: Why do I get “Error creating bean with name 'foremanClientService': Invocation of init method failed; nested exception is java.lang.reflect.InaccessibleObjectException” when installing distribution
In some scenarios, we might receive the below error in distribution-service.log when installing JFrog distribution service.
Error Snipper:
2023-05-05T20:05:15.001Z [jfds ] [ERROR] [0f8cc62117a47a6b] [o.j.b.d.a.Distribution:47 ] [main ] - Error while starting SpringBoot application org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'foremanClientService': Invocation of init method failed; nested exception is java.lang.reflect.InaccessibleObjectException: Unable to make field private transient java.lang.String java.net.URI.host accessible: module java.base does not "opens java.net" to unnamed module @4628a02b at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) at org.jfrog.app.context.JFrogApplication.run(JFrogApplication.java:88) at org.jfrog.bintray.distribution.application.Distribution.main(Distribution.java:41) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private transient java.lang.String java.net.URI.host accessible: module java.base does not "opens java.net" to unnamed module @4628a02b
The above error occurs if the password used for redis has a special character in it.
Example: In helm we pass the password for redis as shown below in values.yaml on helm based installation
distribution: jfrogUrl: http://xx.xx.xxx.xx joinKey: 6a8d2eaa5eab7d6945c020245c98344b9b42b9665073a36c74645d52e565dce4 persistence: enabled: true redis: password: "Password@123"
Redis is incorporated and functioning as a service within the Distribution framework. Its purpose within this context is to serve as a message broker for the distribution of release bundles from the source Artifactory instance to the designated Artifactory Edge nodes.
In this particular situation, the foreman client service is employed to manage the connection pool with the Redis service. However, an error has been reported indicating a failure in initializing the foreman client service.
To resolve this issue, a temporary solution is to utilize the distribution service password without any special characters. A Jira bug has already been created to address this matter. If you require additional information regarding the Jira bug, please feel free to contact JFrog Support.