java - 作为对 tomcat7 的战争部署的 Spring Boot 应用程序失败,并出现错误“找到了多个名为 [org_apache_tomcat_websocket] 的片段”
问题描述
在 tomcat7 上部署我的 spring-boot 应用程序失败,从错误中说它是由以下原因引起的:
More than one fragment with the name [org_apache_tomcat_websocket] was found. This is not legal with relative ordering. See section 8.2.2 2c of the Servlet specification for details. Consider using absolute ordering
我已经尝试删除重复的依赖项,但我没有任何成功
这是我的 build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.21.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
apply plugin: 'application'
jar {
baseName = 'gs-interswitch-verve-mobile-service'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
mainClassName="verve.Application"
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:1.5.21.RELEASE")
testCompile("junit:junit")
testCompile('org.springframework.boot:spring-boot-starter-test:1.5.21.RELEASE')
compile("org.apache.httpcomponents:httpclient:4.0-beta1")
compile("org.json:json:20140107")
compile("org.bouncycastle:bcpkix-jdk15on:1.49")
compile("com.google.code.gson:gson:2.8.5")
compileOnly("org.springframework.boot:spring-boot-starter-tomcat:1.5.21.RELEASE")RELEASE
}
我希望应用程序能够成功部署,但我遇到了如下所示的错误
Jun 07, 2019 11:53:53 AM org.apache.catalina.startup.HostConfig undeploy
INFO: Undeploying context [/InterswitchVerveMobile]
Jun 07, 2019 11:53:53 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /Applications/tomcat7/webapps/InterswitchVerveMobile.war
Jun 07, 2019 11:53:53 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(/Applications/tomcat7/webapps/InterswitchVerveMobile/WEB-INF/lib/tomcat-embed-core-8.5.40.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Jun 07, 2019 11:53:53 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(/Applications/tomcat7/webapps/InterswitchVerveMobile/WEB-INF/lib/tomcat-embed-el-8.5.40.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Jun 07, 2019 11:53:53 AM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/InterswitchVerveMobile]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: More than one fragment with the name [org_apache_tomcat_websocket] was found. This is not legal with relative ordering. See section 8.2.2 2c of the Servlet specification for details. Consider using absolute ordering.
at org.apache.catalina.deploy.WebXml.orderWebFragments(WebXml.java:2338)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1268)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5606)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 10 more
Jun 07, 2019 11:53:54 AM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive /Applications/tomcat7/webapps/InterswitchVerveMobile.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/InterswitchVerveMobile]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1022)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Jun 07, 2019 11:53:54 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /Applications/tomcat7/webapps/InterswitchVerveMobile.war has finished in 323 ms
我将 gradle 依赖项保存在一个文件中./gradlew dependencies > deps.txt
,内容可以在 github gist https://gist.github.com/Phainix/31aa9b95232e6394c95f97fabdc94c79中找到
我将不胜感激任何帮助
解决方案
也许你应该改变
compileOnly("org.springframework.boot:spring-boot-starter-tomcat:1.5.21.RELEASE")
到
providedRuntime "org.springframework.boot:spring-boot-starter-tomcat:1.5.21.RELEASE"
我认为这是一个依赖项,不应该在战争文件中。
推荐阅读
- xcode - 包含来自其他目录的 cpp 代码文件时是否是 Xcode 错误?
- php - PHP Soap 客户端处理多部分/相关
- c# - 找不到实体框架插入字段时出错
- java - BCFIPS - org.bouncycastle.crypto.fips.FipsOperationError:模块校验和失败:预期这得到了
- javascript - 使用 CSS-in-JS 时,我应该为 CSS 类使用哪种大小写?
- python - 如何将参数传递给 scipy.optimize 中的非线性约束?
- javascript - 从 Firestore 获取值并使用异步将输出存储为全局
- c# - Linq to SQL/Entities:最大的 N-Per 组问题/性能提升
- javascript - 限制用户在输入字段 angular 12 中输入特定值
- graphql - 使用 graphql 查询变量来搜索匹配两个不同搜索的值的正确方法是什么?