<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>Hi Stian,</div>
<div><br>
</div>
<div>Thanks for the response. How do you know that it belongs to sun.jdk module? I googled but I couldn’t find anything in regards to that.</div>
<div><br>
</div>
<div>I managed to get through all the issues, the last stage is adding the log and now I am stuck again. I’m asking how you find the module name &nbsp;because now I am getting Caused by: java.lang.NoClassDefFoundError: org/jboss/logging/Logger error.</div>
<div><br>
</div>
<div>I tried adding&nbsp;&lt;module name=&quot;org.jboss.logging.jboss-logging”/&gt; to the module.xml but that didn’t solve the problem.</div>
<div><br>
</div>
<div>Kind Regards,</div>
<div>Sarp Kaya</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Stian Thorgersen &lt;<a href="mailto:sthorger@redhat.com">sthorger@redhat.com</a>&gt;<br>
<span style="font-weight:bold">Reply-To: </span>&quot;<a href="mailto:stian@redhat.com">stian@redhat.com</a>&quot; &lt;<a href="mailto:stian@redhat.com">stian@redhat.com</a>&gt;<br>
<span style="font-weight:bold">Date: </span>Thursday, May 26, 2016 at 5:21 PM<br>
<span style="font-weight:bold">To: </span>Abdullah Sarp Kaya &lt;<a href="mailto:akaya@expedia.com">akaya@expedia.com</a>&gt;<br>
<span style="font-weight:bold">Cc: </span>&quot;<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&quot; &lt;<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&gt;<br>
<span style="font-weight:bold">Subject: </span>Re: [keycloak-user] Using dependencies for an SPI provider<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">If you need additional dependencies in your provider please deploy it as a module, see docs and examples on how to do that. For the missing class you're module definition would need to include:
<div><br>
</div>
<div>
<div>...</div>
<div>&nbsp; &nbsp; &lt;dependencies&gt;</div>
<div>&nbsp; &nbsp; <span class="" style="white-space:pre"></span>&lt;module name=&quot;sun.jdk&quot; export=&quot;true&quot; &gt;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; <span class="" style="white-space:pre"></span>&lt;imports&gt;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="" style="white-space:pre"></span>&lt;include path=&quot;sun/misc/Unsafe&quot; /&gt;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; <span class="" style="white-space:pre"></span>&lt;/imports&gt;</div>
<div>&nbsp; &nbsp; <span class="" style="white-space:pre"></span>&lt;/module&gt;</div>
<div>&nbsp; &nbsp; &lt;/dependencies&gt;</div>
</div>
<div>...<br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 26 May 2016 at 09:14, Sarp Kaya <span dir="ltr">&lt;<a href="mailto:akaya@expedia.com" target="_blank">akaya@expedia.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>Hi,</div>
<div><br>
</div>
<div>I am trying to extend an event listener and the example one works fine, which just prints out every event.</div>
<div>However I want to do something more complicated than that. So I added two more dependency on top of keycloak dependencies:</div>
<div>com.codahale.metrics:metrics-core and&nbsp;com.readytalk:metrics3-statsd</div>
<div><br>
</div>
<div>In my IDE I was able to develop fine, then maven packages it fine. I package it by including all the dependencies (so JAR file is like 6 MB), otherwise it won’t have the dependencies (I have tried that and it complained at the runtime saying it doesn’t
 have the class).</div>
<div><br>
</div>
<div>Then I start the keycloak service, it starts fine. I get an exception throw like below when I initially use the service (which is when the first event trigger happens):</div>
<div><br>
</div>
<div>
<div>&nbsp;07:10:01,453 ERROR [io.undertow.request] (default task-6) UT005023: Exception handling request to /auth/realms/master/protocol/openid-connect/auth: org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: sun/misc/Unsafe</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.keycloak.services.filters.KeycloakSessionServletFilter.doFilter(KeycloakSessionServletFilter.java:88)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.Thread.run(Thread.java:745)</div>
<div>Caused by: java.lang.NoClassDefFoundError: sun/misc/Unsafe</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.Striped64.getUnsafe(Striped64.java:330)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.Striped64.&lt;clinit&gt;(Striped64.java:311)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.EWMA.&lt;init&gt;(EWMA.java:29)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.EWMA.oneMinuteEWMA(EWMA.java:39)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.Meter.&lt;init&gt;(Meter.java:15)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.Meter.&lt;init&gt;(Meter.java:28)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.MetricRegistry$MetricBuilder$3.newMetric(MetricRegistry.java:426)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.MetricRegistry$MetricBuilder$3.newMetric(MetricRegistry.java:423)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.MetricRegistry.getOrAdd(MetricRegistry.java:313)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.codahale.metrics.MetricRegistry.meter(MetricRegistry.java:134)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.expedia.keycloak.spi.providers.events.SysoutEventListenerProvider.&lt;init&gt;(SysoutEventListenerProvider.java:22)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.expedia.keycloak.spi.providers.events.SysoutEventListenerProviderFactory.create(SysoutEventListenerProviderFactory.java:23)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.expedia.keycloak.spi.providers.events.SysoutEventListenerProviderFactory.create(SysoutEventListenerProviderFactory.java:16)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.keycloak.services.DefaultKeycloakSession.getProvider(DefaultKeycloakSession.java:115)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.reflect.Method.invoke(Method.java:498)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:56)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.sun.proxy.$Proxy81.getProvider(Unknown Source)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.keycloak.events.EventBuilder.&lt;init&gt;(EventBuilder.java:62)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.keycloak.services.resources.RealmsResource.getProtocol(RealmsResource.java:98)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.reflect.Method.invoke(Method.java:498)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; ... 37 more</div>
<div>Caused by: java.lang.ClassNotFoundException: sun.misc.Unsafe</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at java.net.URLClassLoader.findClass(URLClassLoader.java:381)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.ClassLoader.loadClass(ClassLoader.java:424)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.ClassLoader.loadClass(ClassLoader.java:357)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; ... 66 more</div>
</div>
<div><br>
</div>
<div>I don’t know what could be wrong. When I googled the&nbsp;java.lang.NoClassDefFoundError with Keycloak I found that there was an error with Facebook integration. So I am wondering whether this is something similar and a bug with Keycloak? If not then what have
 I missed?</div>
<div><br>
</div>
<div>Kind Regards,</div>
<div>Sarp Kaya</div>
</div>
<br>
_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">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>
</div>
</div>
</span>
</body>
</html>