Raj*_*h V 4 java hibernate maven dropwizard
我一直在尝试使用 Maven 的 Dropwizard 项目。我可以运行 hello world 程序。当我尝试使用 Hibernate 运行数据库程序时,使用 java -jar 运行程序时出现如下错误。
default configuration has the following errors:
* database.driverClass may not be null (was null)
* database.url may not be null (was null)
* database.user may not be null (was null)
* template may not be empty (was null)
Run Code Online (Sandbox Code Playgroud)
这是我的 hello-world.yml 文件
template: Hello, %s!
defaultName: Stranger
database:
driverClass: com.mysql.jdbc.Driver
user: root
password:
url: jdbc:mysql://localhost/test
Run Code Online (Sandbox Code Playgroud)
提前致谢 !!
正如Dropwizard存储库中的一些示例所述,您可能需要提供模板文件配置,以便从那里提取数据库属性。
那么您是否尝试过运行应用程序来使用.yml文件作为命令行参数来设置数据库?像下面这样:
java -jar your-artifact.jar db migrate your-configuration-file.yml
Run Code Online (Sandbox Code Playgroud)
然后按如下方式运行您的应用程序:
java -jar your-artifact.jar server your-configuration-file.yml
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2530 次 |
| 最近记录: |