You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jörg Larbig <jo...@larbig.net> on 2017/12/06 07:33:23 UTC

DefaultJolokiaCamelController fails if compression is enabled in Spring Boot

Hello,

I have a spring boot application with actuator an camel enabled.

I am able to query via Jolokia API

J4pClient client = new J4pClient("http://localhost:8080/jolokia");
J4pReadRequest request = new
J4pReadRequest("java.lang:type=Memory","HeapMemoryUsage");
 request.setPath("used");
 J4pReadResponse response = client.execute(request);
System.out.println("Memory used: " + response.getValue());

and

DefaultJolokiaCamelController controller = new
DefaultJolokiaCamelController();
controller.connect("http://localhost:8080/jolokia", null, null);
List<Map<String, String>> allContext = controller.getCamelContexts();
System.out.println(allContext.toString());

When I enable server compression of my application

server.compression.enabled=false

the way with the J4pClient works as expected while the
DefaultJolokiaCamelController fails
with

org.jolokia.client.exception.J4pException: IO-Error while contacting the
server: org.apache.http.client.ClientProtocolException
at org.jolokia.client.J4pClient.mapException(J4pClient.java:333)
at org.jolokia.client.J4pClient.execute(J4pClient.java:259)
at org.jolokia.client.J4pClient.execute(J4pClient.java:232)
at org.jolokia.client.J4pClient.execute(J4pClient.java:216)
at
org.apache.camel.commands.jolokia.DefaultJolokiaCamelController.getCamelContexts(DefaultJolokiaCamelController.java:205)
at de.test.TestCamelJolokia.runTest(TestCamelJolokia.java:20)
at de.test.TestCamelJolokia.main(TestCamelJolokia.java:12)
Caused by: org.apache.http.client.ClientProtocolException
at
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:188)
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.jolokia.client.J4pClient.execute(J4pClient.java:252)
... 5 more
Caused by: org.apache.http.ProtocolException: Not a valid protocol version:
at
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:262)

Re: DefaultJolokiaCamelController fails if compression is enabled in Spring Boot

Posted by Claus Ibsen <cl...@gmail.com>.
You should consider reporting this to jolokia as its not really a
Camel issue. Also its likely not supported in jolokia but maybe they
can look into supporting this in the future. I am sure they would like
contributions.

On Wed, Dec 6, 2017 at 8:33 AM, Jörg Larbig <jo...@larbig.net> wrote:
> Hello,
>
> I have a spring boot application with actuator an camel enabled.
>
> I am able to query via Jolokia API
>
> J4pClient client = new J4pClient("http://localhost:8080/jolokia");
> J4pReadRequest request = new
> J4pReadRequest("java.lang:type=Memory","HeapMemoryUsage");
>  request.setPath("used");
>  J4pReadResponse response = client.execute(request);
> System.out.println("Memory used: " + response.getValue());
>
> and
>
> DefaultJolokiaCamelController controller = new
> DefaultJolokiaCamelController();
> controller.connect("http://localhost:8080/jolokia", null, null);
> List<Map<String, String>> allContext = controller.getCamelContexts();
> System.out.println(allContext.toString());
>
> When I enable server compression of my application
>
> server.compression.enabled=false
>
> the way with the J4pClient works as expected while the
> DefaultJolokiaCamelController fails
> with
>
> org.jolokia.client.exception.J4pException: IO-Error while contacting the
> server: org.apache.http.client.ClientProtocolException
> at org.jolokia.client.J4pClient.mapException(J4pClient.java:333)
> at org.jolokia.client.J4pClient.execute(J4pClient.java:259)
> at org.jolokia.client.J4pClient.execute(J4pClient.java:232)
> at org.jolokia.client.J4pClient.execute(J4pClient.java:216)
> at
> org.apache.camel.commands.jolokia.DefaultJolokiaCamelController.getCamelContexts(DefaultJolokiaCamelController.java:205)
> at de.test.TestCamelJolokia.runTest(TestCamelJolokia.java:20)
> at de.test.TestCamelJolokia.main(TestCamelJolokia.java:12)
> Caused by: org.apache.http.client.ClientProtocolException
> at
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:188)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
> at
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
> at org.jolokia.client.J4pClient.execute(J4pClient.java:252)
> ... 5 more
> Caused by: org.apache.http.ProtocolException: Not a valid protocol version:
> at
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:262)



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2