Can anyone say me what is the main cause of reason for the below error?
i am using gretty as a plugin to run my war file using jetty. Following is my configuration in a gradle file for it. I am also using java17 here
plugins {
id 'war'
id 'eclipse'
id 'org.gretty'
}
gretty {
httpPort = 8080
scanInterval = 2
// servletContainer = 'tomcat10'
servletContainer = 'jetty11'
}
war {
archiveFileName = "configapi.war"
}
dependencies {
implementation group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet', version: '3.1.3'
implementation group: 'org.glassfish.jersey.core', name: 'jersey-server', version: '3.1.3'
// implementation group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.15.2'
implementation group: 'com.fasterxml.jackson.jakarta.rs', name: 'jackson-jakarta-rs-json-provider', version: '2.16.1'
implementation(group: 'org.glassfish.jersey.ext', name: 'jersey-bean-validation', version: '3.1.3') {
// exclude(group: 'javax.el', module: 'javax.el-api')
// exclude(group: 'jakarta.el', module: 'jakarta.el-api')
}
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0'
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
implementation 'com.sun.jersey.contribs:jersey-contribs:1.19'
implementation 'org.codehaus.jackson:jackson-core-asl:1.9.13'
implementation 'org.apache.zookeeper:zookeeper:3.8.3'
implementation(group: 'log4j', name: 'log4j', version: '1.2.16')
implementation(group: 'log4j', name: 'apache-log4j-extras', version: '1.1')
implementation 'org.glassfish.jersey.media:jersey-media-multipart:3.1.3'
implementation group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '3.1.3'
implementation group: 'com.google.guava', name: 'guava', version: '32.1.3-jre'
implementation group: 'com.github.java-json-tools', name: 'json-schema-validator', version: '2.2.14'
// implementation group: 'jakarta.el', name: 'jakarta.el-api', version: '5.0.1'
// implementation group: 'org.glassfish', name: 'jakarta.el', version: '4.0.2'
implementation(group: 'org.apache.hadoop', name: 'hadoop-client', version: '3.3.6') {
exclude(group: 'com.sun.jersey')
exclude(group: 'javax.servlet', module: 'servlet-api')
exclude(group: 'javax.servlet.jsp', module: 'jsp-api')
exclude(group: 'jakarta.servlet', module: 'servlet-api')
exclude(group: 'jakarta.servlet.jsp', module: 'jsp-api')
}
// compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '5.0.0'
/** added for unit tests **/
implementation group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: '3.1.3'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.5.0'
implementation group: 'org.glassfish.jersey.containers', name: 'jersey-container-grizzly2-http', version: '3.1.3'
implementation group: 'org.glassfish.grizzly', name: 'grizzly-http-servlet', version: '4.0.0'
// testImplementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
testImplementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2'
// testImplementation group: 'org.glassfish.web', name: 'javax.el', version: '2.2.6'
testImplementation group: 'jakarta.el', name: 'jakarta.el-api', version: '5.0.1'
testImplementation group: 'org.apache.curator', name: 'curator-test', version: '5.2.0'
}
test {
exclude '**/*restapis/services/v*/*Test.class'
include '**/*Test.class'
include '**/TestAll.class'
}
sonarqube {
properties {
property "sonar.projectVersion", version
property "sonar.java.coveragePlugin", "jacoco"
}
}
When i tried to run command gradle
:configapi:CodeGenerator:configapi:jettyRunWar
. It gave me following error:
oag.JettyConfigurerImpl:main: Error starting server jakarta.servlet.UnavailableException: Servlet class org.eclipse.jetty.servlet.DefaultServlet is not a jakarta.servlet.Servlet.
Can someone help me out why i am getting this issue here.
I tried to make compatible with jetty11 by updating the gradle file below but still i am getting same error
plugins {
id 'war'
id 'eclipse'
id 'org.gretty'
}
gretty {
httpPort = 8080
scanInterval = 2
// servletContainer = 'tomcat10'
servletContainer = 'jetty11'
}
war {
archiveFileName = "configapi.war"
}
dependencies {
implementation group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet', version: '3.0.2'
implementation group: 'org.glassfish.jersey.core', name: 'jersey-server', version: '3.0.2'
// implementation group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.15.2'
implementation group: 'com.fasterxml.jackson.jakarta.rs', name: 'jackson-jakarta-rs-json-provider', version: '2.16.1'
implementation(group: 'org.glassfish.jersey.ext', name: 'jersey-bean-validation', version: '3.0.2') {
// exclude(group: 'javax.el', module: 'javax.el-api')
// exclude(group: 'jakarta.el', module: 'jakarta.el-api')
}
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0'
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
implementation 'com.sun.jersey.contribs:jersey-contribs:1.19'
implementation 'org.codehaus.jackson:jackson-core-asl:1.9.13'
implementation 'org.apache.zookeeper:zookeeper:3.8.3'
implementation(group: 'log4j', name: 'log4j', version: '1.2.16')
implementation(group: 'log4j', name: 'apache-log4j-extras', version: '1.1')
implementation 'org.glassfish.jersey.media:jersey-media-multipart:3.0.2'
implementation group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '3.0.2'
implementation group: 'com.google.guava', name: 'guava', version: '32.1.3-jre'
implementation group: 'com.github.java-json-tools', name: 'json-schema-validator', version: '2.2.14'
// implementation group: 'jakarta.el', name: 'jakarta.el-api', version: '5.0.1'
// implementation group: 'org.glassfish', name: 'jakarta.el', version: '4.0.2'
implementation(group: 'org.apache.hadoop', name: 'hadoop-client', version: '3.3.6') {
exclude(group: 'com.sun.jersey')
exclude(group: 'javax.servlet', module: 'servlet-api')
exclude(group: 'javax.servlet.jsp', module: 'jsp-api')
exclude(group: 'jakarta.servlet', module: 'servlet-api')
exclude(group: 'jakarta.servlet.jsp', module: 'jsp-api')
}
// compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
compileOnly group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '5.0.0'
/** added for unit tests **/
implementation group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: '3.0.2'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.5.0'
implementation group: 'org.glassfish.jersey.containers', name: 'jersey-container-grizzly2-http', version: '3.0.2'
implementation group: 'org.glassfish.grizzly', name: 'grizzly-http-servlet', version: '4.0.0'
// testImplementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
testImplementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2'
// testImplementation group: 'org.glassfish.web', name: 'javax.el', version: '2.2.6'
testImplementation group: 'jakarta.el', name: 'jakarta.el-api', version: '5.0.1'
testImplementation group: 'org.apache.curator', name: 'curator-test', version: '5.2.0'
}
test {
exclude '**/*restapis/services/v*/*Test.class'
include '**/*Test.class'
include '**/TestAll.class'
}
sonarqube {
properties {
property "sonar.projectVersion", version
property "sonar.java.coveragePlugin", "jacoco"
}
}