0
在JBoss服務器中部署Spring Boot時發生異常。
我創建了一個加載所有彈簧啓動配置的示例應用程序類。如何在jboss(版本5)服務器上部署spring boot war?
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
控制器類:
@RequestMapping("/hello/{name}")
String hello(@PathVariable String name) {
return "Hello, " + name + "!";
}
這裏是我的web.xml
<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>demo.Application</param-value>
</context-param>
<listener>
<listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>myFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>myFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextAttribute</param-name>
<param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
當我部署這是一場戰爭,我得到下面的異常:
2016-06-15 11:47:39,390 +0530 level=INFO class=org.jboss.web.tomcat.service.deployers.TomcatDeployment deploy, ctxPath=/spring-boot-demo 2016-06-15 11:47:39,499 +0530 level=ERROR class=STDERR SLF4J: Class path contains multiple SLF4J bindings. 2016-06-15 11:47:39,500 +0530 level=ERROR class=STDERR SLF4J: Found binding in [vfszip:/Users/xxx/Downloads/softwares/whp-jboss-web-5/common/lib/slf4j-jboss-logging.jar/org/slf4j/impl/StaticLoggerBinder.class] 2016-06-15 11:47:39,500 +0530 level=ERROR class=STDERR SLF4J: Found binding in [vfszip:/Users/xxx/Downloads/softwares/whp-jboss-web-5/server/default/deploy/spring-boot-demo.war/WEB-INF/lib/logback-classic-1.1.5.jar/org/slf4j/impl/StaticLoggerBinder.class] 2016-06-15 11:47:39,500 +0530 level=ERROR class=STDERR SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 2016-06-15 11:47:39,542 +0530 level=ERROR class=STDERR SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] 2016-06-15 11:47:42,077 +0530 level=INFO class=STDOUT . ____ _ __ _ _ 2016-06-15 11:47:42,077 +0530 level=INFO class=STDOUT /\\/___'_ __ _ _(_)_ __ __ _ \ \ \ \ 2016-06-15 11:47:42,077 +0530 level=INFO class=STDOUT (()\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 2016-06-15 11:47:42,077 +0530 level=INFO class=STDOUT \\/ ___)| |_)| | | | | || (_| | )))) 2016-06-15 11:47:42,077 +0530 level=INFO class=STDOUT ' |____| .__|_| |_|_| |_\__, |//// 2016-06-15 11:47:42,077 +0530 level=INFO class=STDOUT =========|_|==============|___/=/_/_/_/ 2016-06-15 11:47:42,079 +0530 level=INFO class=STDOUT :: Spring Boot :: (v1.3.3.RELEASE) 2016-06-15 11:47:42,140 +0530 level=INFO class=org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/spring-boot-demo] Initializing Spring embedded WebApplicationContext 2016-06-15 11:47:42,148 +0530 level=INFO class=STDOUT 2016-06-15 11:47:42.146 INFO 2543 --- [ HDScanner] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1465971462146 ms 2016-06-15 11:47:42,152 +0530 level=INFO class=STDOUT 2016-06-15 11:47:42.152 INFO 2543 --- [ HDScanner] o.s.boot.SpringApplication : Starting application on BANL12f516590.local with PID 2543 (/Users/xxx/Downloads/softwares/whp-jboss-web-5/server/default/deploy/spring-boot-demo.war started by psudheendra in /Users/xxx/Downloads/softwares/whp-jboss-web-5) 2016-06-15 11:47:42,152 +0530 level=INFO class=STDOUT 2016-06-15 11:47:42.152 INFO 2543 --- [ HDScanner] o.s.boot.SpringApplication : The following profiles are active: dev 2016-06-15 11:47:42,177 +0530 level=INFO class=STDOUT 2016-06-15 11:47:42.177 INFO 2543 --- [ HDScanner] onConfigNonEmbeddedWebApplicationContext : Refreshing org.springframework.boot.lega[email protected]42bf31dc: startup date [Wed Jun 15 11:47:42 IST 2016]; root of context hierarchy 2016-06-15 11:47:42,222 +0530 level=INFO class=STDOUT 2016-06-15 11:47:42.222 ERROR 2543 --- [ HDScanner] o.s.boot.SpringApplication : Application startup failed java.lang.ExceptionInInitializerError: null at org.springframework.core.io.support.PathMatchingResourcePatternResolver$VfsResourceMatchingDelegate.findMatchingResources(PathMatchingResourcePatternResolver.java:736) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:420) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:274) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1269) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.GenericApplicationContext.getResources(GenericApplicationContext.java:225) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:270) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:248) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:137) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:268) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:137) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:268) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:232) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:168) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:321) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE] at org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener.initWebApplicationContext(SpringBootContextLoaderListener.java:61) ~[spring-boot-legacy-1.0.2.RELEASE.jar:1.0.2.RELEASE] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) ~[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910) [jbossweb.jar!/:na] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389) [jbossweb.jar!/:na] at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:313) [jboss-web-service.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201111102209)] at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145) [jboss-web-service.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201111102209)] at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461) [jboss.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.web.deployers.WebModule.startModule(WebModule.java:122) [jboss.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.web.deployers.WebModule.start(WebModule.java:97) [jboss.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) [jboss-mbeans.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) [jboss-mbeans.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201111102209)] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) [jboss-mbeans.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201111102209)] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) [jboss-mbeans.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201111102209)] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668) [jboss-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201111102209)] at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206) [jboss-system-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at com.sun.proxy.$Proxy39.start(Unknown Source) [na:na] at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42) [jboss-system-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37) [jboss-system-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) [jboss-dependency.jar:2.0.10.GA] at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297) [jboss-system-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556) [jboss-dependency.jar:2.0.10.GA] at org.jboss.system.ServiceController.doChange(ServiceController.java:688) [jboss-system-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.system.ServiceController.start(ServiceController.java:460) [jboss-system-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163) [jboss-system-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99) [jboss-system-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46) [jboss-system-jmx.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) [jboss-deployers-spi.jar!/:2.0.10.GA] at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [jboss-deployers-spi.jar!/:2.0.10.GA] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [jboss-deployers-impl.jar!/:2.0.10.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1454) [jboss-deployers-impl.jar!/:2.0.10.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1172) [jboss-deployers-impl.jar!/:2.0.10.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1193) [jboss-deployers-impl.jar!/:2.0.10.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1113) [jboss-deployers-impl.jar!/:2.0.10.GA] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826) [jboss-dependency.jar:2.0.10.GA] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556) [jboss-dependency.jar:2.0.10.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:789) [jboss-deployers-impl.jar!/:2.0.10.GA] at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699) [jboss-deployers-impl.jar!/:2.0.10.GA] at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) [jboss-system.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:409) [jboss-system.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:294) [jboss-system.jar!/:5.1.2 (build: SVNTag=JBPAPP_5_1_2 date=201207160006)] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_60] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_60] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_60] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_60] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60] Caused by: java.lang.IllegalStateException: Could not detect JBoss VFS infrastructure at org.springframework.core.io.VfsUtils.(VfsUtils.java:94) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] ... 86 common frames omitted Caused by: java.lang.ClassNotFoundException: org.jboss.vfs.VFS from [email protected]{vfszip:/Users/xxx/Downloads/softwares/whp-jboss-web-5/server/default/deploy/spring-boot-demo.war/} at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:477) ~[jboss-classloader.jar:2.0.10.GA] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_60] at org.springframework.core.io.VfsUtils.(VfsUtils.java:71) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE] ... 86 common frames omitted
pom.xml中的依賴關係
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-legacy</artifactId>
<version>1.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
你的問題身體在哪裏? –
如何在jboss(版本5)服務器上部署spring boot war? –
完成,現在好嗎? –