I am migrating a web application to a Spring Boot application which fails to start and displays the following error message :
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
As there is just one location (C:/Users/xyz/.m2/repository/org/eclipse/jetty/jetty-
server/8.2.0.v20160908/jetty-server-8.2.0.v20160908.jar) as pointed by Spring Boot, there should be no ambiguity. I have provided all the required maven dependencies with version 8.2.0.v20160908. I have excluded tomcat dependency (spring-boot-starter-tomcat
) from spring-boot-starter-web
as I need to work with jetty. But I have NOT included jetty spring boot starter dependency in spring-boot-starter-web
as I already have embedded jetty dependencies with group id org.eclipse.jetty
defined through which jetty dependencies (jetty-server, jetty-servlet, jetty-security, jetty-http, jetty-util, jetty-webapp, jetty-xml, jetty-io, jetty-deploy etc) are provided.
The Spring Boot version is v2.1.1.RELEASE
.
The jetty server is defined as spring bean which is as follows
<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 looks like the following :
public class Server extends org.eclipse.jetty.server.Server implements
ApplicationListener<ApplicationContextEvent> {
// code here
}
I am not sure here what Spring Boot is expecting here. I do not have any other jetty versions as I see in Maven Dependency Hierarchy. All maven dependencies are on classpath.
Any pointers ?
Thanks!