项目

一般

简介

找不到commons-pool2中相关方法

陈 泽豪将近 2 年 之前添加

版本:20221116

异常:

Description:
 following location:
The called method's class hierarchy was loaded from the following locations:

    org.apache.commons.pool2.impl.GenericObjectPoolConfig: file:/opt/AAS/aas_domain_1/ApusicAS/aas/modules/commons-pool2.jar
    org.apache.commons.pool2.impl.BaseObjectPoolConfig: file:/opt/AAS/aas_domain_1/ApusicAS/aas/modules/commons-pool2.jar
    org.apache.commons.pool2.BaseObject: file:/opt/AAS/aas_domain_1/ApusicAS/aas/modules/commons-pool2.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory and org.apache.commons.pool2.impl.GenericObjectPoolConfig

[SEVERE] [] [javax.enterprise.web.core] [tid: _ThreadID=91 _ThreadName=ApusicLogManager] [timeMillis: 1679560743571] [levelValue: 1000] [[
  Error invoking ServletContainerInitializer org.springframework.web.SpringServletContainerInitializer
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConnectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory]: Factory method 'redisConnectionFactory' threw exception; nested exception is java.lang.NoSuchMethodError: 'void org.apache.commons.pool2.impl.GenericObjectPoolConfig.setMaxWait(java.time.Duration)'
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
    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:745)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:423)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175)
    at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155)
    at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97)
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)
    at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:5764)
    at com.sun.enterprise.web.WebModule.callServletContainerInitializers(WebModule.java:609)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5660)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:526)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:885)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:868)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:644)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2069)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1690)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:83)
    at com.apusic.aas.internal.data.EngineRef.start(EngineRef.java:98)
    at com.apusic.aas.internal.data.ModuleInfo.start(ModuleInfo.java:267)
    at com.apusic.aas.internal.data.ApplicationInfo.start(ApplicationInfo.java:358)
    at com.apusic.enterprise.v10.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:479)
    at com.apusic.enterprise.v10.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:197)
    at com.apusic.aas.deployment.admin.DeployCommand.execute(DeployCommand.java:489)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:519)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:518)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:549)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:541)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/javax.security.auth.Subject.doAs(Subject.java:361)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:540)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1448)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:88)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1842)
    at com.apusic.aas.deployment.autodeploy.AutoOperation.run(AutoOperation.java:143)
    at com.apusic.aas.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:580)
    at com.apusic.aas.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:467)
    at com.apusic.aas.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:389)
    at com.apusic.aas.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:380)
    at com.apusic.aas.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:209)
    at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
    at java.base/java.util.TimerThread.run(Timer.java:506)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory]: Factory method 'redisConnectionFactory' threw exception; nested exception is java.lang.NoSuchMethodError: 'void org.apache.commons.pool2.impl.GenericObjectPoolConfig.setMaxWait(java.time.Duration)'
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
    ... 57 more
Caused by: java.lang.NoSuchMethodError: 'void org.apache.commons.pool2.impl.GenericObjectPoolConfig.setMaxWait(java.time.Duration)'
    at org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory.getPoolConfig(LettuceConnectionConfiguration.java:188)
    at org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration$PoolBuilderFactory.createBuilder(LettuceConnectionConfiguration.java:176)
    at org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration.createBuilder(LettuceConnectionConfiguration.java:112)
    at org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration.getLettuceClientConfiguration(LettuceConnectionConfiguration.java:99)
    at org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration.redisConnectionFactory(LettuceConnectionConfiguration.java:81)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 58 more

处理方案:

升级aas的commons-pool2.jar       jar包目录:ApusicAS/aas/modules下

20221116的commons-pool2.jar的版本为2.4.3,升级为2.11.1