简体   繁体   English

无法识别的字段位于:数据库Dropwizard / Java 8

[英]Unrecognized field at: database Dropwizard/Java 8

I am trying to use docker to run a server using dropwizard and a mysql database. 我正在尝试使用docker通过dropwizard和mysql数据库运行服务器。 I followed the tutorial and believe added the necessary files but still I am still getting the following error. 我按照该教程进行操作,并相信已添加了必要的文件,但是仍然出现以下错误。 https://www.dropwizard.io/0.7.1/docs/manual/jdbi.html . https://www.dropwizard.io/0.7.1/docs/manual/jdbi.html When trying to run docker-compose up. 尝试运行docker-compose时。 This also happens when I try and run the following in my terminal too. 当我也尝试在终端中运行以下命令时,也会发生这种情况。 java -jar target/bitly-1.0-SNAPSHOT.jar server src/config.yml

server_1   | config.yml has an error:
server_1   |   * Unrecognized field at: database
server_1   |     Did you mean?:
server_1   |       - template
server_1   |       - metrics
server_1   |       - defaultName
server_1   |       - server
server_1   |       - logging
server_1   |

I've been through most of the related problems on stackoverflow but cannot seem to figure out why this error is happening in my config.yml file. 我已经解决了stackoverflow上的大多数相关问题,但似乎无法弄清为什么该错误在我的config.yml文件中发生。

I have the full repo here. 我在这里有完整的仓库。 https://github.com/Jazilch/bit.ly https://github.com/Jazilch/bit.ly

Does anyone have any thoughts? 有人有想法吗?

The issue needing immediate attention is this: https://github.com/Jazilch/bit.ly/blob/1b4f8e77acced6e054cced5bf4cdf51d2d7da2fc/server/pom.xml#L16-L29 需要立即注意的问题是这样的: https : //github.com/Jazilch/bit.ly/blob/1b4f8e77acced6e054cced5bf4cdf51d2d7da2fc/server/pom.xml#L16-L29

    <dependency>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-core</artifactId>
        <version>${dropwizard.version}</version>
    </dependency>
    <dependency>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-db</artifactId>
        <version>0.8.2</version>
    </dependency>
    <dependency>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-jdbi</artifactId>
        <version>0.7.0-rc1</version>

You are using several different versions of the various dropwizard modules. 您正在使用各种dropwizard模块的几种不同版本。 They are not meant to be interchangeable. 它们不是可互换的。 Always use only one. 始终仅使用一个。

Also you could remove the dependency about <artifactId>dropwizard-db</artifactId> . 您也可以删除关于<artifactId>dropwizard-db</artifactId>的依赖项。 The dropwizard-jdbi is declaring and including it: https://github.com/dropwizard/dropwizard/blob/3df1e0a621a2b6f1f559fa95029abe09ce41e093/dropwizard-jdbi/pom.xml#L29 dropwizard-jdbi正在声明并包含以下内容: https : //github.com/dropwizard/dropwizard/blob/3df1e0a621a2b6f1f559fa95029abe09ce41e093/dropwizard-jdbi/pom.xml#L29

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM