Dropwizard示例包编译错误

时间:2016-06-24 08:00:38

标签: java maven locale dropwizard

我对Java及其工具完全不熟悉,我想使用Dropwizard框架。 我在其repository中找到了一个示例,但我无法运行它。

正如README.md中所述,我需要运行mvn package。但是,据我所知,Maven尝试运行集成测试,但抛出了异常。堆栈跟踪如下:

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 5.975 sec << FAILURE! - in com.example.helloworld.IntegrationTest
com.example.helloworld.IntegrationTest  Time elapsed: 5.974 sec  <<< ERROR!
liquibase.exception.LockException: liquibase.exception.DatabaseException: Unknown data type: "İNT"; SQL statement:
CREATE TABLE PUBLIC.DATABASECHANGELOGLOCK (ID İNT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR(255), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID)) [50004-192] [Failed SQL: CREATE TABLE PUBLIC.DATABASECHANGELOGLOCK (ID İNT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR(255), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
    at org.h2.message.DbException.get(DbException.java:179)
    at org.h2.message.DbException.get(DbException.java:155)
    at org.h2.command.Parser.parseColumnWithType(Parser.java:4079)
    at org.h2.command.Parser.parseColumnForTable(Parser.java:3937)
    at org.h2.command.Parser.parseCreateTable(Parser.java:5972)
    at org.h2.command.Parser.parseCreate(Parser.java:4237)
    at org.h2.command.Parser.parsePrepared(Parser.java:362)
    at org.h2.command.Parser.parse(Parser.java:317)
    at org.h2.command.Parser.parse(Parser.java:289)
    at org.h2.command.Parser.prepareCommand(Parser.java:254)
    at org.h2.engine.Session.prepareLocal(Session.java:560)
    at org.h2.engine.Session.prepareCommand(Session.java:501)
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1202)
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:170)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158)
    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:299)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:107)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:97)
    at liquibase.lockservice.StandardLockService.init(StandardLockService.java:94)
    at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:206)
    at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:170)
    at liquibase.Liquibase.update(Liquibase.java:196)
    at liquibase.Liquibase.update(Liquibase.java:192)
    at liquibase.Liquibase.update(Liquibase.java:188)
    at liquibase.Liquibase.update(Liquibase.java:181)
    at io.dropwizard.migrations.DbMigrateCommand.run(DbMigrateCommand.java:68)
    at io.dropwizard.migrations.DbCommand.run(DbCommand.java:52)
    at io.dropwizard.migrations.AbstractLiquibaseCommand.run(AbstractLiquibaseCommand.java:64)
    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
    at io.dropwizard.cli.Cli.run(Cli.java:75)
    at io.dropwizard.Application.run(Application.java:79)
    at com.example.helloworld.IntegrationTest.migrateDb(IntegrationTest.java:38)

我认为它在语言环境方面存在一些问题,因为我的操作系统是 OS X 10.11土耳其语,我们将字符串'i'大写为'İ' ,而非'我'

我正在使用 IntelliJ IDEA ,您能告诉我如何更改被测试人员的当前区域设置(我不知道它是 JVM 或< em> Maven 或其他东西......)?

根据要求,我的migrations.xml文件:

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <changeSet id="1" author="codahale">
        <createTable tableName="people">
            <column name="id" type="bigint" autoIncrement="true">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="fullName" type="varchar(255)">
            <constraints nullable="false"/>
            </column>
            <column name="jobTitle" type="varchar(255)"/>
        </createTable>
    </changeSet>
</databaseChangeLog>

1 个答案:

答案 0 :(得分:2)

它应该是由Java虚拟机(JVM)的区域设置引起的。

只需打开终端或控制台(对于Windows)并运行以下命令,即可将您的语言环境更改为英语。

plot(Score, y, type="l") polygon(c( Score[Score>=1250], max(Score), 1250 ), c(y[Score>=1250],0, 0 ), col="skyblue")

要使其自动化,您可能需要在终端启动脚本中导出环境变量,例如set JAVA_ARGS=-Duser.language=en -Duser.region=US %JAVA_ARGS%