[keycloak-user] java.lang.NoClassDefFoundError: org/keycloak/representations/AccessTokenResponse

valsaraj pv valsarajpv at gmail.com
Tue May 22 07:08:29 EDT 2018


After setting resteasy dependency got another:

> 2018-05-22 16:35:25,069 WARN  [com.ltchie.mco.web.ErrorServlet] (default
>> task-9) Error in processing request: java.lang.NoClassDefFoundError:
>> javax/ws/rs/BadRequestException
>
> at org.keycloak.admin.client.Keycloak.<init>(Keycloak.java:60)
>
> at org.keycloak.admin.client.Keycloak.getInstance(Keycloak.java:106)
>
>
>>

On Tue, May 22, 2018 at 4:35 PM, valsaraj pv <valsarajpv at gmail.com> wrote:

> Removed keycloak jars from application & then added
> keycloak-admin-client-3.4.3.Final.jar in keycloak-core module for
> checking. Then got following exception:
>
>> java.lang.NoClassDefFoundError: org/jboss/resteasy/client/
>> jaxrs/ResteasyClientBuilder
>> at org.keycloak.admin.client.Keycloak.<init>(Keycloak.java:58)
>> at org.keycloak.admin.client.Keycloak.getInstance(Keycloak.java:106)
>> at com.ltchie.keycloak.util.KeycloakUtil.getInstance(
>> KeycloakUtil.java:78)
>> at org.tolven.web.security.GeneralSecurityFilter.doFilter(
>> GeneralSecurityFilter.java:478)
>
>
> Looks like resteasy dependency required here.
> So  keycloak-admin-client not coming out of the box for WidFly modules.
> Is there any other jar that can be used for calling admin APIs?
>
>
> On Tue, May 22, 2018 at 4:11 PM, valsaraj pv <valsarajpv at gmail.com> wrote:
>
>> Which Keycloak API jar we can use to call admin APIs from Java
>> application?
>>
>> On Tue, May 22, 2018 at 4:08 PM, valsaraj pv <valsarajpv at gmail.com>
>> wrote:
>>
>>> After adding keycloak-core-3.4.3.Final.jar into ear:
>>>
>>>> java.lang.LinkageError: loader constraint violation: loader (instance
>>>> of org/jboss/modules/ModuleClassLoader) previously initiated loading
>>>> for a different type with name "org/keycloak/representations/
>>>> idm/RealmRepresentation"
>>>> at java.lang.Class.forName0(Native Method)
>>>> at java.lang.Class.forName(Class.java:264)
>>>> at com.sun.proxy.$Proxy344.<clinit>(Unknown Source)
>>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>> Method)
>>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Native
>>>> ConstructorAccessorImpl.java:62)
>>>> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De
>>>> legatingConstructorAccessorImpl.java:45)
>>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
>>>> at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:739)
>>>> at org.jboss.resteasy.client.jaxrs.ProxyBuilder.proxy(ProxyBuil
>>>> der.java:79)
>>>> at org.jboss.resteasy.client.jaxrs.ProxyBuilder.build(ProxyBuil
>>>> der.java:131)
>>>> at org.jboss.resteasy.client.jaxrs.internal.ClientWebTarget.pro
>>>> xy(ClientWebTarget.java:74)
>>>> at org.keycloak.admin.client.Keycloak.realms(Keycloak.java:114)
>>>> at org.keycloak.admin.client.Keycloak.realm(Keycloak.java:118)
>>>
>>>
>>>
>>> On Tue, May 22, 2018 at 3:07 PM, valsaraj pv <valsarajpv at gmail.com>
>>> wrote:
>>>
>>>>
>>>> Hi,
>>>>
>>>> I am getting following exception when calling admin API:
>>>>
>>>>> java.lang.NoClassDefFoundError: org/keycloak/representations/A
>>>>>> ccessTokenResponse
>>>>>
>>>>> at java.lang.Class.getDeclaredMethods0(Native Method)
>>>>>
>>>>> at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>>>>>
>>>>> at java.lang.Class.privateGetPublicMethods(Class.java:2902)
>>>>>
>>>>> at java.lang.Class.getMethods(Class.java:1615)
>>>>>
>>>>> at org.jboss.resteasy.client.jaxrs.ProxyBuilder.proxy(ProxyBuil
>>>>>> der.java:48)
>>>>>
>>>>> at org.jboss.resteasy.client.jaxrs.ProxyBuilder.build(ProxyBuil
>>>>>> der.java:131)
>>>>>
>>>>> at org.jboss.resteasy.client.jaxrs.internal.ClientWebTarget.pro
>>>>>> xy(ClientWebTarget.java:74)
>>>>>
>>>>> at org.keycloak.admin.client.token.TokenManager.<init>(TokenMan
>>>>>> ager.java:55)
>>>>>
>>>>> at org.keycloak.admin.client.Keycloak.<init>(Keycloak.java:60)
>>>>>
>>>>> at org.keycloak.admin.client.Keycloak.getInstance(Keycloak.java:106)
>>>>>
>>>>>
>>>> I have added keycloak-admin-client-3.4.3.Final.jar in ear lib & set
>>>> dependency to following modules:
>>>>
>>>>> <module name="org.keycloak.keycloak-adapter-spi"/>
>>>>
>>>> <module name="org.keycloak.keycloak-adapter-core"/>
>>>>
>>>> <module name="org.keycloak.keycloak-common"/>
>>>>
>>>> <module name="org.keycloak.keycloak-core"/>
>>>>
>>>>
>>>> Thanks!
>>>>
>>>
>>>
>>>
>>> --
>>> Life is like this: "Just when we get all the answers of life.... God
>>> changes the question paper....
>>>
>>> Valsaraj Viswanathan
>>>
>>
>>
>>
>> --
>> Life is like this: "Just when we get all the answers of life.... God
>> changes the question paper....
>>
>> Valsaraj Viswanathan
>>
>
>
>
> --
> Life is like this: "Just when we get all the answers of life.... God
> changes the question paper....
>
> Valsaraj Viswanathan
>



-- 
Life is like this: "Just when we get all the answers of life.... God
changes the question paper....

Valsaraj Viswanathan


More information about the keycloak-user mailing list