IBM Support

PI76688: Private lifecycle methods in JAX-RS resources are not invoked

Fixes are available

17.0.0.1: WebSphere Application Server Liberty 17.0.0.1
17.0.0.2: WebSphere Application Server Liberty 17.0.0.2
17.0.0.3: WebSphere Application Server Liberty 17.0.0.3
17.0.0.4: WebSphere Application Server Liberty 17.0.0.4
18.0.0.1: WebSphere Application Server Liberty 18.0.0.1
18.0.0.2: WebSphere Application Server Liberty 18.0.0.2
18.0.0.3: WebSphere Application Server Liberty 18.0.0.3
18.0.0.4: WebSphere Application Server Liberty 18.0.0.4
19.0.0.1: WebSphere Application Server Liberty 19.0.0.1
19.0.0.2: WebSphere Application Server Liberty 19.0.0.2
19.0.0.3: WebSphere Application Server Liberty 19.0.0.3
19.0.0.4: WebSphere Application Server Liberty 19.0.0.4
19.0.0.5: WebSphere Application Server Liberty 19.0.0.5
19.0.0.6: WebSphere Application Server Liberty 19.0.0.6
19.0.0.7: WebSphere Application Server Liberty 19.0.0.7
19.0.0.8: WebSphere Application Server Liberty 19.0.0.8
19.0.0.9: WebSphere Application Server Liberty 19.0.0.9
19.0.0.10: WebSphere Application Server Liberty 19.0.0.10
19.0.0.11: WebSphere Application Server Liberty 19.0.0.11
19.0.0.12: WebSphere Application Server Liberty 19.0.0.12
20.0.0.1: WebSphere Application Server Liberty 20.0.0.1
20.0.0.2: WebSphere Application Server Liberty 20.0.0.2
20.0.0.3: WebSphere Application Server Liberty 20.0.0.3
20.0.0.4: WebSphere Application Server Liberty 20.0.0.4
20.0.0.5: WebSphere Application Server Liberty 20.0.0.5
20.0.0.6: WebSphere Application Server Liberty 20.0.0.6
20.0.0.7: WebSphere Application Server Liberty 20.0.0.7
20.0.0.8: WebSphere Application Server Liberty 20.0.0.8
20.0.0.9: WebSphere Application Server Liberty 20.0.0.9
20.0.0.10: WebSphere Application Server Liberty 20.0.0.10
20.0.0.11: WebSphere Application Server Liberty 20.0.0.11
20.0.0.12: WebSphere Application Server Liberty 20.0.0.12

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When using the jaxrs-2.0 feature, if JAX-RS resource methods
    are annotated with @PostConstruct or @PreDestroy annotations
    and the method's visibility is private, the server will
    issue an error like the following:
    
    [2/10/17 12:25:18:611 CST] 0000004b
    com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I:
    An FFDC Incident has been created:
    "java.lang.IllegalAccessException: Class
    org.apache.cxf.jaxrs.utils.InjectionUtils can not access a
    member of class com.sample.MyResource with modifiers
    "private" org.apache.cxf.jaxrs.utils.InjectionUtils 1576" at
    ffdc_17.02.10_12.25.18.0.log [2/10/17 12:25:19:381 CST]
    0000004b com.ibm.ws.logging.internal.impl.IncidentImpl I
    FFDC1015I: An FFDC Incident has been created:
    "org.apache.cxf.service.factory.ServiceConstructionException
    com.ibm.ws.webcontainer.servlet.ServletWrapper.init 181" at
    ffdc_17.02.10_12.25.18.1.log [2/10/17 12:25:19:382 CST]
    0000004b com.ibm.ws.webcontainer.servlet E SRVE0271E:
    Uncaught init() exception created by servlet
    [com.sample.MyApplication] in application [MYSAMPLE]:
    org.apache.cxf.service.factory.ServiceConstructionException
    at
    org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServ
    erFactoryBean.java:219) at
    com.ibm.ws.jaxrs20.server.JaxRsWebEndpointImpl.init(JaxRsWeb
    EndpointImpl.java:66) at
    com.ibm.websphere.jaxrs.server.IBMRestServlet.init(IBMRestSe
    rvlet.java:65) at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletW
    rapper.java:332) at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest
    (ServletWrapper.java:633) at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest
    (ServletWrapper.java:475) at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFil
    ters(WebAppFilterManager.java:1161) at
    com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.j
    ava:4956) at
    com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.handleRequest
    (WebApp31.java:525) at
    com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequ
    est(DynamicVirtualHost.java:315) at
    com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContai
    ner.java:1014) at
    com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(Dynami
    cVirtualHost.java:280) at
    com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLi
    nk$TaskWrapper.run(HttpDispatcherLink.java:967) at
    com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLi
    nk.wrapHandlerAndExecute(HttpDispatcherLink.java:359) at
    com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLi
    nk.ready(HttpDispatcherLink.java:318) at
    com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.han
    dleDiscrimination(HttpInboundLink.java:471) at
    com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.han
    dleNewRequest(HttpInboundLink.java:405) at
    com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.pro
    cessRequest(HttpInboundLink.java:285) at
    com.ibm.ws.http.channel.internal.inbound.HttpICLReadCallback
    .complete(HttpICLReadCallback.java:66) at
    com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestCompl
    ete(WorkQueueManager.java:504) at
    com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(Wo
    rkQueueManager.java:574) at
    com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(Wo
    rkQueueManager.java:929) at
    com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(W
    orkQueueManager.java:1018) at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
    Executor.java:1157) at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
    lExecutor.java:627) at java.lang.Thread.run(Thread.java:798)
    Caused by: javax.ws.rs.InternalServerErrorException: HTTP
    500 Internal Server Error at
    org.apache.cxf.jaxrs.utils.SpecExceptions.toInternalServerEr
    rorException(SpecExceptions.java:79) at
    org.apache.cxf.jaxrs.utils.ExceptionUtils.toInternalServerEr
    rorException(ExceptionUtils.java:113) at
    org.apache.cxf.jaxrs.utils.InjectionUtils.invokeLifeCycleMet
    hod(InjectionUtils.java:1579) at
    org.apache.cxf.jaxrs.utils.InjectionUtils.injectContextProxi
    esAndApplication(InjectionUtils.java:1228) at
    org.apache.cxf.jaxrs.JAXRSServerFactoryBean.injectContexts(J
    AXRSServerFactoryBean.java:405) at
    org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResou
    rceProviders(JAXRSServerFactoryBean.java:429) at
    org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServ
    erFactoryBean.java:162) ... 25 more Caused by:
    java.lang.IllegalAccessException: Class
    org.apache.cxf.jaxrs.utils.InjectionUtils can not access a
    member of class com.sample.MyResource with modifiers
    "private" at
    sun.reflect.Reflection.ensureMemberAccess(Reflection.java:12
    3) at
    java.lang.reflect.AccessibleObject.slowCheckMemberAccess(Acc
    essibleObject.java:366) at
    java.lang.reflect.AccessibleObject.checkAccess(AccessibleObj
    ect.java:358) at
    java.lang.reflect.Method.invoke(Method.java:613) at
    org.apache.cxf.jaxrs.utils.InjectionUtils.invokeLifeCycleMet
    hod(InjectionUtils.java:1571) ... 29 more
    
    Without this fix, it is possible to work around the problem
    by changing the visibility of the methods to public.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server Liberty - JAX-RS                     *
    ****************************************************************
    * PROBLEM DESCRIPTION: Private lifecycle methods in JAX-RS     *
    *                      resources are not invoked               *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    When using the jaxrs-2.0 feature, if JAX-RS resource methods are
    annotated with @PostConstruct or @PreDestroy annotations and the
    method's visibility is private, the server will issue an error
    like the following:
    
    [2/10/17 12:25:18:611 CST] 0000004b
    com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An
    FFDC Incident has been created:
    "java.lang.IllegalAccessException: Class
    org.apache.cxf.jaxrs.utils.InjectionUtils can not access a
    member of class com.sample.MyResource with modifiers "private"
    org.apache.cxf.jaxrs.utils.InjectionUtils 1576" at
    ffdc_17.02.10_12.25.18.0.log?[2/10/17 12:25:19:381 CST] 0000004b
    com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An
    FFDC Incident has been created:
    "org.apache.cxf.service.factory.ServiceConstructionException
    com.ibm.ws.webcontainer.servlet.ServletWrapper.init 181" at
    ffdc_17.02.10_12.25.18.1.log?[2/10/17 12:25:19:382 CST] 0000004b
    com.ibm.ws.webcontainer.servlet E SRVE0271E: Uncaught init()
    exception created by servlet [com.sample.MyApplication] in
    application [MYSAMPLE]:
    org.apache.cxf.service.factory.ServiceConstructionException?at
    org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFa
    ctoryBean.java:219)?at
    com.ibm.ws.jaxrs20.server.JaxRsWebEndpointImpl.init(JaxRsWebEndp
    ointImpl.java:66)?at
    com.ibm.websphere.jaxrs.server.IBMRestServlet.init(IBMRestServle
    t.java:65)?at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapp
    er.java:332)?at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(Ser
    vletWrapper.java:633)?at
    com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(Ser
    vletWrapper.java:475)?at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters
    (WebAppFilterManager.java:1161)?at
    com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:
    4956)?at
    com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.handleRequest(Web
    App31.java:525)?at
    com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(
    DynamicVirtualHost.java:315)?at
    com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.
    java:1014)?at
    com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVir
    tualHost.java:280)?at
    com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$T
    askWrapper.run(HttpDispatcherLink.java:967)?at
    com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.w
    rapHandlerAndExecute(HttpDispatcherLink.java:359)?at
    com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.r
    eady(HttpDispatcherLink.java:318)?at
    com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleD
    iscrimination(HttpInboundLink.java:471)?at
    com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleN
    ewRequest(HttpInboundLink.java:405)?at
    com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.process
    Request(HttpInboundLink.java:285)?at
    com.ibm.ws.http.channel.internal.inbound.HttpICLReadCallback.com
    plete(HttpICLReadCallback.java:66)?at
    com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(
    WorkQueueManager.java:504)?at
    com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQu
    eueManager.java:574)?at
    com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQu
    eueManager.java:929)?at
    com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQ
    ueueManager.java:1018)?at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExec
    utor.java:1157)?at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExe
    cutor.java:627)?at java.lang.Thread.run(Thread.java:798)?Caused
    by: javax.ws.rs.InternalServerErrorException: HTTP 500 Internal
    Server Error?at
    org.apache.cxf.jaxrs.utils.SpecExceptions.toInternalServerErrorE
    xception(SpecExceptions.java:79)?at
    org.apache.cxf.jaxrs.utils.ExceptionUtils.toInternalServerErrorE
    xception(ExceptionUtils.java:113)?at
    org.apache.cxf.jaxrs.utils.InjectionUtils.invokeLifeCycleMethod(
    InjectionUtils.java:1579)?at
    org.apache.cxf.jaxrs.utils.InjectionUtils.injectContextProxiesAn
    dApplication(InjectionUtils.java:1228)?at
    org.apache.cxf.jaxrs.JAXRSServerFactoryBean.injectContexts(JAXRS
    ServerFactoryBean.java:405)?at
    org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceP
    roviders(JAXRSServerFactoryBean.java:429)?at
    org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFa
    ctoryBean.java:162)?... 25 more?Caused by:
    java.lang.IllegalAccessException: Class
    org.apache.cxf.jaxrs.utils.InjectionUtils can not access a
    member of class com.sample.MyResource with modifiers
    "private"?at
    sun.reflect.Reflection.ensureMemberAccess(Reflection.java:123)?a
    t
    java.lang.reflect.AccessibleObject.slowCheckMemberAccess(Accessi
    bleObject.java:366)?at
    java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.
    java:358)?at java.lang.reflect.Method.invoke(Method.java:613)?at
    org.apache.cxf.jaxrs.utils.InjectionUtils.invokeLifeCycleMethod(
    InjectionUtils.java:1571)?... 29 more
    
    Without this fix, it is possible to work around the problem by
    changing the visibility of the methods to public.
    

Problem conclusion

  • The fix for this APAR will invoke resource lifecycle methods,
    even if they use private visibility.
    
    The fix for this APAR is currently targeted for inclusion in fix
    pack 17.0.0.1.  Please refer to the Recommended Updates page for
    delivery information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI76688

  • Reported component name

    WAS LIBERTY COR

  • Reported component ID

    5725L2900

  • Reported release

    CD0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-02-15

  • Closed date

    2017-02-15

  • Last modified date

    2017-02-15

  • 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

    WAS LIBERTY COR

  • Fixed component ID

    5725L2900

Applicable component levels

  • RCD0 PSY

       UP

[{"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Product":{"code":"SSD28V","label":"WebSphere Application Server Liberty Core"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"CD0","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
19 October 2021