[ spring _ web ]라는 이름의 fragment가 여러 개 발견되었습니다.이것은 상대적인 주문에서는 합법적이지 않습니다.
인텔의 임베디드 서버를 사용하여 실행하면 정상적으로 동작하는 스프링 부트 어플리케이션이 있습니다.그러나 .war 파일로 패키징하여 Tomcat에 전개하면 다음 오류가 발생합니다.
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/file-upload-0.0.1-SNAPSHOT]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
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$DeployWar.run(HostConfig.java:1857)
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:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: More than one fragment with the name [spring_web] 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.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2200)
at
org.apache.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2159)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1124)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:769)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5176)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
21-Jan-2019 01:51:04.709 SEVERE [localhost-startStop-1]
org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [C:\Users\dennismo\Dev\Projects\Production Prep\file-upload-module\webapps\file-upload-0.0.1-SNAPSHOT.war]
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/file-upload-0.0.1-SNAPSHOT]]
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:758)
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$DeployWar.run(HostConfig.java:1857)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
제 프로젝트에는 여러 개의 웹 조각이 포함되어 있지 않기 때문에 무엇이 이 문제의 원인인지 알 수 없습니다.
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from salaryPaymentRequestRepo -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<akka.version>2.5.17</akka.version>
</properties>
<repositories>
<repository>
<id>default</id>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>2.7.6</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>26.0-jre</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.11.0</version>
</dependency>
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
<version>1.4.2</version><!-- or latest version -->
<exclusions>
<exclusion>
<artifactId>javassist</artifactId>
<groupId>org.javassist</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.12</artifactId>
<version>${akka.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-stream_2.12</artifactId>
<version>${akka.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-persistence_2.12</artifactId>
<version>${akka.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-testkit_2.12</artifactId>
<version>${akka.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/lib/ojdbc7-12.1.0.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<absolute-ordering />를 붙입니다.web.xml the의 바로 <display-name>태그. 작동해야 합니다.
서버 청소는 나에게 효과가 있었다.다음 작업을 수행합니다.
서버에서 오른쪽 클릭 -> Clean.
그런 다음 서버에 앱을 다시 배포합니다.
스프링의 두 가지 버전이 있는 것처럼 들리는데, 다른 스프링 버전에 종속되어 있는지 여부를 확인하십시오.
mvn dependency:tree -Dverbose -Dincludes=groupId:artifactId
maven으로 war 파일을 작성할 때도 같은 문제가 있었습니다.왜냐하면 maven은 패키징 전에 클리닝을 하지 않았고 maven은 이전 빌드로부터 여러 버전의 spring jar 파일을 포함하고 있었기 때문입니다.
는 프로젝트의 업데이트 Tomcat에 이력 할 수 .webapps문제를 해결할 수 있습니다.
이 문제는 전개 기술자의 절대 순서를 추가하는 것으로 해결되었습니다.
' '<absolute-ordering/>.xml에 되었습니다.
레퍼런스:
https://www.oracle.com/technetwork/articles/javaee/javaee6overview-part2-136353.html
메이븐 스프링 프레임워크 이 할 수 .mvn cleanSpring JARs (스프링 JAR)
일반적으로 이 오류는 컨테이너에 스프링 복사본이 두 개 있고 서로 다른 클래스 로더(이 경우 공유 클래스 로더와 webapp 클래스 로더)에 의해 로드되는 경우 발생합니다.
효과적인 폼을 체크합니다.스프링 병/클래스가 번들 내장되어 있는 경우는, 그것을 떼어내면, 컨테이너에서 번들로 인스톨 되어 있는 것을 사용해야 합니다.
모든 Jars를 수동으로 추가할 경우 WEB-INF/lib/spring-web-5.2.9를 삭제해야 합니다.RELEASE-sources.jar 또는 이와 유사한 jar 파일(사용하는 jar 버전은 다를 수 있습니다).해당 jar tomcat을 삭제하면 작업이 시작됩니다.
제 프로젝트는 Springboot 기반 버전(1.5.21)입니다.RELEASE) 및 물리 Tomcat에서의 전쟁 생성 및 전개.저는 같은 문제를 안고 아래 방법으로 해결했습니다.
솔루션:pom.xml의 spring-boot-starter-web에서 tomcat-embedded-websocket 의존관계 제외
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.boot.version}</version>
<exclusions>
**<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
</exclusion>**
</exclusions>
</dependency>
신입사원들로부터 신입사원들에게 받은 답변입니다.
web.xml을 /WebContent/WEB-INF 내에 배치해야 합니다.
실수로 /WEB-INF가 아닌 /WEBContent에 넣었는데, 제안된 솔루션 중 몇 가지를 적용하려다 실패해서 미칠 뻔했는데, 오류 메시지가 그대로였습니다.
저에게 이것은 봄의 복사본을 묶은 "그림자 항아리"를 포함하고 있다는 것을 의미했습니다.그래서 모두 같은 "봄 버전"이지만 여러 개의 봄 복사본이 원인이 됩니다.
는 URL에서 하실 수 .tomcat/webapps/your_webapp/WEB-INF/lib spring_web,을 검색합니다.
예:
# first unjar everything then
WEB-INF/lib $ grep spring_web . -r
spring-web-4.3.12.RELEASE/META-INF/web-fragment.xml
7: <name>spring_web</name>
some_other_shaded_jar/META-INF/web-fragment.xml
7: <name>spring_web</name>
이 경우 다른 답변의 절대적인 수정을 사용하거나 스프링 복사본을 여러 개 포함시키지 않아야 합니다.
이것은 Tomcat 7.0.93 FWIW에서 도입된 변경인 것 같습니다(따라서 이전 버전의 Tomcat 7에서는 이 장애가 발생하지 않았습니다).
된 web.xml).<absolute-ordering/>tag)를 .
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<absolute-ordering/>
</web-app>
나도 같은 문제를 안고 해결했다.유사한 오류가 발생하지만 스프링 부트를 사용하지 않았다.java 8에서 spring 3.x를 사용한 적이 있습니다.위의 솔루션이 작동하지 않을 경우 jars를 변경하고 해당 jars가 사용 중인 Java 버전과 호환되는지 여부를 검색합니다.spring 3.x는 Java 8과 호환되지 않습니다.
webapps 폴더에서 모든 앱(다른 두 개의 앱이 있음)을 삭제하고 전쟁 파일을 다시 배포하여 비슷한 문제를 해결했습니다.
web.xml에 이 기능을 추가하기 위해 이 기능을 추가해야 합니다.
<absolute-ordering>
<name>fragment_name_if_required</name>
<others></others>
</absolute-ordering>
이 모든 답변은 훌륭하지만 "Apache CXF" lib가 클래스 패스에 있는지 확인합니다.Spring Web 5.2.3과 모순되는 것 같습니다.실제로 사용하지 않고 있으며 현재 프로젝트가 정상적으로 실행되고 있기 때문에 일시적으로 삭제했습니다.
이 문제는 Tomcat이 올바르게 설치되지 않았을 때 발생했습니다.다음 위치에서 설치 경로를 다시 설치하고 업데이트했습니다.
eclipse window->preferences->runtime ENV -> path of the newly installed tomcat
올바른 경로를 설정한 후 정상적으로 작동했습니다.
저에게는 2개의 스프링 웹 jar, 즉 빌드 경로의 spring-web-5.02-release.jar와 spring-web-sources-5.02-release.jar가 원인입니다.spring-web-sources-5.02-release.jar를 삭제하면 문제가 해결됩니다.
같은 문제가 있어서 근본 원인을 밝혀내고 싶었다.나는 스프링웹 항아리의 조각이 '스프링_웹'이라고 불리는 것을 알았다.그러나 제 소스 코드에는 'spring_web' fragment가 없습니다.그래서 툴(jfind)을 사용하여 빌드 시 생성된 EAR의 확장 형태로 'spring_web'을 검색했습니다.놀랍게도 'spring_web'은 빌드 시 생성된 다른 프로젝트의 웹 조각 항아리에서 발견되었습니다.이 두 번째 문제를 해결하자 이 문제는 해결되었습니다.spring_web fragment가 중복되어 있기 때문에 1개만 있으면 되는 것 같습니다.
이전에 다른 버전으로 프로젝트를 빌드한 후 버전을 변경하고 다시 빌드하려고 하면 이 예외가 느려집니다.응용 프로그램에서 대상 폴더를 삭제할 수 있습니다.그래도 예외가 발생할 경우 터미널에서 프로젝트 디렉토리로 이동하여mvn clean install
lib 폴더에서 사용되지 않는 종속성을 모두 제거합니다.이제 서버에서 응용 프로그램을 다시 실행해 보십시오.지금 효과가 있기를 바랍니다.
난 이 몇 시간 동안 싸우고 있었어.해결책은 IntelliJ 캐시를 무효화하는 것이었습니다.이 문제는 스프링 프레임워크를 업그레이드 할 때 나타났습니다.Intelij는 같은 라이브러리의 두 버전을 패키징하고 있었기 때문에 오류가 발생했습니다.
이것은, 에서 의존 관계의 1개의 버전을 변경했을 때에 발생했습니다.pom.xml웹 앱의 배포 및 배포를 해제하고 수정했습니다.
다음 Line in error log를 참조하십시오.
Caused by: java.lang.IllegalArgumentException: More than one fragment with the name [spring_web] 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.
절대적인 순서를 사용하라고 되어 있습니다.그래서 더해야 합니다.<absolute-ordering/>태그 인web.xml줄서다<web-app>태그를 붙입니다.
언급URL : https://stackoverflow.com/questions/54290263/more-than-one-fragment-with-the-name-spring-web-was-found-this-is-not-legal-w
'programing' 카테고리의 다른 글
| extract-text-webpack-plugin React 사용 시 window not defined 오류 발생 (0) | 2023.03.21 |
|---|---|
| RETS MLS 및 RETS 클라이언트 (0) | 2023.03.21 |
| 같은 페이지에서 Greasemonkey 스크립트를 여러 번 실행하시겠습니까? (0) | 2023.03.21 |
| Convert a JSON schema to a python class (0) | 2023.03.21 |
| 닫힘 이벤트 후 각도 의 모달 (0) | 2023.03.21 |