[keycloak-user] How to create a Camel Route with Keycloak Admin Client in JBoss Fuse 6.3.0?

Celso Agra celso.agra at gmail.com
Wed Jun 14 00:24:48 EDT 2017


Hi all,

I'm trying to use the keycloak admin client in JBoss Fuse 6.3.0. Everything
works fine when I run the java main class, but when I put this in the JBoss
Fuse (with Karaf) I got an error, because the keycloak are using the
resteasy, and the OSGI is totally different. So, does anyone knows how to
do the same keycloak admin client configuration using this environment?

Here is my log:

javax.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request

    at
> org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:289)

    at
> org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:454)

    at
> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:105)

    at
> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)

    at com.sun.proxy.$Proxy85.grantToken(Unknown Source)

    at
> org.keycloak.admin.client.token.TokenManager.grantToken(TokenManager.java:89)

    at
> org.keycloak.admin.client.token.TokenManager.getAccessToken(TokenManager.java:69)

    at
> org.keycloak.admin.client.token.TokenManager.getAccessTokenString(TokenManager.java:64)

    at
> org.keycloak.admin.client.resource.BearerAuthFilter.filter(BearerAuthFilter.java:52)

    at
> org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:431)

    at
> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:105)

    at
> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)

    at com.sun.proxy.$Proxy88.create(Unknown Source)

    at
> pe.gov.br.ati.service.KeycloakAdminManager.createUserKeycloak(KeycloakAdminManager.java:64)

    at
> pe.gov.br.ati.service.KeycloakClientService.validateAndInsertUser(KeycloakClientService.java:20)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:498)

    at
> org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)

    at
> org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)

    at
> org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)

    at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:177)

    at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)

    at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)

    at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)

    at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)

    at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)

    at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)

    at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)

    at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)

    at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)

    at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)

    at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)

    at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)

    at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)

    at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)

    at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)

    at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)

    at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)

    at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)

    at
> org.apache.camel.component.restlet.RestletConsumer$1.handle(RestletConsumer.java:68)

    at
> org.apache.camel.component.restlet.MethodBasedRouter.handle(MethodBasedRouter.java:54)

    at org.restlet.routing.Filter.doHandle(Filter.java:150)

    at org.restlet.routing.Filter.handle(Filter.java:197)

    at org.restlet.routing.Router.doHandle(Router.java:422)

    at org.restlet.routing.Router.handle(Router.java:639)

    at org.restlet.routing.Filter.doHandle(Filter.java:150)

    at org.restlet.routing.Filter.handle(Filter.java:197)

    at org.restlet.routing.Router.doHandle(Router.java:422)

    at org.restlet.routing.Router.handle(Router.java:639)

    at org.restlet.routing.Filter.doHandle(Filter.java:150)

    at
> org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:140)

    at org.restlet.routing.Filter.handle(Filter.java:197)

    at org.restlet.routing.Filter.doHandle(Filter.java:150)

    at org.restlet.routing.Filter.handle(Filter.java:197)

    at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:202)

    at org.restlet.Component.handle(Component.java:408)

    at org.restlet.Server.handle(Server.java:507)

    at
> org.restlet.engine.connector.ServerHelper.handle(ServerHelper.java:63)

    at
> org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:143)

    at
> org.restlet.engine.connector.HttpServerHelper$1.handle(HttpServerHelper.java:64)

    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)

    at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)

    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)

    at
> sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)

    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)

    at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)

    at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

    at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

    at java.lang.Thread.run(Thread.java:748)

Caused by: javax.ws.rs.ProcessingException: RESTEASY003215: could not find
> writer for content-type application/x-www-form-urlencoded type:
> javax.ws.rs.core.Form$1

    at
> org.jboss.resteasy.core.interception.jaxrs.ClientWriterInterceptorContext.throwWriterNotFoundException(ClientWriterInterceptorContext.java:40)

    at
> org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.getWriter(AbstractWriterInterceptorContext.java:146)

    at
> org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:121)

    at
> org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.writeRequestBody(ClientInvocation.java:388)

    at
> org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.writeRequestBodyToOutputStream(ApacheHttpClient4Engine.java:589)

    at
> org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.buildEntity(ApacheHttpClient4Engine.java:557)

    at
> org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.loadHttpMethod(ApacheHttpClient4Engine.java:456)

    at
> org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:283)

    ... 70 more


Thanks for the attention.

-- 
---
*Celso Agra*


More information about the keycloak-user mailing list