<div dir="ltr">As I was afraid of, the problem does relate to the classloading setup that I need to work with. Although most service proxies are instantiated just fine, the TokenService gets instantiated "on demand", which causes the classloader to be used (for reflection) from the thread that's doing the invocation of the requested functionality (rather than the thread that was used to instantiate the admin client, which is how all other proxies were created).<div><br></div><div>I do think that there's an easy improvement here: as far as I can tell, there's no need to re-create the proxy all the time. It can instead be created once, when TokenManager is created. Construction is very likely to occur in the correct classloader - it's not bullet proof, but certainly an improvement.<br><div><br></div><div>I've created a JIRA issue for this here: <a href="https://issues.jboss.org/browse/KEYCLOAK-2721">https://issues.jboss.org/browse/KEYCLOAK-2721</a> as well as a pull request here: <a href="https://github.com/keycloak/keycloak/pull/2443">https://github.com/keycloak/keycloak/pull/2443</a></div></div><div><br></div><div> - Guus</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 25 March 2016 at 20:09, Guus der Kinderen <span dir="ltr"><<a href="mailto:guus.der.kinderen@gmail.com" target="_blank">guus.der.kinderen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I do have core on my classpath. I am bound to a setup where keycloak is instantiated by a classloader that is a child of the classloader that triggers the requests. Is that a problem? It obviously isn't a problem for some calls, but perhaps that there's something different with that TokenService?<div><br></div><div>I'm having trouble determining the exact set of dependencies that I need for my project. Is that documented somewhere?</div><div><br></div><div>Does anyone know how I could further diagnose this issue?</div><div><br></div><div>Regards,</div><div><br></div><div> Guus</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 24 March 2016 at 10:29, Marko Strukelj <span dir="ltr"><<a href="mailto:mstrukel@redhat.com" target="_blank">mstrukel@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The stacktrace hides whether this is ClassNotFoundException or NoClassDefFoundError, so it's possible that TokenService is actually visible, but not one of its dependencies.<div><br></div><div>You'll definitely also need to add keycloak-core.jar to your classpath.</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Mar 24, 2016 at 10:21 AM, Guus der Kinderen <span dir="ltr"><<a href="mailto:guus.der.kinderen@gmail.com" target="_blank">guus.der.kinderen@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div>Hello cloakees. </div><div><br></div><div>I'm having an interesting problem while using the admin-client from 1.9.1. Initially, things go well. I can extract data as expected. However, after a couple of minutes (I think when the admin-client-token needs refreshing), I'm suddenly getting errors: "java.lang.IllegalArgumentException: interface org.keycloak.admin.client.token.TokenService is not visible from class loader" I added a full stacktrace below.</div><div><br></div><div>I find it odd that some functionality does work, but other does not. What's causing this? keycloak-admin-client-1.9.1.Final.jar is on the classpath, which is where that interface appears to live.</div><div><br></div><div>Regards,</div><div><br></div><div> Guus</div><div><br></div><div><div>2016.03.24 10:18:50 WARN [Jetty-QTP-AdminConsole-58]: org.eclipse.jetty.servlet.ServletHandler - /user-summary.jsp</div><div>javax.ws.rs.ProcessingException: java.lang.IllegalArgumentException: interface org.keycloak.admin.client.token.TokenService is not visible from class loader</div><div> at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:430)</div><div> at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:102)</div><div> at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:64)</div><div> at com.sun.proxy.$Proxy26.search(Unknown Source)</div><div> at org.jivesoftware.openfire.plugin.KeycloakUserProvider.getUserCount(KeycloakUserProvider.java:134)</div><div> at org.jivesoftware.openfire.user.UserManager.getUserCount(UserManager.java:263)</div><div> at org.jivesoftware.openfire.admin.user_002dsummary_jsp._jspService(user_002dsummary_jsp.java:107)</div><div> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)</div><div> at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)</div><div> at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)</div><div> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)</div><div> at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)</div><div> at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)</div><div> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)</div><div> at org.jivesoftware.util.LocaleFilter.doFilter(LocaleFilter.java:76)</div><div> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)</div><div> at org.jivesoftware.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:53)</div><div> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)</div><div> at org.jivesoftware.admin.PluginFilter.doFilter(PluginFilter.java:80)</div><div> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)</div><div> at org.jivesoftware.admin.AuthCheckFilter.doFilter(AuthCheckFilter.java:162)</div><div> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)</div><div> at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)</div><div> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)</div><div> at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)</div><div> at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)</div><div> at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)</div><div> at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)</div><div> at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)</div><div> at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)</div><div> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)</div><div> at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)</div><div> at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)</div><div> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)</div><div> at org.eclipse.jetty.server.Server.handle(Server.java:499)</div><div> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)</div><div> at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)</div><div> at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)</div><div> at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)</div><div> at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)</div><div> at java.lang.Thread.run(Thread.java:745)</div></div><div><div>Caused by: java.lang.IllegalArgumentException: interface org.keycloak.admin.client.token.TokenService is not visible from class loader</div><div> at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581)</div><div> at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)</div><div> at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)</div><div> at java.lang.reflect.WeakCache.get(WeakCache.java:127)</div><div> at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)</div><div> at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719)</div><div> at org.jboss.resteasy.client.jaxrs.ProxyBuilder.proxy(ProxyBuilder.java:70)</div><div> at org.jboss.resteasy.client.jaxrs.ProxyBuilder.build(ProxyBuilder.java:122)</div><div> at org.jboss.resteasy.client.jaxrs.internal.ClientWebTarget.proxy(ClientWebTarget.java:74)</div><div> at org.keycloak.admin.client.token.TokenManager.refreshToken(TokenManager.java:100)</div><div> at org.keycloak.admin.client.token.TokenManager.getAccessToken(TokenManager.java:59)</div><div> at org.keycloak.admin.client.token.TokenManager.getAccessTokenString(TokenManager.java:52)</div><div> at org.keycloak.admin.client.resource.BearerAuthFilter.filter(BearerAuthFilter.java:48)</div><div> at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:413)</div><div> ... 40 more</div></div><div><br></div></div>
<br></div></div>_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>