[keycloak-user] KeycloakPrincipal ClassCastException
Bill Burke
bburke at redhat.com
Thu Mar 9 20:06:00 EST 2017
What do you mean "separate jar"? A jar in the WAR?
On 3/9/17 6:49 PM, Brent Vaughn wrote:
> Using KeyCloak 2.5.4 and Wildfly 10.1.0
>
> I am attempting to create a JSF component that involves Keycloak. I am getting this exception:
>
> java.lang.ClassCastException: org.keycloak.KeycloakPrincipal cannot be cast to org.keycloak.KeycloakPrincipal
>
>
> Below is the line of code that throws the exception.
>
> public void encodeBegin(FacesContext context) {
> ..........
> KeycloakPrincipal<KeycloakSecurityContext> kp = (KeycloakPrincipal<KeycloakSecurityContext>) context.getExternalContext().getUserPrincipal();
> ..........
> }
>
>
> Funny thing is this. The exception is only thrown when the JSF Component is in a separate jar and then added to the project. If I put the code in question directly in the project, it doesn't throw the exception.
>
> Can anyone help me with this?
>
> _______________________________________________
> 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