无法实例化 AutoReconfigurationServletContainerInitializer

AutoReconfigurationServletContainerInitializer could not be instantiated

我正在将一个 Java EE 应用程序部署到 Bluemix,当第一个请求到达时我收到了这个错误:

2015-05-20T23:11:58.51+0200 [App/0] OUT [INFO ] FFDC1015I: An FFDC Incident has been created: "java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer could not be instantiated com.ibm.ws.webcontainer.osgi.DynamicVirtualHost startWebApp" at ffdc_15.05.20_21.11.58.0.log

我认为这是来自 Liberty Buildpack 的一段代码。 这是内容文件 ffdc_15.05.20_21.11.58.0.log (它似乎是一个 ClassNotFoundException 但因为它不是我的应用程序的一部分我不知道该怎么做) :

Exception = java.util.ServiceConfigurationError Source = com.ibm.ws.webcontainer.osgi.DynamicVirtualHost probeid = startWebApp Stack Dump = java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer could not be instantiated at java.util.ServiceLoader.fail(Unknown Source) at java.util.ServiceLoader.access0(Unknown Source) at java.util.ServiceLoader$LazyIterator.next(Unknown Source) at java.util.ServiceLoader.next(Unknown Source) at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2454) at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1038) at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6396) at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446) at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:248) at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:313) at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:251) at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:306) at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:449) at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:383) at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:283) at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:254) at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174) at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83) at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504) at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574) at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929) at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NoClassDefFoundError: org.springframework.context.ApplicationContextInitializer at java.lang.ClassLoader.defineClassImpl(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:297) at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:241) at java.lang.ClassLoader.loadClassHelper(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:390) at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:362) at java.lang.ClassLoader.loadClass(Unknown Source) at org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer.(AutoReconfigurationServletContainerInitializer.java:33) at java.lang.J9VMInternals.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Unknown Source) ... 23 more Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextInitializer at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:412) at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:246) at java.lang.ClassLoader.loadClassHelper(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:390) at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:362) at java.lang.ClassLoader.loadClass(Unknown Source) ... 35 more

谢谢!

我想您的应用程序正在使用 Spring 框架,这会触发 Spring Auto-Reconfiguration。如果您不需要此自动重新配置支持,您可以通过为您的应用程序设置以下环境变量来禁用它并重新启动:

cf set-env <app-name> JBP_CONFIG_SPRINGAUTORECONFIGURATION "enabled: false"

cf restage <app-name>