[keycloak-user] Linkage Errors

Conrad Winchester conrad at mindless.com
Wed Jun 25 07:35:16 EDT 2014


Thank you

That was awesome advice - thank you

BTW You guys rock :-)

Conrad

> On 25 Jun 2014, at 08:19, Marek Posolda <mposolda at redhat.com> wrote:
> 
> Hi,
> 
> I think the problem is in the fact that you are using:
> compile 'org.keycloak:keycloak-core:1.0-beta-3'
> 
> because if you do this, then keycloak-core.jar (and maybe some other files) is copied into your WAR under WEB-INF/lib, which is not good. You shouldn't have keycloak and httpcomponent jars inside WEB-INF/lib, but instead all your dependencies should be specified in WEB-INF/jboss-deployment-structure.xml to reference dependencies provided by Application server. Keycloak modules should be added as modules into JBoss AS as specified in documentation. 
> 
> I would suggest to look at our example applications here https://github.com/keycloak/keycloak/tree/master/examples/demo-template/ (they are also part of distribution). For example if you look at customer-app application, you can notice that it has all dependencies as 'provided' in pom.xml : https://github.com/keycloak/keycloak/blob/master/examples/demo-template/customer-app/pom.xml#L32 and in jboss-deployment-structure it has dependency on httpcomponents, which is something you will need as well (note ClassNotFoundException in your stacktrace): https://github.com/keycloak/keycloak/blob/master/examples/demo-template/customer-app/src/main/webapp/WEB-INF/jboss-deployment-structure.xml#L6 . Keycloak dependencies (like keycloak-core) don't need to be specified in jboss-deployment-structure.xml as long as you install keycloak modules and add jboss subsystem into standalone.xml as described in Keycloak docs and in README of examples. 
> 
> Good luck,
> Marek
> 
> On 25.6.2014 08:24, Conrad Winchester wrote:
>> Hi all,
>> 
>> So, trying to get a keycloak enabled server out of Intellij and onto a UAT box is proving to be a bit of a nightmare :-(
>> 
>> I am using the following dependencies for my project (removed some that are not part of the problem)
>> 
>> 
>> dependencies {
>> 
>>     providedCompile 'org.jboss.spec:jboss-javaee-7.0:1.0.0.Final'
>>     providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.6.Final'
>>     providedCompile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.6.Final'
>> 
>>     compile 'org.keycloak:keycloak-core:1.0-beta-3'
>> 
>> }
>> 
>> and I have my own version of the HttpClientBuilder utility class copied from the keycloak source in my application.
>> 
>> When running inside IntelliJ everything works fine, however when I try to run my way standalone on a UAT server I am getting the following linkage error. When I don’t include the keyclick core I don’t get the error, but I need keycloak code for the KeycloakPrincipal class.
>> 
>> I think it might be to do with conflicting versions of the org.apache.httpcomponents:httpclient library (4.2.1 vs 4.01), but am a little out of my depth. I have been struggling all night with this and would appreciate any help.
>> 
>> Thanks
>> 
>> Conrad
>> 
>> 
>> 2014-06-25 07:05:16,047 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: shift-server.war
>> 2014-06-25 07:05:16,073 INFO  [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900: 2.1.2 (Final)
>> 2014-06-25 07:05:16,118 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016008: Starting weld service for deployment shift-server.war
>> 2014-06-25 07:05:16,477 INFO  [org.jboss.weld.Bootstrap] (weld-worker-1) WELD-000119: Not generating any bean definitions from com.shift.service.oauth.KeycloakAuthAdapter because of underlying class loading error: Type org.apache.http.HttpEntity from [Module "deployment.shift-server.war:main" from Service Module Loader] not found.  If this is unexpected, enable DEBUG logging to see the full error.
>> 2014-06-25 07:05:16,482 WARN  [org.jboss.modules] (weld-worker-2) Failed to define class com.shift.keycloak.HttpClientBuilder$VerifierWrapper in Module "deployment.shift-server.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/shift/keycloak/HttpClientBuilder$VerifierWrapper (Module "deployment.shift-server.war:main" from Service Module Loader)
>>  at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
>>  at java.lang.Class.getDeclaringClass0(Native Method) [rt.jar:1.8.0]
>>  at java.lang.Class.getDeclaringClass(Class.java:1222) [rt.jar:1.8.0]
>>  at java.lang.Class.getEnclosingClass(Class.java:1264) [rt.jar:1.8.0]
>>  at java.lang.Class.getSimpleBinaryName(Class.java:1430) [rt.jar:1.8.0]
>>  at java.lang.Class.isMemberClass(Class.java:1420) [rt.jar:1.8.0]
>>  at org.jboss.weld.util.reflection.Reflections.getNesting(Reflections.java:134) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedConstructor.initParameters(BackedAnnotatedConstructor.java:50) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedConstructor.initParameters(BackedAnnotatedConstructor.java:28) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedCallable.<init>(BackedAnnotatedCallable.java:34) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedConstructor.<init>(BackedAnnotatedConstructor.java:38) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedConstructor.of(BackedAnnotatedConstructor.java:32) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.computeValue(BackedAnnotatedType.java:165) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.computeValue(BackedAnnotatedType.java:158) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:35) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:154) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.<init>(BackedAnnotatedType.java:158) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.<init>(BackedAnnotatedType.java:158) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:64) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:47) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:83) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:80) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
>>  at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
>>  at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
>>  at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
>>  at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
>>  at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
>>  at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
>>  at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:52) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:80) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:175) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:194) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.bootstrap.BeanDeployer.loadAnnotatedType(BeanDeployer.java:119) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:96) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:60) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0]
>>  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0]
>>  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0]
>>  at java.lang.Thread.run(Thread.java:744) [rt.jar:1.8.0]
>> Caused by: java.lang.NoClassDefFoundError: org/apache/http/conn/ssl/X509HostnameVerifier
>>  at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0]
>>  at java.lang.ClassLoader.defineClass(ClassLoader.java:760) [rt.jar:1.8.0]
>>  at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules.jar:1.3.3.Final]
>>  ... 50 more
>> Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.ssl.X509HostnameVerifier from [Module "deployment.shift-server.war:main" from Service Module Loader]
>>  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
>>  ... 54 more
>> 
>> 2014-06-25 07:05:16,489 INFO  [org.jboss.weld.Bootstrap] (weld-worker-2) WELD-000119: Not generating any bean definitions from com.shift.keycloak.HttpClientBuilder$PassthroughTrustManager because of underlying class loading error: Type org.apache.http.conn.ssl.X509HostnameVerifier from [Module "deployment.shift-server.war:main" from Service Module Loader] not found.  If this is unexpected, enable DEBUG logging to see the full error.
>> 2014-06-25 07:05:16,511 WARN  [org.jboss.modules] (weld-worker-1) Failed to define class com.shift.keycloak.HttpClientBuilder$VerifierWrapper in Module "deployment.shift-server.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/shift/keycloak/HttpClientBuilder$VerifierWrapper (Module "deployment.shift-server.war:main" from Service Module Loader)
>>  at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.Module.loadModuleClass(Module.java:568) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [wildfly-weld-8.1.0.Final.jar:8.1.0.Final]
>>  at org.jboss.weld.bootstrap.BeanDeployer.loadClass(BeanDeployer.java:106) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:94) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:60) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) [weld-core-impl-2.1.2.Final.jar:2014-01-09 09:23]
>>  at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0]
>>  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0]
>>  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0]
>>  at java.lang.Thread.run(Thread.java:744) [rt.jar:1.8.0]
>> Caused by: java.lang.NoClassDefFoundError: org/apache/http/conn/ssl/X509HostnameVerifier
>>  at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0]
>>  at java.lang.ClassLoader.defineClass(ClassLoader.java:760) [rt.jar:1.8.0]
>>  at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482) [jboss-modules.jar:1.3.3.Final]
>>  ... 19 more
>> Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.ssl.X509HostnameVerifier from [Module "deployment.shift-server.war:main" from Service Module Loader]
>>  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
>>  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
>>  ... 23 more
>> 
>> 2014-06-25 07:05:16,514 INFO  [org.jboss.weld.Bootstrap] (weld-worker-1) WELD-000119: Not generating any bean definitions from com.shift.keycloak.HttpClientBuilder$VerifierWrapper because of underlying class loading error: Type org.apache.http.conn.ssl.X509HostnameVerifier from [Module "deployment.shift-server.war:main" from Service Module Loader] not found.  If this is unexpected, enable DEBUG logging to see the full error.
>> 2014-06-25 07:05:16,530 INFO  [org.jboss.weld.Bootstrap] (weld-worker-2) WELD-000119: Not generating any bean definitions from com.shift.keycloak.HttpClientBuilder because of underlying class loading error: Type org.apache.http.conn.ssl.X509HostnameVerifier from [Module "deployment.shift-server.war:main" from Service Module Loader] not found.  If this is unexpected, enable DEBUG logging to see the full error.
>> 
>> 
>> I am getting a linkage error  
>> 
>> 
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-user
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20140625/d11a7cd1/attachment-0001.html 


More information about the keycloak-user mailing list