Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Dropwizard配置无法使用着色jar_Java_Rest_Dropwizard_Dropwizard Templates - Fatal编程技术网

Java Dropwizard配置无法使用着色jar

Java Dropwizard配置无法使用着色jar,java,rest,dropwizard,dropwizard-templates,Java,Rest,Dropwizard,Dropwizard Templates,在尝试运行configuration.yaml文件中包含属性的着色jar时,我面临以下问题。(直接运行主类时未发生) 运行命令:java-jar目标/mlsdata-1.0.jar服务器配置。yaml 错误: io.dropwizard.configuration.ConfigurationParsingException:configuration.yaml有一个错误: *无法分析以下位置的配置:服务器。applicationConnectors。[0];无法将类型id“http”解析为[s

在尝试运行configuration.yaml文件中包含属性的着色jar时,我面临以下问题。(直接运行主类时未发生)

运行命令:
java-jar目标/mlsdata-1.0.jar服务器配置。yaml

错误:

io.dropwizard.configuration.ConfigurationParsingException:configuration.yaml有一个错误:
*无法分析以下位置的配置:服务器。applicationConnectors。[0];无法将类型id“http”解析为[simple type,class io.dropwizard.jetty.ConnectorFactory]:已知类型id=[](对于POJO属性“applicationConnectors”)

在[Source:UNKNOWN;line:-1,column:-1](通过引用链:com.zaplabs.MlsConfiguration[“server”]->io.dropwizard.server.DefaultServerFactory[“applicationConnectors”]->java.util.ArrayList[0])
因此我遇到了同样的问题,找到了解决方案

我还必须使用以下插件

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
    <createDependencyReducedPom>true</createDependencyReducedPom>
    <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>
        <configuration>
            <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                    <mainClass>com.example.helloworld.HelloWorldApplication</mainClass>
                </transformer>
            </transformers>
        </configuration>
    </execution>
</executions>

org.apache.maven.plugins
maven阴影插件
2.3
真的
*:*
META-INF/*.SF
META-INF/*.DSA
META-INF/*.RSA
包裹
阴凉处
com.example.helloworld.helloworld应用程序

谢谢,这是因为hibernate和dropwizard core之间存在依赖性问题,添加后仍然有效。