Java Dropwizard:config.yml有一个错误

Java Dropwizard:config.yml有一个错误,java,yaml,dropwizard,Java,Yaml,Dropwizard,我不熟悉Dropwizard,也不熟悉JAVA。我试图创建一个基本的Dropwizard项目(通过Hibernate连接MySQL数据库)。我正在使用EclipseIDE实现同样的功能。我已经完成了T的所有步骤,但是在控制台->java-jar target/hotel2-0.0.1-SNAPSHOT.jar server config.yml中键入此命令时。我得到以下错误:- config.yml has an error: * Failed to parse configuration a

我不熟悉Dropwizard,也不熟悉JAVA。我试图创建一个基本的Dropwizard项目(通过Hibernate连接MySQL数据库)。我正在使用EclipseIDE实现同样的功能。我已经完成了T的所有步骤,但是在控制台->java-jar target/hotel2-0.0.1-SNAPSHOT.jar server config.yml中键入此命令时。我得到以下错误:-

config.yml has an error: 
* Failed to parse configuration at: logging; Can not instantiate value of type [simple type, class io.dropwizard.logging.LoggingFactory] from String value (''); no single-String constructor/factory method at [Source: N/A; line: -1, column: -1] (through reference chain: com.drivedge.hotel2.HotelMgntConfiguration["logging"])  
下面是我的pom.xml和config.yml文件的副本:

config.yml-

## Configuration file for Hotel2 application.
---
# User login.
logging:
login: javaeeeee
# User  password.
password: crimson

#Server configuration.
server:
    applicationConnectors:
        - type: http
          port: 9090
        - type: https
          port: 9090
          keyStorePath: hotel2.keystore
          keyStorePassword: crimson

# Database settings.
database:
    # the name of the JDBC driver, mysql in our case
    driverClass: com.mysql.jdbc.Driver
    # the username
    user: root
    # the password
    password: drivedge12
    # the JDBC URL; the database is called Hotel2
    url: jdbc:mysql://localhost:3306/hotelmanagement  
pom.xml-

<?xml version="1.0" encoding="UTF-8"?>
<project
        xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <prerequisites>
        <maven>3.0.0</maven>
    </prerequisites>

    <groupId>com.drivedge</groupId>
    <artifactId>hotel2</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>HotelMgnt</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <dropwizard.version>0.8.2</dropwizard.version>
        <mainClass>com.drivedge.hotel2.HotelMgntApplication</mainClass>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.dropwizard</groupId>
            <artifactId>dropwizard-core</artifactId>
            <version>${dropwizard.version}</version>
        </dependency>
        <dependency>
            <groupId>io.dropwizard</groupId>
            <artifactId>dropwizard-hibernate</artifactId>
            <version>${dropwizard.version}</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.6</version>
        </dependency>
        <dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>eclipselink</artifactId>
    <version>2.5.1</version>
</dependency>
<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>javax.persistence</artifactId>
    <version>2.0.0</version>
    <scope>compile</scope>
</dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.7</version>
                <configuration>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <mainClass>${mainClass}</mainClass>
                        </transformer>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                    </transformers>
                    <!-- exclude signed Manifests -->
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>${mainClass}</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1.2</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.8.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>2.4</version>
                            <configuration>
                                <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                                <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                            </configuration>
                        </plugin>
                        <plugin>
                            <artifactId>maven-javadoc-plugin</artifactId>
                            <version>2.8.1</version>
                        </plugin>
                    </reportPlugins>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

我哪里做错了?我对这一切都是新手。任何帮助都将不胜感激

从config.yml中删除
日志记录:
或类似于配置日志记录。

从config.yml中删除
日志记录:
或类似于配置日志记录。

您好,@yanys我已按照建议删除日志记录:,错误消失。但是我收到了这条信息——嗨@yanys,请检查我对上一篇文章的编辑:)好的,我明白了。您可以省略-type:https端口:9090 keyStorePath:hotel2.keystorekeystorepassword:crimson部分,也可以创建密钥存储文件并将其放在错误消息中提到的路径中。您好@yanys,是的,省略密钥存储完全有帮助!谢谢嗨,@yanys我已经删除了日志记录:按照建议,错误消失了。但是我收到了这条信息——嗨@yanys,请检查我对上一篇文章的编辑:)好的,我明白了。您可以省略-type:https端口:9090 keyStorePath:hotel2.keystorekeystorepassword:crimson部分,也可以创建密钥存储文件并将其放在错误消息中提到的路径中。您好@yanys,是的,省略密钥存储完全有帮助!谢谢编辑
config.yml
后,仍然包含问题条目
日志记录:
。也可以考虑问另一个问题,并标记帮助接受的答案。这是一个问答网站。编辑同一个问题而不标记有帮助的答案,您不会奖励帮助过您的人。如果您有不同但相关的问题,请提出新问题,而不是编辑同一个问题。在这方面,我们需要每根柱子都独立。我已经为您回滚了编辑。编辑之后
config.yml
仍然包含问题条目
日志:
。也可以考虑问另一个问题,并标记帮助接受的答案。这是一个问答网站。编辑同一个问题而不标记有帮助的答案,您不会奖励帮助过您的人。如果您有不同但相关的问题,请提出新问题,而不是编辑同一个问题。在这方面,我们需要每根柱子都独立。我已经为您回滚了编辑。
package com.drivedge.hotel2;

import io.dropwizard.Configuration;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.db.DataSourceFactory;
import javax.validation.Valid;
import javax.validation.constraints.*;
//import org.apache.tomcat.jdbc.pool.DataSourceFactory;

public class HotelMgntConfiguration extends Configuration {
    /*// /**
    * A factory used to connect to a relational database management system.
    * Factories are used by Dropwizard to group together related configuration
    * parameters such as database connection driver, URI, password etc.
    */

   @NotNull
   @Valid
   @JsonProperty
   private DataSourceFactory database;

   /**
    * A getter for the database factory.
    *
    * @return An instance of database factory deserialized from the
    * configuration file passed as a command-line argument to the application.
    */

   public DataSourceFactory getDataSourceFactory() {
       return database;
   }

   public void setDatabase(DataSourceFactory database) {
        this.database = database;
    }
}