0.8.0-rc3 Jerseyclient exception

122 views
Skip to first unread message

Michael Kidd

unread,
Mar 4, 2015, 10:33:11 AM3/4/15
to dropwiz...@googlegroups.com
Client client = new JerseyClientBuilder(environment).build("jerseyclient");

WebTarget wt = client.target("http://google.com");
wt.register(new LoggingFilter(java.util.logging.Logger.getLogger(TestApplication.class.getName()), false));
wt.request().get(String.class);

WebTarget wt2 = client.target("http://google.com");
wt2.request().get(String.class);

in 0.8.0-rc2 this works.  in rc3, the last line throws an illegal argument exception:

Exception in thread "main" java.lang.IllegalArgumentException: A metric named org.apache.http.conn.HttpClientConnectionManager.jerseyclient.available-connections already exists
at com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:91)
at com.codahale.metrics.httpclient.InstrumentedHttpClientConnectionManager.<init>(InstrumentedHttpClientConnectionManager.java:57)
at io.dropwizard.client.HttpClientBuilder.createConnectionManager(HttpClientBuilder.java:278)
at io.dropwizard.client.HttpClientBuilder.build(HttpClientBuilder.java:173)
at io.dropwizard.client.JerseyClientBuilder$1.getConnector(JerseyClientBuilder.java:317)
at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:414)
at org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:87)
at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:119)
at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:116)
at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:340)
at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:722)
at org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:284)
at org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:126)
at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:98)
at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:91)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:408)
at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:308)
at jerseyclient.TestApplication.run(TestApplication.java:31)
at jerseyclient.TestApplication.run(TestApplication.java:1)
at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76)
at io.dropwizard.cli.Cli.run(Cli.java:70)
at io.dropwizard.Application.run(Application.java:73)
at jerseyclient.TestApplication.main(TestApplication.java:18)

The exception is not thrown, if the logging filter is removed.  Any thoughts as to if this is a bug, or if I'm just "doing it wrong?"

Thanks,
-Mike

Michael Kidd

unread,
Mar 5, 2015, 5:44:26 AM3/5/15
to dropwiz...@googlegroups.com
Same exception seems to occur if anything is registered to the web target.  I'm going to log this as an issue.

Michael Kidd

unread,
Mar 5, 2015, 8:42:42 AM3/5/15
to dropwiz...@googlegroups.com


On Wednesday, March 4, 2015 at 10:33:11 AM UTC-5, Michael Kidd wrote:
Reply all
Reply to author
Forward
0 new messages