I am getting the following error when I run my jar while using:
java -jar <jarPath>.jar server config.yml
Error:
* Configuration at config.yml must not be empty
at io.dropwizard.configuration.ConfigurationParsingException$Builder.build(ConfigurationParsingException.java:279)
at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:85)
at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:126)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:74)
at io.dropwizard.cli.Cli.run(Cli.java:79)
at io.dropwizard.Application.run(Application.java:94)
at com.flipkart.cx.taggingconsole.webapp.application.DataConsoleApp.main(DataConsoleApp.java:62)
Ans here is my config file, I am quite new to all this and trying to connect my dropwizard application to hibernate using config.yml and not hibernate.cfg.xml.
Please have a look at config.yml file
server:
applicationConnectors:
- type: http
port: 8800
adminConnectors:
- type: http
port: 9800
# Database settings.
database:
# the name of your JDBC driver
driverClass: com.mysql.jdbc.Driver
# the username
user: root
# the password
password: root1234
# the JDBC URL
url: jdbc:h2:./target/example
properties:
hibernate.dialect: org.hibernate.dialect.MySQLDialect
hibernate.connection.url: jdbc:mysql://localhost/test
hibernate.connection.driver_class: com.mysql.jdbc.Driver
hibernate.show_sql: false
hibernate.generate_statistics: false
hibernate.hbm2ddl.auto: update # validates schema when service is started
hibernate.current_session_context_class: thread
On my case I had dropwizard's app jar produced by fatjar plugin and thus it couldn't see the file outside of jar. When I put my config.yml
to the resources directory in project and compiled app again, it could find the file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.