我正在将Web应用程序迁移到无法启动的Spring Boot应用程序,并显示以下错误消息:
An attempt was made to call the method org.eclipse.jetty.server.Server.
<init>(Lorg/eclipse/jetty/util/thread/ThreadPool;)V but it does not
exist.
Its class, org.eclipse.jetty.server.Server, is available from the
following locations:
jar:file:/C:/Users/xyz/.m2/repository/org/eclipse/jetty/jetty-
server/8.2.0.v20160908/jetty-server-
8.2.0.v20160908.jar!/org/eclipse/jetty/server/Server.class
It was loaded from the following location:
file:/C:/Users/xyz/.m2/repository/org/eclipse/jetty/jetty-
server/8.2.0.v20160908/jetty-server-8.2.0.v20160908.jar
Action:
Correct the classpath of your application so that it contains a single,
compatible version of org.eclipse.jetty.server.Server
由于只有一个位置(C:/Users/xyz/.m2/repository/org/eclipse/jetty/jetty-
如Spring Boot所指出的server / 8.2.0.v20160908 / jetty-server-8.2.0.v20160908.jar),应该没有歧义。我已经为版本8.2.0.v20160908提供了所有必需的maven依赖项。由于需要与码头一起工作,因此从spring-boot-starter-tomcat
中排除了tomcat的依赖关系(spring-boot-starter-web
)。但是我尚未在spring-boot-starter-web
中包括码头安全启动器依赖项,因为我已经嵌入了码头安全性,其组ID为org.eclipse.jetty
,通过组ID定义了码头安全性(码头服务器,码头小服务程序,码头安全,码头安全) -http,jetty-util,jetty-webapp,jetty-xml,jetty-io,jetty-deploy等)。
Spring Boot版本为v2.1.1.RELEASE
。
Jetty服务器定义为如下所示的spring bean
<bean id="webServer" class="org.someorg.server.jetty.Server">
<property name="threadPool">
<bean class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<property name="minThreads" value="8" />
<property name="maxThreads" value="32" />
</bean>
</property>
<property name="connectors">
<list>
<bean class="org.someorg.server.jetty.XmlConnector">
<property name="port" value="34347" />
</bean>
<bean class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<property name="port" value="34346" />
<property name="keystore" value="classpath:keystore" />
<property name="password" value="somepassword" />
<property name="keyPassword" value="somekeypassword" />
<property name="truststore" value="classpath:keystore" />
<property name="trustPassword" value="sometrustpassword"
/>
</bean>
<bean
class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="34345" />
</bean>
</list>
</property>
<property name="handler">
<bean class="org.eclipse.jetty.server.handler.HandlerCollection">
<property name="handlers">
<list>
<ref bean="webContexts" />
<bean id="defaultHandler"
class="org.eclipse.jetty.server.handler.DefaultHandler" />
</list>
</property>
</bean>
</property>
<property name="beans">
<list>
<bean class="org.eclipse.jetty.deploy.WebAppDeployer">
<property name="contexts" ref="webContexts" />
<property name="webAppDir" value="webapps" />
</bean>
</list>
</property>
<property name="stopAtShutdown" value="false" />
</bean>`
Class Server如下所示:
public class Server extends org.eclipse.jetty.server.Server implements
ApplicationListener<ApplicationContextEvent> {
// code here
}
我不确定Spring Boot在这里期望什么。我没有在Maven依赖层次结构中看到的任何其他码头版本。所有的Maven依赖项都在classpath上。
任何指针吗?
谢谢!
答案 0 :(得分:1)
您使用的码头版本与所选的弹簧靴版本不兼容。
spring-boot-starter-web 2.1.1.RELEASE depends on spring-web 5.1.3.RELEASE其中depends on码头服务器9.4.14.v20181114。
您必须升级码头依赖性。