Getting the mentioned error while establishing VSDSession through vspk 20.10.7
SarodwatShome opened this issue · 1 comments
Please note this error is thrown while using the updated vspk-java & bambou-java jars on a legacy code base where vspk 5, 4 or earlier release were used but we never faced such error or exception.
Using vspk rel 20.10.7 & bambou 2.0.31 jars in the library, I am getting this exception while establishing VSDSession through constructor mentioned below.
Constructor used to establish VSD session:
VSDSession session = new VSDSession(sessionUser,sessionPassword,sessionOrg,sessionURL);
Exception stack trace:
2022-04-05 08:05:02,038 ERROR [pool-3-thread-1] [] - AGILECONNECT_DAY0WEEKLY_V6::Exception in processInventory method in InventoryBuildVersion6:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restClientService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.web.client.RestOperations net.nuagenetworks.bambou.service.RestClientService.restOperations; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restOperations' defined in net.nuagenetworks.bambou.spring.SpringConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.client.RestOperations]: Factory method 'restOperations' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.(AnnotationConfigApplicationContext.java:84)
at net.nuagenetworks.vspk.v6.VSDSession.(VSDSession.java:52)
at net.nuagenetworks.vspk.v6.VSDSession.(VSDSession.java:58)
at com.bt.npm.agileconnect.inventory.dayzero.version6.InventoryBuildVersion6.processInventory(InventoryBuildVersion6.java:154)
at com.bt.npm.agileconnect.inventory.dayzero.version6.InventoryBuildVersion6.run(InventoryBuildVersion6.java:95)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.web.client.RestOperations net.nuagenetworks.bambou.service.RestClientService.restOperations; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restOperations' defined in net.nuagenetworks.bambou.spring.SpringConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.client.RestOperations]: Factory method 'restOperations' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 18 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restOperations' defined in net.nuagenetworks.bambou.spring.SpringConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.client.RestOperations]: Factory method 'restOperations' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
... 20 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.client.RestOperations]: Factory method 'restOperations' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 32 more
Caused by: java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy
at net.nuagenetworks.bambou.spring.SpringConfig.restOperations(SpringConfig.java:42)
at net.nuagenetworks.bambou.spring.SpringConfig$$EnhancerBySpringCGLIB$$478119d1.CGLIB$restOperations$0()
at net.nuagenetworks.bambou.spring.SpringConfig$$EnhancerBySpringCGLIB$$478119d1$$FastClassBySpringCGLIB$$ca134a2c.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355)
at net.nuagenetworks.bambou.spring.SpringConfig$$EnhancerBySpringCGLIB$$478119d1.restOperations()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 33 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.ssl.TrustStrategy
at com.oracle.classloader.PolicyClassLoader.findClass(PolicyClassLoader.java:398)
at com.oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:371)
at com.oracle.classloader.weblogic.LaunchClassLoader.loadClass(LaunchClassLoader.java:55)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 44 more
Resolved this issue by upgrading the version of dependencies httpcore.jar & httpclient.jar to release 4.4.1.