-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 6.0
-
Fix Version/s: 7.1
-
Component/s: Seam / JSF UI
Some managed beans use the @PostConstruct and @PreDestroy annotations on protected method, which is valid according to the javadoc, but Stéphane run into a use case with embedded static war where the following stack trace appeared (with Java 8):
SEVERE: Class com.sun.faces.vendor.WebContainerInjectionProvider can not access a member of class org.nuxeo.ecm.platform.ui.web.binding.alias.NuxeoAliasBean with modifiers "protected" com.sun.faces.spi.InjectionProviderException: Class com.sun.faces.vendor.WebContainerInjectionProvider can not access a member of class org.nuxeo.ecm.platform.ui.web.binding.alias.NuxeoAliasBean with modifiers "protected" at com.sun.faces.vendor.WebContainerInjectionProvider.invokeAnnotatedMethod(WebContainerInjectionProvider.java:115) at com.sun.faces.vendor.WebContainerInjectionProvider.invokePreDestroy(WebContainerInjectionProvider.java:83) at com.sun.faces.mgbean.BeanBuilder.destroy(BeanBuilder.java:114) at com.sun.faces.mgbean.BeanManager.destroy(BeanManager.java:283) at com.sun.faces.application.WebappLifecycleListener.handleAttributeEvent(WebappLifecycleListener.java:297) at com.sun.faces.application.WebappLifecycleListener.requestDestroyed(WebappLifecycleListener.java:113) at com.sun.faces.config.ConfigureListener.requestDestroyed(ConfigureListener.java:344) at org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:5990) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: java.lang.IllegalAccessException: Class com.sun.faces.vendor.WebContainerInjectionProvider can not access a member of class org.nuxeo.ecm.platform.ui.web.binding.alias.NuxeoAliasBean with modifiers "protected" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109) at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261) at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253) at java.lang.reflect.Method.invoke(Method.java:599) at com.sun.faces.vendor.WebContainerInjectionProvider.invokeAnnotatedMethod(WebContainerInjectionProvider.java:113) ... 18 more
-> let's change the method to be public in case the protected qualifier is not ok in some cases