IBM Support

PH27629: CDI RESOURCE INJECTION OF MANAGEDEXECUTORSERVICE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When an object is registered in JNDI as multiple types, trying
    to perform @Resource injection from inside a CDI-managed bean
    would cause validation to fail in some cases.
    https://github.com
    /OpenLiberty/open-liberty/pull/13055
    
    Example: using a separate
    ManagedExecutorService (not the default one) with CDI.
    The code
    looks like this:
    @Dependent
    class ResourcesProducer
    {
    @Resource(lookup =
    "concurrent/sampleExecutor")
    @Produces
    private
    ManagedExecutorService sampleExecutor;
    }
    This gives to the
    following deployment error:
    Caused by:
    javax.enterprise.inject.spi.DefinitionException: CWOWB1007E:
    The producer field,
    ch.css.sample.srv.ejb.ResourcesProducer.sampleExecutor, has
    type javax.enterprise.concurrent.ManagedExecutorService, which
    does not match the type of the injected object.
    at com.ibm.ws.cd
    i.impl.weld.injection.BdaInjectionServicesImpl.throwDefinitionEx
    ception(BdaInjectionServicesImpl.java:103)
    at com.ibm.ws.cdi.imp
    l.weld.injection.BdaInjectionServicesImpl.validateJndiLookup(Bda
    InjectionServicesImpl.java:195)
    at com.ibm.ws.cdi.impl.weld.inje
    ction.BdaInjectionServicesImpl.validateJndiLookup(BdaInjectionSe
    rvicesImpl.java:137)
    at com.ibm.ws.cdi.impl.weld.injection.BdaIn
    jectionServicesImpl.registerResourceInjectionPoint(BdaInjectionS
    ervicesImpl.java:342)
    at org.jboss.weld.injection.ResourceInject
    ionFactory$ResourceResourceInjectionProcessor.getResourceReferen
    ceFactory(ResourceInjectionFactory.java:386)
    at org.jboss.weld.i
    njection.ResourceInjectionFactory$ResourceResourceInjectionProce
    ssor.getResourceReferenceFactory(ResourceInjectionFactory.java:3
    79)
    at org.jboss.weld.injection.ResourceInjectionFactory$Resourc
    eInjectionProcessor.createFieldResourceInjection(ResourceInjecti
    onFactory.java:216)
    at org.jboss.weld.injection.ResourceInjectio
    nFactory$ResourceInjectionProcessor.createResourceInjections(Res
    ourceInjectionFactory.java:188)
    at org.jboss.weld.injection.Reso
    urceInjectionFactory.discoverType(ResourceInjectionFactory.java:
    448)
    at org.jboss.weld.injection.ResourceInjectionFactory.getRes
    ourceInjections(ResourceInjectionFactory.java:96)
    at org.jboss.w
    eld.injection.producer.ResourceInjector.<init>(ResourceInjector.
    java:59)
    at org.jboss.weld.injection.producer.ResourceInjector.o
    f(ResourceInjector.java:49)
    at org.jboss.weld.injection.producer
    .BeanInjectionTarget.<init>(BeanInjectionTarget.java:63)
    at org.
    jboss.weld.injection.producer.BeanInjectionTarget.createDefault(
    BeanInjectionTarget.java:47)
    at org.jboss.weld.manager.Injection
    TargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryIm
    pl.java:113)
    at org.jboss.weld.manager.InjectionTargetFactoryImp
    l.createInjectionTarget(InjectionTargetFactoryImpl.java:86)
    at
    org.jboss.weld.bean.ManagedBean.<init>(ManagedBean.java:100)
    at
    org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80)
    at org.j
    boss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(Abstr
    actBeanDeployer.java:274)
    at org.jboss.weld.bootstrap.BeanDeploy
    er.createClassBean(BeanDeployer.java:226)
    at org.jboss.weld.boot
    strap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.jav
    a:74)
    at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWor
    k(ConcurrentBeanDeployer.java:71)
    at org.jboss.weld.executor.Ite
    rativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:6
    2)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(
    IterativeWorkerTaskFactory.java:55)
    at
    java.util.concurrent.FutureTask.run(Unknown Source)
    at
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
    Source)
    at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
    Source)
    at java.lang.Thread.run(Unknown Source)
    
    The same code
    works if we make an indirection via the java:app namespace in
    an ejb:
    @Stateless
    public class DummyBean {
    @Resource(name =
    "java:app/env/concurrent/sampleExecutor", lookup =
    "concurrent/sampleExecutor")
    private ManagedExecutorService
    sampleExecutor;
    }
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server                                      *
    ****************************************************************
    * PROBLEM DESCRIPTION: An injected object was not matching     *
    *                      it's JNDI definition.                   *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    An injected object was not matching it's JNDI definition.This
    can occur if an object is registered in JNDI under multiple
    interfaces
    

Problem conclusion

  • If the class registered in JNDI does not match the injected
    class we now fallback to actually
    performing a JNDI lookup to check if its assignable
    
    The fix for this APAR is targeted for inclusion in fix pack
    9.0.5.6. For more information, see 'Recommended Updates for
    WebSphere Application Server':
    https://www.ibm.com/support/pages/node/715553
    

Temporary fix

Comments

APAR Information

  • APAR number

    PH27629

  • Reported component name

    WEBS APP SERV N

  • Reported component ID

    5724H8800

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2020-07-20

  • Closed date

    2020-08-06

  • Last modified date

    2020-08-06

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WEBS APP SERV N

  • Fixed component ID

    5724H8800

Applicable component levels

  • R900 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
02 November 2021