我正在使用WildFly Server 20. x. x. x在Spring mvc中实现异步方法,但当我想部署它时,由于@EnableAsync注释的实现而发生错误
我的异步配置:
@Configuration
@EnableAsync
@ComponentScan(basePackages = {"xxxx.xxxx.xxxx.xxxx"})
public class WebAsyncConfig extends AsyncConfigurerSupport {
@Override
public Executor getAsyncExecutor() {
return ...;
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return ...;
}
}
声明@EnableAsync注释时,会发生错误
10:11:41,833 ERROR [org.springframework.web.servlet.DispatcherServlet] (ServerService Thread Pool -- 49) Context initialization failed: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiAreaController' defined in VFS resource ["/D:/AG/IdeaProjects/salesviewer/target/salesviewer/WEB-INF/classes/com/deytecsv/salesviewer/controller/api/ApiAreaController.class"]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'areaService' defined in VFS resource ["/D:/AG/IdeaProjects/salesviewer/target/salesviewer/WEB-INF/classes/com/deytecsv/salesviewer/service/AreaService.class"]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is org.springframework.aop.framework.AopConfigException: Unable to instantiate proxy using Objenesis, and regular proxy instantiation via default constructor fails as well; nested exception is java.lang.NoSuchMethodException: com.deytecsv.salesviewer.service.AreaService$$EnhancerBySpringCGLIB$$88c544b6.<init>()
at deployment.salesviewer.war//org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:799)
at deployment.salesviewer.war//org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:228)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1356)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1203)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at deployment.salesviewer.war//org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at deployment.salesviewer.war//org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
at deployment.salesviewer.war//org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
at deployment.salesviewer.war//org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at deployment.salesviewer.war//org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)
at deployment.salesviewer.war//org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:578)
at deployment.salesviewer.war//org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)
at deployment.salesviewer.war//org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)
at javax.servlet.api@2.0.0.Final//javax.servlet.GenericServlet.init(GenericServlet.java:180)
at io.undertow.servlet@2.2.3.Final//io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
at org.wildfly.extension.undertow@22.0.0.Final//org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
at io.undertow.servlet@2.2.3.Final//io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
at io.undertow.servlet@2.2.3.Final//io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:305)
at io.undertow.servlet@2.2.3.Final//io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:145)
at io.undertow.servlet@2.2.3.Final//io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:588)
at io.undertow.servlet@2.2.3.Final//io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:559)
at io.undertow.servlet@2.2.3.Final//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet@2.2.3.Final//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow@22.0.0.Final//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow@22.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
at org.wildfly.extension.undertow@22.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
at org.wildfly.extension.undertow@22.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
at org.wildfly.extension.undertow@22.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
at org.wildfly.extension.undertow@22.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
at io.undertow.servlet@2.2.3.Final//io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:601)
at org.wildfly.extension.undertow@22.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:97)
at org.wildfly.extension.undertow@22.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is org.springframework.aop.framework.AopConfigException: Unable to instantiate proxy using Objenesis, and regular proxy instantiation via default constructor fails as well; nested exception is java.lang.NoSuchMethodException: com.deytecsv.salesviewer.service.AreaService$$EnhancerBySpringCGLIB$$88c544b6.<init>()
at deployment.salesviewer.war//org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:214)
at deployment.salesviewer.war//org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
at deployment.salesviewer.war//org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor.postProcessAfterInitialization(AbstractAdvisingBeanPostProcessor.java:92)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:430)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1798)
at deployment.salesviewer.war//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
... 53 more
Caused by: org.springframework.aop.framework.AopConfigException: Unable to instantiate proxy using Objenesis, and regular proxy instantiation via default constructor fails as well; nested exception is java.lang.NoSuchMethodException: com.deytecsv.salesviewer.service.AreaService$$EnhancerBySpringCGLIB$$88c544b6.<init>()
at deployment.salesviewer.war//org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:81)
at deployment.salesviewer.war//org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:205)
... 58 more
Caused by: java.lang.NoSuchMethodException: com.deytecsv.salesviewer.service.AreaService$$EnhancerBySpringCGLIB$$88c544b6.<init>()
at java.base/java.lang.Class.getConstructor0(Class.java:3349)
at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2553)
at deployment.salesviewer.war//org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:75)
... 59 more
同一个应用程序已经部署在Tomcat、TomEE、Jetty Server中,并且一切正常,没有问题。
这看起来像是Wildfly用来创建类代理的库的问题。areaService bean的构造函数不兼容。给定异常消息,没有看到有问题的类,我想它没有定义默认构造函数,这个代理库可能需要它才能正常工作。我知道这可能是旧序列化库的问题,这些库需要显式默认构造函数来创建对象,然后才能反射地设置属性。
每当我试图获取SpringMVC的时,都会抛出一个。 这是我的用户道: 线程“main”java.lang.NullPointerException位于com.markor.smarthome.utilites.SpringContextutil.getBeans(SpringContextutil.java:31)位于com.markor.smarthome.dao.userdao.(userd
问题内容: 对于这两个进口; 我收到此错误: 如何解决此错误? 问题答案: 该错误是由您的Eclipse配置引起的。您可以将其减少为警告。更好的是,使用不属于非公共API的Base64编码器。Apache Commons有一个,或者当您已经使用Java 1.8时,请使用。
问题内容: 每当我编写包含ArrayUtil的代码时,都会导致意外错误: 我使用Eclipse编写代码,“ ArrayUtil”下始终有一个红色下划线。我究竟做错了什么? 问题答案: 您的ArrayUtil属于哪个软件包?没有这些信息,没人能确定地回答。 你到这里了吗?如果是,则您的签名看起来正确。您可能尚未导入它,或者该类不在您的CLASSPATH中。Eclipse告诉您更正其中一项。
如果我注释掉“%matplotlib inline”,代码运行正常,但如果我不注释“%matplotlib inline”,则“fig,axes=plt.subplot(nrows=x_p,ncols=y_p)”开始创建空白绘图,下面的代码会触发如下错误。知道为什么吗?
问题内容: 由于某些原因,我的fx:id无法正确绑定到我的类,因此始终会导致错误。 控制者 XML文件 我认为我了解问题的根源,但不了解如何正确解决。根据这个问题的答案,我认为我正在尝试在调用构造函数之前分配FXML元素(并且这些元素只能在初始化期间/之后分配)。 有没有办法 不 执行此操作?还是我犯了一个完全不同的错误? 问题答案: 您使用进口 在您的fxml文件中。 因此,在加载fxml文件时
启用proguard规则后,我在向网络发送任何内容之前遇到以下错误。 java.lang.RuntimeException:无法将FormDocTankPermission转换为RequestBody 引起的 com.fasterxml.jackson.databind.exc.InvalidDefinitionException:找不到类FormDocTankPermission的序列化程序,也