Reputation: 59
still quite new to Gradle in general so hopefully this isn't a silly question, but I'm running into this issue when running the container (which immediately crashes the container).
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1319)
The following method did not exist:
'java.lang.String javax.servlet.ServletContext.getVirtualServerName()'
The method's class, javax.servlet.ServletContext, is available from the following locations:
jar:file:/app/lib/servlet-api-2.5-6.1.14.jar!/javax/servlet/ServletContext.class
jar:file:/app/lib/javax.servlet-api-4.0.1.jar!/javax/servlet/ServletContext.class
jar:file:/app/lib/tomcat-embed-core-9.0.62.jar!/javax/servlet/ServletContext.class
jar:file:/app/lib/servlet-api-2.5-20081211.jar!/javax/servlet/ServletContext.class
The class hierarchy was loaded from the following locations:
javax.servlet.ServletContext: file:/app/lib/servlet-api-2.5-6.1.14.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.ServletContext
I have tried adding
configurations.all {
exclude group: '', module: 'servlet-api'
}
But it looks to remove the other version of the servlet api (the error specifies it is looking in servlet-api-2.5-6.1.14.jar, but it removed the servlet-api-2.5-20081211.jar, because the error output after building and running is now:
The method's class, javax.servlet.ServletContext, is available from the following locations:
jar:file:/app/lib/servlet-api-2.5-6.1.14.jar!/javax/servlet/ServletContext.class
jar:file:/app/lib/javax.servlet-api-4.0.1.jar!/javax/servlet/ServletContext.class
jar:file:/app/lib/tomcat-embed-core-9.0.62.jar!/javax/servlet/ServletContext.class
The class hierarchy was loaded from the following locations:
javax.servlet.ServletContext: file:/app/lib/servlet-api-2.5-6.1.14.jar
I have run a dependency task and the servlet-api is dependant on org.apache.hadoop:hadoop-core:1.2.1
What's the best way to go about solving this issue? I have tried excluding and giving the exact version number, but that doesn't seem to work. I also tried adding in a newer version of the hadoop core dependency (that would come bundled with a newer version of the servlet-api. as I believe I need 3.1+ (I have 2.5)), but that also didn't seem to work
Upvotes: 0
Views: 131
Reputation: 29
I think the error
The following method did not exist:
'java.lang.String javax.servlet.ServletContext.getVirtualServerName()'
is because the version of your servlet API is older than 3.1 and the method getVirtualServerName() was introduced in 3.1 and later versions.
Upvotes: 1