Post by Matthew Broadheadstarts up ok but then on page load i get
|java.lang.StackOverflowError at
org.apache.webbeans.util.GenericsUtil.isAssignableFrom(GenericsUtil.java:172)
at
org.apache.webbeans.util.GenericsUtil.isAssignableFrom(GenericsUtil.java:146)
at
org.apache.webbeans.util.GenericsUtil.isAssignableFrom(GenericsUtil.java:117)
at
org.apache.webbeans.util.GenericsUtil.satisfiesDependency(GenericsUtil.java:61)
at
org.apache.webbeans.container.BeanManagerImpl.isBeanTypeAssignableToGivenType(BeanManagerImpl.java:923)
at
org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
at
org.apache.webbeans.portable.ProducerMethodProducer.produce(ProducerMethodProducer.java:84)
at
org.apache.webbeans.portable.AbstractProducer.produce(AbstractProducer.java:172)
at
org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:122)
at
org.apache.webbeans.component.ProducerMethodBean.create(ProducerMethodBean.java:95)
at
org.apache.webbeans.context.DependentContext.getInstance(DependentContext.java:68)
at org.apache.webbeans.context.AbstractContext.get(AbstractContext.java:125)
at
org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:799)
at
org.apache.webbeans.container.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:659)
at
org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:103)
at
org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
at
org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:220)
at
org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:206)
at
org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:196)
at
org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:126)
at org.apache.webbeans.component.ManagedBean.create(ManagedBean.java:67) at
org.apache.webbeans.context.creational.BeanInstanceBag.create(BeanInstanceBag.java:76)
at
org.apache.webbeans.context.AbstractContext.getInstance(AbstractContext.java:159)
at org.apache.webbeans.context.AbstractContext.get(AbstractContext.java:125)
at
org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:101)
at
org.apache.webbeans.intercept.RequestScopedBeanInterceptorHandler.getContextualInstance(RequestScopedBeanInterceptorHandler.java:76)
at
org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.get(NormalScopedBeanInterceptorHandler.java:71)
at
org.apache.webbeans.proxy.NormalScopeProxyFactory.unwrapInstance(NormalScopeProxyFactory.java:90)
at
org.apache.webbeans.inject.InjectableMethod.doInjection(InjectableMethod.java:91)
at
org.apache.webbeans.portable.ProducerMethodProducer.produce(ProducerMethodProducer.java:89)
at
org.apache.webbeans.portable.AbstractProducer.produce(AbstractProducer.java:172)
at
org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:122)
at
org.apache.webbeans.component.ProducerMethodBean.create(ProducerMethodBean.java:95)
at
org.apache.webbeans.context.DependentContext.getInstance(DependentContext.java:68)
at org.apache.webbeans.context.AbstractContext.get(AbstractContext.java:125)
at
org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:799)
at
org.apache.webbeans.container.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:659)
at
org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:103)
at
org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65)
at
org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:220)
at
org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:206)
at
org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:196)
at
org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:126)|
Post by Romain Manni-BucauHi
it looks accurate, a normal scoped instance - request scoped - proxies
too if you inject this context in request scoped instances only.
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
2017-11-27 11:02 GMT+01:00 Matthew Broadhead
Post by Matthew Broadhead@Produces
@Default
@RequestScoped
public KeycloakSecurityContext keycloakSecurityContext() {
if (httpServletRequest.getUserPrincipal() instanceof
KeycloakPrincipal)
{
KeycloakPrincipal<KeycloakSecurityContext> keycloakPrincipal =
(KeycloakPrincipal<KeycloakSecurityContext>)
httpServletRequest.getUserPrincipal();
return keycloakPrincipal.getKeycloakSecurityContext();
}
return null;
}
then i get
uk.me.kissy.external.producers.SecurityProducer scope type must be
@Dependent to create null instance
at
org.apache.webbeans.util.WebBeansUtil.checkNullInstance(WebBeansUtil.java:902)
to keycloakSecurityContext() i get
org.apache.openejb.cdi.OpenEJBLifecycle.startApplication CDI Beans module
deployment failed
org.apache.webbeans.exception.WebBeansConfigurationException: Annotated
producer method : public org.keycloak.KeycloakSecurityContext
uk.me.kissy.external.producers.SecurityProducer.token()must declare default
@Scope annotation