在TomEE 7.1.0中部署Spring-boot Web项目

时间:2018-09-20 14:04:45

标签: spring-boot tomee spring-web tomee-7

我已经从STS创建了一个基于spring boot web的简单项目,这是我的pom文件。

         <?xml version="1.0" encoding="UTF-8"?>
        <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
     http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.spring</groupId>
<artifactId>SQLServer-1</artifactId>
<version>0.0.1.1</version>
<packaging>war</packaging>

<name>SQLServer-1</name>
<description>SQLServer</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.5.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>

    </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-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

我已经打包成一份战争文件,并在TomEE中部署了tr,我发现了错误。

20-Sep-2018 18:18:03.800 SEVERE [http-nio-8080-exec-7] org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SQLServer-1-0.0.1.1]
 org.apache.openejb.OpenEJBException: Creating application failed: D:\Softwares\Tomee Plus\apache-tomee-plus-7.1.0\webapps\SQLServer-1-0.0.1.1: javax.validation.spi.ConfigurationState.getValueExtractors()Ljava/util/Set;
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1096)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:757)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1303)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
    at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:985)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:507)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1650)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
    at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1525)
    at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:285)
    at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:206)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:610)
    at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:348)
    at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:52)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchMethodError: javax.validation.spi.ConfigurationState.getValueExtractors()Ljava/util/Set;
    at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:140)
    at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:38)
    at org.apache.bval.jsr.ConfigurationImpl.__privileged_doBuildValidatorFactory(ConfigurationImpl.java:332)
    at org.apache.bval.jsr.ConfigurationImpl.doBuildValidatorFactory(ConfigurationImpl.java)
    at org.apache.bval.jsr.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:324)
    at org.apache.openejb.assembler.classic.ValidatorBuilder$OpenEjbConfig.buildValidatorFactory(ValidatorBuilder.java:401)
    at org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:111)
    at org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:67)
    at org.apache.openejb.assembler.classic.LazyValidatorFactory.ensureDelegate(LazyValidatorFactory.java:54)
    at org.apache.openejb.assembler.classic.LazyValidatorFactory.getFactory(LazyValidatorFactory.java:65)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:975)
    ... 57 more

不知道出了什么问题。...

1 个答案:

答案 0 :(得分:0)

在将Spring Boot应用程序作为战争部署到TomEE 7.1.0中时,我们遇到了类似的问题。容器,我们通过META-INF / context.xml中的条目解决了应用程序大战。

<?xml version='1.0' encoding='utf-8'?>
<Context path="/app/service">
  <Loader delegate="true"/>
</Context>

https://tomcat.apache.org/tomcat-8.0-doc/config/loader.html

  

属性=委托

     

如果您希望类加载器遵循标准的Java2委托模型,并在查看Web应用程序之前尝试从父类加载器加载类,请设置为true。设置为false(默认值),以使类加载器首先在Web应用程序中查找,然后再要求父类加载器查找请求的类或资源。