[英]Admin port with Dropwizard metrics not working
I'm following the DropWizard " Getting Started " tutorial and while I got everything else working the 8081 admin port is blank and clicking on any of the hyperlinks to the metrics resource, threads resource, and health check resource is giving me a 101 error. 我正在关注DropWizard的“ 入门 ”教程,当我完成所有其他工作时,8081管理端口为空白,然后单击指向度量标准资源,线程资源和运行状况检查资源的任何超链接,这给了我101错误。 Can't figure out why I followed it pretty much verbatim.
无法弄清楚为什么我几乎完全遵循它。 Here's my POM if that helps:
这是我的POM,如果有帮助的话:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DropWizard</groupId>
<artifactId>DropWizard</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.yammer.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>0.6.2</version>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<artifactId>metrics-servlets</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</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.HelloWorldService</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Figured it out, there are a couple of things to note: 想通了,有几件事要注意:
1) If you specify the dropwizard dependency you do not need to specify the metrics dependencies. 1)如果您指定了dropwizard依赖性,则无需指定指标依赖性。
2) The 8081 port, for whatever reason, was not cooperating. 2)8081端口无论出于何种原因均未配合。 When I changed the admin port to 9091 everything worked as expected.
当我将管理端口更改为9091时,一切正常。 If you want to change the ports then specify the following in your admin file:
如果要更改端口,请在管理文件中指定以下内容:
http:
port: 9090
adminPort: 9091
I assume you can use whatever ports you like, these happened to work when I used them. 我假设您可以使用任何您喜欢的端口,这些端口在我使用它们时就起作用了。 When specifying the ports there must be a tab in between http and the information that comes afterwards.
指定端口时,http和随后的信息之间必须有一个制表符。 Hopefully this helps others avoid the hair-pulling frustration I encountered
希望这可以帮助其他人避免我遇到的困扰
The Dropwizard admin interface (as of 0.6.2) is only compatible with Metrics 2.*. Dropwizard管理界面(自0.6.2开始)仅与Metrics 2. *兼容。 Dropwizard 0.7.0 will work with Metrics 3 once it's released.
Dropwizard 0.7.0一旦发布,便可以与Metrics 3一起使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.