2

如果没有嵌入式容器错误,我无法部署 Spring Boot 战争文件。我按照 spring.io ( http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file ) 站点上的说明进行操作,并尝试了多种方法但似乎没有什么能影响 Spring Boot 启动嵌入式容器。

POM.xml

<packaging>war</packaging>
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
</dependency>   

ShellApplication.java

@SpringBootApplication
public class ShellApplication extends SpringBootServletInitializer {  

  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(ShellApplication.class);
  }

  public static void main(String[] args) {
    SpringApplication.run(ShellApplication.class, args);                    
  } 
}

日志

 08:58:38,459 INFO  [stdout] (ServerService Thread Pool -- 55)  :: Spring Boot ::        (v1.2.1.RELEASE)

 08:58:38,459 INFO  [stdout] (ServerService Thread Pool -- 55) 

 08:58:38,538 INFO  [org.springframework.boot.SpringApplication] (ServerService Thread Pool -- 55) Starting application on USCHAWDW7510T2P with PID 19896 (started by xxxxxx in C:\jboss\jboss-eap-6.3.0\jboss-eap-6.3\bin)
 08:58:38,602 INFO  [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] (ServerService Thread Pool -- 55) Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@580b4da4: startup date [Thu Oct 29      08:58:38 CDT 2015]; root of context hierarchy
 08:58:40,877 INFO  [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (ServerService Thread Pool -- 55) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
 08:58:41,113 INFO  [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 55) HV000001: Hibernate Validator 4.3.1.Final-redhat-1
 08:58:41,509 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/shell-0.0.1-SNAPSHOT]] (ServerService Thread Pool -- 55) Initializing Spring embedded WebApplicationContext
 08:58:41,509 INFO  [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 55) Root WebApplicationContext: initialization completed in 2907 ms
 08:58:42,445 WARN  [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] (ServerService Thread Pool -- 55) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.web.ServerProperties org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration.server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverProperties': Could not bind properties to [unknown] (target=server, ignoreInvalidFields=false, ignoreUnknownFields=false, ignoreNestedProperties=false); nested exception is javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474) [spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:117) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:108) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:68) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) [spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.jboss.as.web.deployment.JBossContextConfig.lifecycleEvent(JBossContextConfig.java:181) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:115) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
     at org.apache.catalina.core.StandardContext.start(StandardContext.java:3772) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
     at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:161) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
     at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:59) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
     at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:94) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_79]
     at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_79]
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_79]
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_79]
     at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
     at org.jboss.threads.JBossThread.run(JBossThread.java:122)
 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.web.ServerProperties org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration.server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverProperties': Could not bind properties to [unknown] (target=server, ignoreInvalidFields=false, ignoreUnknownFields=false, ignoreNestedProperties=false); nested exception is javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.boot.context.embedded.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:176) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.embedded.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:80) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.embedded.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:68) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getServletContextInitializerBeans(EmbeddedWebApplicationContext.java:233) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:221) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:84) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:206) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
... 20 more
 Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.web.ServerProperties org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration.server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverProperties': Could not bind properties to [unknown] (target=server, ignoreInvalidFields=false, ignoreUnknownFields=false, ignoreNestedProperties=false); nested exception is javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
... 45 more
 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverProperties': Could not bind properties to [unknown] (target=server, ignoreInvalidFields=false, ignoreUnknownFields=false, ignoreNestedProperties=false); nested exception is javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
     at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:303) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:250) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1558) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1127) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1051) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533) [spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
... 47 more
 Caused by: javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
     at org.hibernate.validator.internal.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:1230) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
     at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:438) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
     at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:387) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
     at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:351) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
     at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:303) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
     at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:133) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
     at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:92) [spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.validation.DataBinder.validate(DataBinder.java:767) [spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.boot.bind.PropertiesConfigurationFactory.validate(PropertiesConfigurationFactory.java:284) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:253) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:225) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:296) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
... 60 more
 Caused by: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider
     at javax.persistence.Persistence$1.isLoaded(Persistence.java:92) [hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
     at org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:57) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
     at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:130) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
     at org.hibernate.validator.internal.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:46) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
     at org.hibernate.validator.internal.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:1221) [hibernate-validator-4.3.1.Final-redhat-1.jar:4.3.1.Final-redhat-1]
... 71 more

 08:58:42,478 INFO  [org.springframework.boot.logging.ClasspathLoggingApplicationListener] (ServerService Thread Pool -- 55) Application failed to start with classpath: unknown
 08:58:42,478 ERROR [org.springframework.boot.SpringApplication] (ServerService Thread Pool -- 55) Application startup failed: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.web.ServerProperties org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration.server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverProperties': Could not bind properties to [unknown] (target=server, ignoreInvalidFields=false, ignoreUnknownFields=false, ignoreNestedProperties=false); nested exception is javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474) [spring-context-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:117) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:108) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:68) [spring-boot-1.2.1.RELEASE.jar:1.2.1.RELEASE]
     at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) [spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
     at org.jboss.as.web.deployment.JBossContextConfig.lifecycleEvent(JBossContextConfig.java:181) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:115) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
     at org.apache.catalina.core.StandardContext.start(StandardContext.java:3772) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
     at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:161) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
     at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:59) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
     at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:94) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_79]
     at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_79]
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_79]
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_79]
     at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_79]
     at org.jboss.threads.JBossThread.run(JBossThread.java:122)
 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: 

我也尝试创建一个 tomcat 排除,但它没有帮助

<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>

jboss-部署-结构.xml

<jboss-deployment-structure>

<deployment>
    <exclude-subsystems>
        <subsystem name="jpa" />
    </exclude-subsystems>
    <exclusions>
        <!-- WFCORE-209 workaround -->
        <module name="javaee.api" />
        <!-- XXXXXXXXXXXXXXXXXXXXX -->
        <module name="javax.persistence.api" />
        <module name="org.hibernate" />
    </exclusions>
    <dependencies>
        <!-- WFCORE-209 workaround -->
        <module name="javax.activation.api" export="true"/>
        <module name="javax.annotation.api" export="true"/>
        <module name="javax.ejb.api" export="true"/>
        <module name="javax.el.api" export="true"/>
        <module name="javax.enterprise.api" export="true"/>
        <module name="javax.enterprise.deploy.api" export="true"/>
        <module name="javax.inject.api" export="true"/>
        <module name="javax.interceptor.api" export="true"/>
        <module name="javax.jms.api" export="true"/>
        <module name="javax.jws.api" export="true"/>
        <module name="javax.mail.api" export="true"/>
        <module name="javax.management.j2ee.api" export="true"/>
        <!-- <module name="javax.persistence.api" export="true"/> -->
        <module name="javax.resource.api" export="true"/>
        <module name="javax.rmi.api" export="true"/>
        <module name="javax.security.auth.message.api" export="true"/>
        <module name="javax.security.jacc.api" export="true"/>
        <module name="javax.servlet.api" export="true"/>
        <module name="javax.servlet.jsp.api" export="true"/>
        <module name="javax.transaction.api" export="true"/>
        <module name="javax.validation.api" export="true"/>
        <module name="javax.ws.rs.api" export="true"  services="export"/>
        <module name="javax.xml.bind.api" export="true"/>
        <module name="javax.xml.registry.api" export="true"/>
        <module name="javax.xml.soap.api" export="true"/>
        <module name="javax.xml.ws.api" export="true"/>

        <!-- This one always goes last. -->
        <module name="javax.api" export="true"/>
    </dependencies>
</deployment>

4

0 回答 0