I am using Dropwizard 1.0.2 .
resources:
package com.bocom.forward.resources;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.bocom.forward.views.DeviceListView;
@Path("/devices")
@Produces(MediaType.TEXT_HTML)
@Consumes(MediaType.APPLICATION_JSON)
public class DeviceInfo {
@GET
public DeviceListView fetch() {
return new DeviceListView();
}
}
view:
public class DeviceListView extends View {
private final Map<String, DeviceConvert> forwardDeviceMap;
private final Map<String, HighConsumer> kafkaMap;
public DeviceListView() {
super("DeviceDataForwardStatusList.ftl",StandardCharsets.UTF_8);
this.forwardDeviceMap=ForwardServerZK.getForwardDeviceMap();
this.kafkaMap = KafkaConsumerMap.kafkaMap;
}
public Map<String, DeviceConvert> getForwardDeviceMap() {
return forwardDeviceMap;
}
public Map<String, HighConsumer> getKafkaMap() {
return kafkaMap;
}
}
WARN [08:21:24.175] [dw-397] o.e.j.s.HttpChannel - //11.136.0.52:9999/devices
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I
at com.codahale.metrics.jetty9.InstrumentedHandler.updateResponses(InstrumentedHandler.java:291)
at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:254)
at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51)
at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:459)
at io.dropwizard.jetty.BiDiGzipHandler.handle(BiDiGzipHandler.java:68)
at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56)
at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:524)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
at org.eclipse.jetty.server.HttpConnection.onFillable(H
mvn dependency:tree:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ forwardserverdw ---
[INFO] cn.bocom.spzh.its.srv:forwardserverdw:jar:0.0.1
[INFO] +- io.dropwizard:dropwizard-core:jar:1.0.2:compile
[INFO] | +- io.dropwizard:dropwizard-util:jar:1.0.2:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.7.6:compile
[INFO] | | +- com.google.guava:guava:jar:19.0:compile
[INFO] | | +- com.google.code.findbugs:jsr305:jar:3.0.1:compile
[INFO] | | \- joda-time:joda-time:jar:2.9.4:compile
[INFO] | +- io.dropwizard:dropwizard-jackson:jar:1.0.2:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.7.6:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.7.6:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.7.6:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.7.6:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.7.6:compile
[INFO] | | +- com.fasterxml.jackson.module:jackson-module-afterburner:jar:2.7.6:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.7.6:compile
[INFO] | | \- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] | +- io.dropwizard:dropwizard-validation:jar:1.0.2:compile
[INFO] | | +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] | | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | | +- org.jboss.logging:jboss-logging:jar:3.2.1.Final:compile
[INFO] | | | \- com.fasterxml:classmate:jar:1.1.0:compile
[INFO] | | \- org.glassfish:javax.el:jar:3.0.0:compile
[INFO] | +- io.dropwizard:dropwizard-configuration:jar:1.0.2:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.7.6:compile
[INFO] | | | \- org.yaml:snakeyaml:jar:1.15:compile
[INFO] | | \- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | +- io.dropwizard:dropwizard-logging:jar:1.0.2:compile
[INFO] | | +- io.dropwizard.metrics:metrics-logback:jar:3.1.2:compile
[INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] | | +- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] | | +- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] | | +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] | | \- org.eclipse.jetty:jetty-util:jar:9.3.9.v20160517:compile
[INFO] | +- io.dropwizard:dropwizard-metrics:jar:1.0.2:compile
[INFO] | +- io.dropwizard:dropwizard-jersey:jar:1.0.2:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-server:jar:2.23.1:compile
[INFO] | | | +- org.glassfish.jersey.core:jersey-common:jar:2.23.1:compile
[INFO] | | | | +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.23.1:compile
[INFO] | | | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | | | +- org.glassfish.jersey.core:jersey-client:jar:2.23.1:compile
[INFO] | | | +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] | | | +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.23.1:compile
[INFO] | | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | | +- org.glassfish.hk2:hk2-api:jar:2.4.0-b34:compile
[INFO] | | | | +- org.glassfish.hk2:hk2-utils:jar:2.4.0-b34:compile
[INFO] | | | | \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b34:compile
[INFO] | | | +- org.glassfish.hk2.external:javax.inject:jar:2.4.0-b34:compile
[INFO] | | | \- org.glassfish.hk2:hk2-locator:jar:2.4.0-b34:compile
[INFO] | | | \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | | +- org.glassfish.jersey.ext:jersey-metainf-services:jar:2.23.1:compile
[INFO] | | +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.23.1:compile
[INFO] | | +- io.dropwizard.metrics:metrics-jersey2:jar:3.1.2:compile
[INFO] | | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.7.6:compile
[INFO] | | | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.7.6:compile
[INFO] | | | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.7.6:compile
[INFO] | | +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.23.1:compile
[INFO] | | | \- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.23.1:compile
[INFO] | | +- org.eclipse.jetty:jetty-server:jar:9.3.9.v20160517:compile
[INFO] | | | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] | | | \- org.eclipse.jetty:jetty-io:jar:9.3.9.v20160517:compile
[INFO] | | +- org.eclipse.jetty:jetty-webapp:jar:9.3.9.v20160517:compile
[INFO] | | | \- org.eclipse.jetty:jetty-xml:jar:9.3.9.v20160517:compile
[INFO] | | \- org.eclipse.jetty:jetty-continuation:jar:9.3.9.v20160517:compile
[INFO] | +- io.dropwizard:dropwizard-servlets:jar:1.0.2:compile
[INFO] | | \- io.dropwizard.metrics:metrics-annotation:jar:3.1.2:compile
[INFO] | +- io.dropwizard:dropwizard-jetty:jar:1.0.2:compile
[INFO] | | +- io.dropwizard.metrics:metrics-jetty9:jar:3.1.2:compile
[INFO] | | +- org.eclipse.jetty:jetty-servlet:jar:9.3.9.v20160517:compile
[INFO] | | | \- org.eclipse.jetty:jetty-security:jar:9.3.9.v20160517:compile
[INFO] | | +- org.eclipse.jetty:jetty-servlets:jar:9.3.9.v20160517:compile
[INFO] | | \- org.eclipse.jetty:jetty-http:jar:9.3.9.v20160517:compile
[INFO] | +- io.dropwizard:dropwizard-lifecycle:jar:1.0.2:compile
[INFO] | +- io.dropwizard.metrics:metrics-core:jar:3.1.2:compile
[INFO] | +- io.dropwizard.metrics:metrics-jvm:jar:3.1.2:compile
[INFO] | +- io.dropwizard.metrics:metrics-servlets:jar:3.1.2:compile
[INFO] | | \- io.dropwizard.metrics:metrics-json:jar:3.1.2:compile
[INFO] | +- io.dropwizard.metrics:metrics-healthchecks:jar:3.1.2:compile
[INFO] | +- io.dropwizard:dropwizard-request-logging:jar:1.0.2:compile
[INFO] | | \- ch.qos.logback:logback-access:jar:1.1.7:compile
[INFO] | +- net.sourceforge.argparse4j:argparse4j:jar:0.7.0:compile
[INFO] | \- org.eclipse.jetty.toolchain.setuid:jetty-setuid-java:jar:1.0.3:compile
[INFO] +- io.dropwizard:dropwizard-metrics-graphite:jar:1.0.2:compile
[INFO] | \- io.dropwizard.metrics:metrics-graphite:jar:3.1.2:compile
[INFO] +- io.dropwizard:dropwizard-assets:jar:1.0.2:compile
[INFO] +- io.dropwizard:dropwizard-views-freemarker:jar:1.0.2:compile
[INFO] | +- io.dropwizard:dropwizard-views:jar:1.0.2:compile
[INFO] | \- org.freemarker:freemarker:jar:2.3.23:compile
[INFO] +- org.apache.kafka:kafka-clients:jar:0.8.2.1:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.6:compile
[INFO] | +- net.jpountz.lz4:lz4:jar:1.2.0:compile
[INFO] | \- org.xerial.snappy:snappy-java:jar:1.1.1.6:compile
[INFO] +- org.apache.kafka:kafka_2.10:jar:0.8.2.1:compile
[INFO] | +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] | +- org.scala-lang:scala-library:jar:2.10.4:compile
[INFO] | +- org.apache.zookeeper:zookeeper:jar:3.4.6:compile
[INFO] | | +- jline:jline:jar:0.9.94:compile
[INFO] | | | \- junit:junit:jar:3.8.1:compile
[INFO] | | \- io.netty:netty:jar:3.7.0.Final:compile
[INFO] | \- net.sf.jopt-simple:jopt-simple:jar:3.2:compile
[INFO] +- com.101tec:zkclient:jar:0.5:compile
[INFO] | \- log4j:log4j:jar:1.2.15:compile
[INFO] | \- javax.mail:mail:jar:1.4:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] | +- commons-lang:commons-lang:jar:2.6:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] | \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- commons-dbutils:commons-dbutils:jar:1.6:compile
[INFO] +- commons-io:commons-io:jar:2.5:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile
[INFO] | \- commons-codec:commons-codec:jar:1.9:compile
[INFO] +- org.apache.httpcomponents:httpmime:jar:4.5.2:compile
[INFO] +- com.cloudhopper.proxool:proxool:jar:0.9.1:compile
[INFO] | \- avalon-framework:avalon-framework-api:jar:4.3:compile (version selected from constraint [4.1.5,))
[INFO] | \- avalon-logkit:avalon-logkit:jar:2.1:compile
[INFO] | +- javax.servlet:servlet-api:jar:2.3:compile
[INFO] | +- geronimo-spec:geronimo-spec-javamail:jar:1.3.1-rc3:compile
[INFO] | \- geronimo-spec:geronimo-spec-jms:jar:1.1-rc4:compile
[INFO] +- com.cloudhopper.proxool:proxool-cglib:jar:0.9.1:compile
[INFO] +- com.oracle:ojdbc6:jar:11.2.0:compile
[INFO] +- it.sauronsoftware.cron4j:cron4j:jar:2.2.5:compile
[INFO] +- org.jdom:jdom:jar:1.1.3:compile
[INFO] +- com.github.adyliu:zkclient:jar:2.1.1:compile
[INFO] \- its-hessian:its-hessian:jar:1.0:system
remove +- javax.servlet:servlet-api:jar:2.3:compile.
hehe
Thanks, you saved me a ton of trouble!
@gogo649 Thanks, worked for me too.
Can u please explain, how you arrived at that conclusion?
servlet-api is required twice:
javax.servlet:javax.servlet-api:jar:3.1.0:compilejavax.servlet:servlet-api:jar:2.3:compileThe second version is required by com.cloudhopper.proxool:proxool:jar:0.9.1:compile which is an additional dependency added to those that Dropwizard adds. So there are incompatible versions of servlet-api on the classpath.
The solution hence is to exclude the older version.
Most helpful comment
remove +- javax.servlet:servlet-api:jar:2.3:compile.
hehe