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)
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.
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.