I have an strange exception while integration testing my Dropwizard 0.9.2 service. The exception and configuration are below.
I dont understand why requestLog is unknown? The DW documentation say, that below configuration part should work. The requestLog can be found in
io.dropwizard.server.AbstractServerFactory.class
and
io.dropwizard.server.DefaultServerFactory.class
extends it, so it should be possible to use the requestLog. Whats wrong here?
Someone knows this problem already?
Configuration Part
server:
requestLog:
timeZone: UTC
appenders:
- type: console
threshold: DEBUG
- type: file
currentLogFilename: ./log/access.log
threshold: ALL
archive: true
archivedLogFilenamePattern: ./log/access.%d.log.gz
archivedFileCount: 14
maxThreads: 1024
minThreads: 8
maxQueuedRequests: 1024
applicationConnectors:
- type: http
port: 80
adminConnectors:
- type: http
port: 12345
Exception
java.lang.RuntimeException: io.dropwizard.configuration.ConfigurationParsingException: myService.yml has an error:
* Unrecognized field at: server.requestLog
Did you mean?:
- adminConnectors
- adminContextPath
- adminMaxThreads
- adminMinThreads
- applicationConnectors
[1 more]
at com.google.common.base.Throwables.propagate(Throwables.java:160)
at io.dropwizard.testing.DropwizardTestSupport.startIfRequired(DropwizardTestSupport.java:214)
at io.dropwizard.testing.DropwizardTestSupport.before(DropwizardTestSupport.java:115)
at io.dropwizard.testing.junit.DropwizardAppRule.before(DropwizardAppRule.java:87)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: io.dropwizard.configuration.ConfigurationParsingException: myservice.yml has an error:
* Unrecognized field at: server.requestLog
Did you mean?:
- adminConnectors
- adminContextPath
- adminMaxThreads
- adminMinThreads
- applicationConnectors
[1 more]
at io.dropwizard.configuration.ConfigurationParsingException$Builder.build(ConfigurationParsingException.java:271)
at io.dropwizard.configuration.ConfigurationFactory.build(ConfigurationFactory.java:163)
at io.dropwizard.configuration.ConfigurationFactory.build(ConfigurationFactory.java:95)
at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:115)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:64)
at io.dropwizard.testing.DropwizardTestSupport.startIfRequired(DropwizardTestSupport.java:212)
... 11 more
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "requestLog" (class io.dropwizard.server.DefaultServerFactory), not marked as ignorable (6 known properties: "adminMaxThreads", "adminConnectors", "applicationConnectors", "applicationContextPath", "adminMinThreads", "adminContextPath"])
at [Source: N/A; line: -1, column: -1] (through reference chain: .....
The same error arose for me with more recent versions of jackson, when I added a dependency that pulled in
com.fasterxml.jackson.core:jackson-databind:jar:2.7.2
Excluding
jackson-databind
from that dependency in pom.xml resolved it.we had the same issue. It was a problem of using an older version of Jackson. We'Ve upgraded from v
2.6.3
to v2.6.5
and the error was gone.