Java.lang.NoSuchMethodError: org.apache.tomcat.util.res.StringManager.getManager с tomcat в Spring hetos

Я пытаюсь создать пример приложения Spring hateos и борюсь с приведенным ниже исключением:

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/hetos-medias]]
 at java.util.concurrent.FutureTask.report(FutureTask.java:122)
 at java.util.concurrent.FutureTask.get(FutureTask.java:192)
 at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
 at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:816)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
 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: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/hetos-medias]]
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
 ... 6 more
Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.res.StringManager.getManager(Ljava/lang/Class;)Lorg/apache/tomcat/util/res/StringManager;
 at org.apache.tomcat.websocket.WsWebSocketContainer.<clinit>(WsWebSocketContainer.java:77)
 at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131)
 at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:47)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5481)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 ... 6 more
</clinit>

похоже, что для класса org.apache.tomcat.util.res.StringManager.getManager может быть дубликат jar, но я не нашел дубликат jar в моем пути к классам. Я использую tomcat 7 и ниже - мои данные pom.xml и библиотеки.

<dependencies>
 <dependency>
 <groupid>org.springframework.boot</groupid>
 <artifactid>spring-boot-starter-hateoas</artifactid>
 <version>1.4.0.RELEASE</version>
 </dependency>
 <dependency>
 <groupid>org.springframework.boot</groupid>
 <artifactid>spring-boot-starter-test</artifactid>
 <scope>test</scope>
 <version>1.4.0.RELEASE</version>
 </dependency>
 <dependency>
 <groupid>com.jayway.jsonpath</groupid>
 <artifactid>json-path</artifactid>
 <scope>test</scope>
 <version>2.2.0</version>
 </dependency>
 </dependencies>
 <properties>
 <java.version>1.8</java.version>
 </properties>
 <repositories>
 <repository>
 <id>spring-releases</id>
 <url>https://repo.spring.io/libs-release</url>
 </repository>
 </repositories>
 <pluginrepositories>
 <pluginrepository>
 <id>spring-releases</id>
 <url>https://repo.spring.io/libs-release</url>
 </pluginrepository>
 </pluginrepositories>

1 ответ

Вы должны установить следующее в pom.xml

<tomcat.version>7.0.59</tomcat.version>

См. https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-servlet-containers.html

licensed under cc by-sa 3.0 with attribution.