[keycloak-user] Issues in integrating UserStorageProvider with Hazelcast

Bill Burke bburke at redhat.com
Sat Jan 21 16:09:28 EST 2017


You'll have to create a jboss-deployment-structure.xml file in META-INF 
of your deployment and import "sun.jdk" module.  This is a related post

http://stackoverflow.com/questions/31535350/wildfly-8-2-classnotfoundexception-sun-misc-unsafe-from-module-io-nettymain-w


On 1/20/17 11:24 AM, Deepu Laghuvaram wrote:
> I am trying to integrate Hazelcast in my UserStorageProvider and I am
> getting the error as below,
> 5:01:35,028 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool
> -- 51) MSC000001: Failed to start service
> jboss.undertow.deployment.default-server.default-host./auth:
> org.jboss.msc.service.StartException in service
> jboss.undertow.deployment.default-server.default-host./auth:
> java.lang.RuntimeException: RESTEASY003325: Failed to construct public
> org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
> at
> org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 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:745)
> at org.jboss.threads.JBossThread.run(JBossThread.java:320)
> Caused by: java.lang.RuntimeException: RESTEASY003325: Failed to construct
> public
> org.keycloak.services.resources.KeycloakApplication(javax.servlet.ServletContext,org.jboss.resteasy.core.Dispatcher)
> at
> org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:162)
> at
> org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2209)
> at
> org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:299)
> at
> org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:240)
> at
> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:113)
> at
> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
> at
> io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
> at
> org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
> at
> io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
> at
> io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:231)
> at
> io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:132)
> at
> io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:526)
> at
> org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
> at
> org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
> ... 6 more
> Caused by: java.lang.NoClassDefFoundError: sun/misc/Unsafe
> at com.hazelcast.nio.UnsafeHelper.findUnsafe(UnsafeHelper.java:176)
> at com.hazelcast.nio.UnsafeHelper.findUnsafeIfAllowed(UnsafeHelper.java:149)
> at com.hazelcast.nio.UnsafeHelper.<clinit>(UnsafeHelper.java:78)
> at com.hazelcast.util.counters.SwCounter.newSwCounter(SwCounter.java:66)
> at com.hazelcast.util.counters.SwCounter.newSwCounter(SwCounter.java:56)
> at
> com.hazelcast.spi.impl.operationservice.impl.InvocationRegistry.<init>(InvocationRegistry.java:72)
> at
> com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl.<init>(OperationServiceImpl.java:147)
> at com.hazelcast.spi.impl.NodeEngineImpl.<init>(NodeEngineImpl.java:104)
> at com.hazelcast.instance.Node.<init>(Node.java:177)
> at
> com.hazelcast.instance.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:125)
> at
> com.hazelcast.instance.HazelcastInstanceFactory.constructHazelcastInstance(HazelcastInstanceFactory.java:160)
> at
> com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:143)
> at
> com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:111)
> at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:58)
> at
> com.lb.storage.hazelcast.HazelcastInstanceProvide.getInstance(HazelcastInstanceProvide.java:10)
> at
> com.lb.storage.user.DB2UserStorageProvider.<clinit>(DB2UserStorageProvider.java:61)
> at
> com.lb.storage.user.DB2UserStorageProviderFactory.create(DB2UserStorageProviderFactory.java:32)
> at
> com.lb.storage.user.DB2UserStorageProviderFactory.create(DB2UserStorageProviderFactory.java:24)
> at
> org.keycloak.storage.UserStorageManager.getStorageProviderInstance(UserStorageManager.java:80)
> at
> org.keycloak.storage.UserStorageManager.getStorageProviders(UserStorageManager.java:96)
> at
> org.keycloak.storage.UserStorageManager.getUsersCount(UserStorageManager.java:369)
> at
> org.keycloak.models.cache.infinispan.UserCacheSession.getUsersCount(UserCacheSession.java:580)
> at
> org.keycloak.services.managers.ApplianceBootstrap.isNoMasterUser(ApplianceBootstrap.java:55)
> at
> org.keycloak.services.resources.KeycloakApplication.<init>(KeycloakApplication.java:155)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
> at
> org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150)
> ... 19 more
> Caused by: java.lang.ClassNotFoundException: sun.misc.Unsafe
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ... 48 more
>
>
> I have added module.xml in location
> keycloak-2.5.0.Final/modules/system/layers/base/io/netty/main. Not sure if
> thats the correct location.
>
> in my module.xml I have added as
>
> <module name="sun.jdk">
> <imports>
> <include path="sun/misc/Unsafe" />
> </imports>
>
> Still I am getting same error. Please help with this.
>
>
> Thanks,
> Deepu
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user



More information about the keycloak-user mailing list