Hi Satya,

 

without being able to look more deeply into your set-up: it sounds like a typical class-loading problem. The class and the interface seem to be present twice: one time inside your deployment, one time outside. Those classes are different for the JVM, so any PathBasedKeycloakConfigResolver in your deployment does not implement the “outside” interface KeycloakConfigResolver – and that’s why it fails.

 

Can you use <scope>provided</scope> with your Maven dependency? This way the library would probably not be in the deployment assembly and not be a problem.

 

Best regards,

 

Hermann Josef Hill
Software Architect

optile GmbH
Ganghoferstraße 39 | 80339 München
Mobil +49 (151) 5385 0784

hermann.hill@optile.net | www.optile.net

USt.Id.-Nr. DE268847980
Geschäftsführer: Daniel Smeds
Handelsregister München HRB 183178

+++ Besuchen Sie uns auf der dmexco 2015 am 16. & 17. September, Köln, Halle 7.1 Stand F013 +++

 

Von: keycloak-dev-bounces@lists.jboss.org [mailto:keycloak-dev-bounces@lists.jboss.org] Im Auftrag von Satyajit Das
Gesendet: Montag, 31.
August 2015 06:17
An: keycloak-user@lists.jboss.org
Cc: keycloak-dev@lists.jboss.org
Betreff: Re: [keycloak-dev] Issue with multi tenancy

 

HI Team,

 

Did any one get a chance to look at the issue.

 

Kindly look into it. 

 

Looking forward to your positive response.

 

Regards,

Satya

 

On Fri, Aug 28, 2015 at 8:31 PM, Satyajit Das <satyajit.das@spire2grow.com> wrote:

Hi Team,

 

I have configured PathBasedKeycloakConfigResolver in my package: com.demo.util.

 

The context param has been set on web.xml

<context-param>

        <param-name>keycloak.config.resolver</param-name>

        <param-value>org.keycloak.example.PathBasedKeycloakConfigResolver</param-value>

    </context-param>

 

I deployed the application on Tomcat. I have registered the context.xml in meta-inf with the required adapter.

 

Tomcat lib directory has all the required keycloak jar files.

 

But PathBasedKeycloakConfigResolver never gets called on any request to the url.

One strange thing i find that in eclipse if I remove the maven dependency from deployment assembly(right click on project-> properties->deployment assembly) it works But if i put it back it fails. Maven dependency is a must.

 

After debugging   String configResolverClass = context.getServletContext().getInitParameter("keycloak.config.resolver"); of AbstractKeycloakAuthenticatorValve class

 

Got the following error: when PathBasedKeycloakConfigResolver  is being instantiated.

 

java.lang.ClassCastException: org.keycloak.example.PathBasedKeycloakConfigResolver cannot be cast to org.keycloak.adapters.KeycloakConfigResolver

 

But PathBasedKeycloakConfigResolver implements org.keycloak.adapters.KeycloakConfigResolver.

 

 

Regards,

Satya.