[weld-dev] ManagedBean and Weld integration

Jozef Hartinger jharting at redhat.com
Wed Jun 3 09:02:19 EDT 2015


Oops, sorry. Ignore my last e-mail. How do you obtain the 
InjectionTarget for the non-CDI interceptor?

On 06/03/2015 12:52 PM, Emily Jiang wrote:
> Jozef,
> The PlainInterceptorFactory is weld class. Here is the stack when we 
> created an instance for a managed bean class (@ManagedBean) by calling 
> injectionTarget.produce(); You are not asking me to override 
> PlainInterceptorFactory, right?
>
>
> Caused by: java.lang.Exception
> at 
> org.jboss.weld.injection.producer.BasicInjectionTarget.createNonCdiInterceptor(BasicInjectionTarget.java:69)
> at 
> org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:126)
> at 
> org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:87)
> at 
> org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:80)
> at 
> org.jboss.weld.manager.InjectionTargetFactoryImpl.createInterceptorInjectionTarget(InjectionTargetFactoryImpl.java:75)
> at 
> org.jboss.weld.interceptor.reader.PlainInterceptorFactory.of(PlainInterceptorFactory.java:41)
> at 
> org.jboss.weld.interceptor.reader.InterceptorMetadataReader$1.load(InterceptorMetadataReader.java:44)
> at 
> org.jboss.weld.interceptor.reader.InterceptorMetadataReader$1.load(InterceptorMetadataReader.java:39)
> at 
> com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3599)
> at 
> com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2379)
> at 
> com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2342)
> at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2257)
> at com.google.common.cache.LocalCache.get(LocalCache.java:4000)
> at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4004)
> at 
> com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4874)
> at 
> org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49)
> at 
> org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:74)
> at 
> org.jboss.weld.interceptor.reader.InterceptorMetadataReader.getPlainInterceptorMetadata(InterceptorMetadataReader.java:64)
> at 
> org.jboss.weld.injection.producer.InterceptionModelInitializer.initClassDeclaredEjbInterceptors(InterceptionModelInitializer.java:233)
> at 
> org.jboss.weld.injection.producer.InterceptionModelInitializer.initEjbInterceptors(InterceptionModelInitializer.java:217)
> at 
> org.jboss.weld.injection.producer.InterceptionModelInitializer.init(InterceptionModelInitializer.java:103)
> at 
> org.jboss.weld.injection.producer.BeanInjectionTarget.buildInterceptionModel(BeanInjectionTarget.java:93)
> at 
> org.jboss.weld.injection.producer.BeanInjectionTarget.initializeInterceptionModel(BeanInjectionTarget.java:88)
> at 
> org.jboss.weld.injection.producer.BeanInjectionTarget.initializeAfterBeanDiscovery(BeanInjectionTarget.java:98)
> at 
> org.jboss.weld.injection.producer.InjectionTargetInitializationContext.initialize(InjectionTargetInitializationContext.java:42)
> at 
> org.jboss.weld.injection.producer.InjectionTargetService.addInjectionTargetToBeInitialized(InjectionTargetService.java:55)
> at 
> org.jboss.weld.injection.producer.InjectionTargetService.addInjectionTargetToBeInitialized(InjectionTargetService.java:49)
> at 
> org.jboss.weld.manager.InjectionTargetFactoryImpl.initialize(InjectionTargetFactoryImpl.java:145)
> at 
> org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:92)
> at 
> org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:80)
> at 
> org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:70)
> at 
> org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:54)
>
> On Wed, Jun 3, 2015 at 10:50 AM, Jozef Hartinger <jharting at redhat.com 
> <mailto:jharting at redhat.com>> wrote:
>
>     What I meant was that your PlainInterceptorFactory should in this
>     case, instead of calling createInterceptorInjectionTarget(), call
>
>     beanManager.createInjectionTargetBuilder(type)
>         .setDecorationEnabled(false)
>         .setInterceptionEnabled(false)
>         .setTargetClassLifecycleCallbacksEnabled(false)
>         .setResourceInjectionEnabled(true)
>         .build()
>
>     The InjectionTarget you get should be the same except for resource
>     injection which will be provided by Weld.
>
>     Jozef
>
>
>     On 06/03/2015 11:25 AM, Emily Jiang wrote:
>
>         I might have missed your point. Please elaborate a bit more.
>
>
>
>
>
> -- 
> Thanks
> Emily
> =================
> Emily Jiang
> ejiang at apache.org <mailto:ejiang at apache.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20150603/2422aad0/attachment.html 


More information about the weld-dev mailing list