【发布时间】:2017-02-16 19:08:05
【问题描述】:
使用dropwizard 0.9.2版本,配置yml看起来有点像这样
server:
applicationConnectors:
- type: http
port: 8090
adminConnectors:
- type: http
port: 8091
requestLog:
timeZone: UTC
appenders:
- type: file
currentLogFilename: file
threshold: ALL
archive: true
archivedLogFilenamePattern: some-pattern
archivedFileCount: 5
maxFileSize: 10MB
执行时出现以下错误
* Unrecognized field at: server.requestLog
Did you mean?:
- adminConnectors
- adminContextPath
- adminMaxThreads
在搜索中,这个错误似乎在 Jackson 中是已知的,并在 2.7.3 中修复。因此,将 dropwizard 升级到最新的 1.0.2,但问题仍然存在。
此外,尝试明确排除 jackson 并包含最新的 2.8.3 也无济于事。有关解决此问题的任何意见?
试过了
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>0.9.2</version>
<exclusions>
<exclusion>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-jackson</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-jackson</artifactId>
<version>1.0.2</version>
</dependency>
【问题讨论】:
-
由于您正在混合依赖项,您的类路径中是否有旧版本的 DefaultServerFactory 的变化?
-
已删除完整的 .m2 本地存储库以确保安全。没有重叠的类路径
-
也许它们是通过其他依赖关系引入的。你可以做一个 mvn 依赖:树。开箱即用的 DW 1.0.0 对我来说效果很好。请注意,0.9.2 和 1.0.0 之间也存在重大变化(时区已消失)
-
谢谢它帮助了一点。由于时区消失了,服务器请求日志如何工作。你能指导我一些资源吗?我无法让访问日志正常工作。
-
这取决于您使用的版本,因为配置已更改。由于您在问题中使用了 2 个不同的版本,我不清楚,但请求日志示例在他们的官方文档页面上:dropwizard.io/1.0.2/docs/manual/configuration.html#request-log
标签: java maven jackson dropwizard