尝试在 JBOSS 上安装 EJBCA 时出现问题 - 为什么 Mysql 数据库 ( "ejbca" ) 为空



我正在尝试在 JBOSS 7.2 上安装 EJBCA 6.15.2.1,基本上遵循 ejbca.org 网站上的安装信息。 我正在使用Mysql作为数据库。

我能够成功完成部署步骤(https://www.ejbca.org/docs/Deploying_EJBCA.html) - "ant -q clean部署耳"。 但是,当我尝试运行安装步骤(https://www.ejbca.org/docs/Installing_EJBCA_as_a_CA_with_a_Management_CA.html)-"ant runinstall"时,我遇到了一些错误,例如:

18:48:18,338 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "ejbca.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit."ejbca.ear"."ejbca-ejb.jar".component.StartupSingletonBean.START" => "java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
Caused by: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: java.sql.SQLSyntaxErrorException: Table 'ejbca.RoleData' doesn't exist"}}

所以,我正在检查Mysql中的数据库,看起来该数据库完全是空的!

有谁知道应该填充那个"ejbca"数据库吗? 是否应该有一些工具或脚本来填充我可能缺少的架构等?

谢谢 吉姆

编辑1:我想我可能至少发现了部分问题。 在日志中,我发现了这个:

05:15:22,282 WARN  [org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl] (ServerService Thread Pool -- 56) GenerationTarget encountered exception accepting command : Error executing DDL "create table AccessRulesData (pK INT(11) not null, accessRule VARCHAR(250) BINARY not null, isRecursive TINYINT(4) not null, rowProtection LONGTEXT, rowVersion INT(11) not null, rule INT(11) not null, AdminGroupData_accessRules INT(11), primary key (pK)) type=MyISAM" via JDBC Statement: org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table AccessRulesData (pK INT(11) not null, accessRule VARCHAR(250) BINARY not null, isRecursive TINYINT(4) not null, rowProtection LONGTEXT, rowVersion INT(11) not null, rule INT(11) not null, AdminGroupData_accessRules INT(11), primary key (pK)) type=MyISAM" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:559)

所以我在mysql中尝试了那个"创建表",但得到了一个错误。 然后我尝试了"创建表",但使用"ENGINE=MyISAM"而不是"type=MyISAM",它起作用了。

因此,通过谷歌搜索(例如,GenerationTarget 遇到异常接受命令:通过 JDBC 语句执行 DDL 时出错),我认为这是 hibernate 配置为使用的"方言"的问题,似乎我应该在某些休眠配置文件中修改它,但我不确定它可能在哪里。 熟悉Hibernate和方言以及ejbca/jboss的人可以告诉我应该在哪个文件中更改该方言吗?

编辑2:顺便说一句,看起来我正在使用的Mysql是5.7.26。

看看 https://docs.jboss.org/hibernate/orm/5.3/javadocs/org/hibernate/dialect/package-summary.html,你似乎应该使用org.hibernate.dialect.MySQL57Dialect。您应该配置此方言。

最新更新