由于缺少 Spring 引导 class,WebLogic 12.2.1.2.0 上的部署失败
Deployment on WebLogic 12.2.1.2.0 fails due to missing Spring boot class
我有一个 Spring 引导应用程序,它是我在 STS 3.9.2 中开发的,最初是一个独立的 .jar,后来我使用 WebLogic Web 服务 Maven 项目模板将其迁移到 WebLogic。目标运行时是 Oracle WebLogic 12.2.1.3(这是 Oracle 仍然可用的最旧版本)。我没有使用与 WebLogic 的任何集成,我只希望能够进行部署。
按照网上很多教程的描述,我把spring-boot-starter-tomcat依赖设置为provided
。这是我的依赖列表:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
...
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
<exclusions>
<exclusion>
<artifactId>xmlparserv2</artifactId>
<groupId>com.oracle.jdbc</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>xdb6</artifactId>
<version>12.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
我可以成功地将我的应用程序部署到本地 WebLogic 12.2.1.3.0 服务器。
我现在正尝试将此应用程序作为 WAR 文件部署到 WebLogic 12.2.1.2.0(因为这是客户的平台),但失败并出现以下错误:
/\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.2.RELEASE)
2020-02-21 08:20:46.259 INFO 22574 --- [ (self-tuning)'] n.n.a.d.ChpDataImportApplication : Starting ChpDataImportApplication on dev-fat6 with PID 22574 (/opt/oracle/product/fusionaim/smartaim/domains/smartaim/servers/chpdataimport/tmp/_WL_user/ChpDataImport/rlk0tm/war/WEB-INF/lib/_wl_cls_gen.jar started by oracle in /opt/oracle/product/fusionaim/smartaim/domains/smartaim)
2020-02-21 08:20:46.263 INFO 22574 --- [ (self-tuning)'] n.n.a.d.ChpDataImportApplication : No active profile set, falling back to default profiles: default
2020-02-21 08:20:47.110 INFO 22574 --- [ (self-tuning)'] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$eac9ca9a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-02-21 08:20:47.178 INFO 22574 --- [ (self-tuning)'] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2020-02-21 08:20:47.184 INFO 22574 --- [ (self-tuning)'] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 898 ms
2020-02-21 08:20:47.420 WARN 22574 --- [ (self-tuning)'] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
2020-02-21 08:20:47.430 INFO 22574 --- [ (self-tuning)'] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-02-21 08:20:47.440 ERROR 22574 --- [ (self-tuning)'] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:152) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:132) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:92) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172) [spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at weblogic.servlet.internal.WebAppServletContext.initContainerInitializer(WebAppServletContext.java:1421) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.initContainerInitializers(WebAppServletContext.java:1360) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.initContainerInitializers(WebAppServletContext.java:1341) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1907) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3091) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1823) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:882) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:233) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:228) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:78) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:52) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.BaseDeployment.next(BaseDeployment.java:750) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:260) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:52) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:90) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:265) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:481) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.DeploymentAdapter.doActivate(DeploymentAdapter.java:53) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:202) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.AppTransition.transitionApp(AppTransition.java:52) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.ConfiguredDeployments.doItem(ConfiguredDeployments.java:684) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.parallel.BucketInvoker.invoke(BucketInvoker.java:138) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionAppsParallel(ConfiguredDeployments.java:692) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:341) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:203) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:207) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:129) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:76) [com.bea.core.weblogic.lifecycle.jar:12.2.1.2]
at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1262) [org.glassfish.hk2.hk2-utils.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:332) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:374) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471) [org.glassfish.hk2.hk2-locator.jar:na]
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:232) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:85) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2020) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:693) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:78) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:211) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:234) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:357) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471) [org.glassfish.hk2.hk2-locator.jar:na]
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:232) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:85) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2020) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88) [org.glassfish.hk2.hk2-locator.jar:na]
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144) [org.glassfish.hk2.hk2-runlevel.jar:na]
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348) [com.bea.core.utils.full.jar:12.2.1.2]
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333) [com.bea.core.utils.full.jar:12.2.1.2]
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54) [com.oracle.weblogic.work.jar:12.2.1.2]
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:484) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=13=](AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:211) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:174) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:169) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:154) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:86) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:253) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:227) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
... 77 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
... 95 common frames omitted
Caused by: java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.configure(Jackson2ObjectMapperBuilder.java:694) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:633) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:59) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:76) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.web.filter.FormContentFilter.<init>(FormContentFilter.java:61) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.boot.web.servlet.filter.OrderedFormContentFilter.<init>(OrderedFormContentFilter.java:29) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.formContentFilter(WebMvcAutoConfiguration.java:161) ~[spring-boot-autoconfigure-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
... 96 common frames omitted
Caused by: java.lang.NoSuchMethodError:
... 108 common frames omitted
<Feb 21, 2020, 8:20:47,480 AM UTC> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application "ChpDataImport".
weblogic.application.ModuleException: java.lang.NoSuchMethodError:
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:233)
at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:228)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchMethodError:
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.configure(Jackson2ObjectMapperBuilder.java:694)
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:633)
at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:59)
at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:76)
at org.springframework.web.filter.FormContentFilter.<init>(FormContentFilter.java:61)
Truncated. see log file for complete stacktrace
Class OrderedFormContentFilter 是 spring-boot-2.2.2.RELEASE.jar 库的一部分,它与 WAR 文件打包在一起。该错误可能是由于存在该库的旧版本(此 class 是在版本 2.1.0 中引入的),但似乎没有任何可用的 spring 启动 jar服务器可能首选的 WebLogic 服务器。
如所述here,可以指示服务器使用打包的 jar,方法是使用以下 weblogic-configuration.xml 将应用程序部署为 EAR 文件:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_6.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.8/weblogic-application.xsd">
<!--weblogic-version:12.2.1.3-->
<wls:application-param>
<wls:param-name>webapp.encoding.default</wls:param-name>
<wls:param-value>UTF-8</wls:param-value>
</wls:application-param>
<wls:prefer-application-packages>
<wls:package-name>org.springframework.boot.*</wls:package-name>
</wls:prefer-application-packages>
</wls:weblogic-application>
但无济于事(同样的错误仍然存在)。欢迎任何解释为什么会发生这种情况或提出建议!
对于那些感兴趣的人,我按如下方式解决了这个问题。不必创建 EAR 文件,您只需将包列表添加到您的 weblogic.xml 文件中,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">
<wls:weblogic-version>12.2.1.3</wls:weblogic-version>
<wls:context-root>ChpDataImport</wls:context-root>
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j.*</wls:package-name>
<wls:package-name>org.springframework.*</wls:package-name>
<wls:package-name>com.fasterxml.jackson.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
策略是部署,在出错的情况下查看日志,并将适当的包添加到列表中,直到不再有错误。
我有一个 Spring 引导应用程序,它是我在 STS 3.9.2 中开发的,最初是一个独立的 .jar,后来我使用 WebLogic Web 服务 Maven 项目模板将其迁移到 WebLogic。目标运行时是 Oracle WebLogic 12.2.1.3(这是 Oracle 仍然可用的最旧版本)。我没有使用与 WebLogic 的任何集成,我只希望能够进行部署。
按照网上很多教程的描述,我把spring-boot-starter-tomcat依赖设置为provided
。这是我的依赖列表:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
...
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
<exclusions>
<exclusion>
<artifactId>xmlparserv2</artifactId>
<groupId>com.oracle.jdbc</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>xdb6</artifactId>
<version>12.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
我可以成功地将我的应用程序部署到本地 WebLogic 12.2.1.3.0 服务器。
我现在正尝试将此应用程序作为 WAR 文件部署到 WebLogic 12.2.1.2.0(因为这是客户的平台),但失败并出现以下错误:
/\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.2.RELEASE)
2020-02-21 08:20:46.259 INFO 22574 --- [ (self-tuning)'] n.n.a.d.ChpDataImportApplication : Starting ChpDataImportApplication on dev-fat6 with PID 22574 (/opt/oracle/product/fusionaim/smartaim/domains/smartaim/servers/chpdataimport/tmp/_WL_user/ChpDataImport/rlk0tm/war/WEB-INF/lib/_wl_cls_gen.jar started by oracle in /opt/oracle/product/fusionaim/smartaim/domains/smartaim)
2020-02-21 08:20:46.263 INFO 22574 --- [ (self-tuning)'] n.n.a.d.ChpDataImportApplication : No active profile set, falling back to default profiles: default
2020-02-21 08:20:47.110 INFO 22574 --- [ (self-tuning)'] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$eac9ca9a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-02-21 08:20:47.178 INFO 22574 --- [ (self-tuning)'] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2020-02-21 08:20:47.184 INFO 22574 --- [ (self-tuning)'] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 898 ms
2020-02-21 08:20:47.420 WARN 22574 --- [ (self-tuning)'] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
2020-02-21 08:20:47.430 INFO 22574 --- [ (self-tuning)'] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-02-21 08:20:47.440 ERROR 22574 --- [ (self-tuning)'] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:152) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:132) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:92) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172) [spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at weblogic.servlet.internal.WebAppServletContext.initContainerInitializer(WebAppServletContext.java:1421) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.initContainerInitializers(WebAppServletContext.java:1360) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.initContainerInitializers(WebAppServletContext.java:1341) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1907) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3091) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1823) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:882) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:233) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:228) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:78) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:52) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.BaseDeployment.next(BaseDeployment.java:750) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:260) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:52) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165) [com.oracle.weblogic.application.jar:12.2.1.2]
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:90) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:265) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:481) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.DeploymentAdapter.doActivate(DeploymentAdapter.java:53) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:202) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.AppTransition.transitionApp(AppTransition.java:52) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.ConfiguredDeployments.doItem(ConfiguredDeployments.java:684) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.parallel.BucketInvoker.invoke(BucketInvoker.java:138) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionAppsParallel(ConfiguredDeployments.java:692) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:341) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:203) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:207) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:129) [com.oracle.weblogic.deploy.jar:12.2.1.2]
at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:76) [com.bea.core.weblogic.lifecycle.jar:12.2.1.2]
at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1262) [org.glassfish.hk2.hk2-utils.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:332) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:374) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471) [org.glassfish.hk2.hk2-locator.jar:na]
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:232) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:85) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2020) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:693) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:78) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:211) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:234) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:357) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:471) [org.glassfish.hk2.hk2-locator.jar:na]
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:232) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:85) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2020) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:114) [org.glassfish.hk2.hk2-locator.jar:na]
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:88) [org.glassfish.hk2.hk2-locator.jar:na]
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213) [org.glassfish.hk2.hk2-runlevel.jar:na]
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144) [org.glassfish.hk2.hk2-runlevel.jar:na]
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348) [com.bea.core.utils.full.jar:12.2.1.2]
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333) [com.bea.core.utils.full.jar:12.2.1.2]
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54) [com.oracle.weblogic.work.jar:12.2.1.2]
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:484) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=13=](AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:211) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:174) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAsRegistrationBean(ServletContextInitializerBeans.java:169) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addAdaptableBeans(ServletContextInitializerBeans.java:154) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:86) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:253) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:227) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
... 77 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
... 95 common frames omitted
Caused by: java.lang.BootstrapMethodError: java.lang.NoSuchMethodError:
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.configure(Jackson2ObjectMapperBuilder.java:694) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:633) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:59) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:76) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.web.filter.FormContentFilter.<init>(FormContentFilter.java:61) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
at org.springframework.boot.web.servlet.filter.OrderedFormContentFilter.<init>(OrderedFormContentFilter.java:29) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.formContentFilter(WebMvcAutoConfiguration.java:161) ~[spring-boot-autoconfigure-2.2.2.RELEASE.jar:2.2.2.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
... 96 common frames omitted
Caused by: java.lang.NoSuchMethodError:
... 108 common frames omitted
<Feb 21, 2020, 8:20:47,480 AM UTC> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application "ChpDataImport".
weblogic.application.ModuleException: java.lang.NoSuchMethodError:
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:233)
at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:228)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchMethodError:
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.configure(Jackson2ObjectMapperBuilder.java:694)
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:633)
at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:59)
at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:76)
at org.springframework.web.filter.FormContentFilter.<init>(FormContentFilter.java:61)
Truncated. see log file for complete stacktrace
Class OrderedFormContentFilter 是 spring-boot-2.2.2.RELEASE.jar 库的一部分,它与 WAR 文件打包在一起。该错误可能是由于存在该库的旧版本(此 class 是在版本 2.1.0 中引入的),但似乎没有任何可用的 spring 启动 jar服务器可能首选的 WebLogic 服务器。
如所述here,可以指示服务器使用打包的 jar,方法是使用以下 weblogic-configuration.xml 将应用程序部署为 EAR 文件:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_6.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.8/weblogic-application.xsd">
<!--weblogic-version:12.2.1.3-->
<wls:application-param>
<wls:param-name>webapp.encoding.default</wls:param-name>
<wls:param-value>UTF-8</wls:param-value>
</wls:application-param>
<wls:prefer-application-packages>
<wls:package-name>org.springframework.boot.*</wls:package-name>
</wls:prefer-application-packages>
</wls:weblogic-application>
但无济于事(同样的错误仍然存在)。欢迎任何解释为什么会发生这种情况或提出建议!
对于那些感兴趣的人,我按如下方式解决了这个问题。不必创建 EAR 文件,您只需将包列表添加到您的 weblogic.xml 文件中,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">
<wls:weblogic-version>12.2.1.3</wls:weblogic-version>
<wls:context-root>ChpDataImport</wls:context-root>
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j.*</wls:package-name>
<wls:package-name>org.springframework.*</wls:package-name>
<wls:package-name>com.fasterxml.jackson.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
策略是部署,在出错的情况下查看日志,并将适当的包添加到列表中,直到不再有错误。