1
votes

I have a simple eager application scoped JSF bean:

@ManagedBean(eager = true, name = "SetupBean")
@ApplicationScoped
public class SetupBean {
    @ManagedProperty(value = "#{myBean}")
    private MyBean myBean;
    public void setMyBean(final MyBean myBean) {
        this.myBean = myBean;
    }    
    @PostConstruct
    public void postConstruct() {
        System.err.println("I'm here!");
    }
}

While the @ManagedProperty line is commented out (no dependecy injection) everything works "OK" (with the exception, I can't do anything useful in that bean).

However, after uncommenting I get the error:

java.lang.UnsupportedOperationException: This method is not supported during startup

Unfortunatelly, I can't find any useful information WHAT method is not supported during the startup. I know only that there's something wrong with dependency injection. The MyBean is nothing special, it's Application Scoped, it has no dependency, it has only some private properties, that need to be configured per application (the bean is in shared library).

Here's the full stack trace:

java.lang.UnsupportedOperationException: This method is not supported during startup at org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getRequestMap(StartupServletExternalContextImpl.java:149) at org.apache.myfaces.config.ManagedBeanBuilder.getScope(ManagedBeanBuilder.java:540) at org.apache.myfaces.config.ManagedBeanBuilder.getNarrowestScope(ManagedBeanBuilder.java:462) at org.apache.myfaces.config.ManagedBeanBuilder.isInValidScope(ManagedBeanBuilder.java:433) at org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(ManagedBeanBuilder.java:322) at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:169) at org.apache.myfaces.webapp.AbstractFacesInitializer._createEagerBeans(AbstractFacesInitializer.java:235) at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:152) at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:111) at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1678) at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414) at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88) at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169) at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749) at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634) at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426) at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1173) at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370) at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639) at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:772) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1367) at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2172) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445) at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:663) at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5459) at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5585) at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:677) at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621) at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1259) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:49) at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:256) at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148) at java.security.AccessController.doPrivileged(AccessController.java:252) at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30) at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41) at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:995) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:774) at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228) at com.ibm.ws.management.application.sync.StartDeploymentTask.startDeployment(StartDeploymentTask.java:247) at com.ibm.ws.management.application.sync.StartDeploymentTask.fullAppUpdate(StartDeploymentTask.java:119) at com.ibm.ws.management.application.sync.StartDeploymentTask.performTask(StartDeploymentTask.java:107) at com.ibm.ws.management.application.sync.AppBinaryProcessor$ExpandApp.expand(AppBinaryProcessor.java:1709) at com.ibm.ws.management.application.sync.AppBinaryProcessor.postProcessSynchronousExt(AppBinaryProcessor.java:749) at com.ibm.ws.management.bla.sync.BLABinaryProcessor.postProcess(BLABinaryProcessor.java:590) at com.ibm.ws.management.bla.sync.BLABinaryProcessor.onChangeCompletion(BLABinaryProcessor.java:467) at com.ibm.ws.management.bla.sync.BinaryProcessorWrapper.onChangeCompletion(BinaryProcessorWrapper.java:109) at com.ibm.ws.management.repository.FileRepository.postNotify(FileRepository.java:1924) at com.ibm.ws.management.repository.FileRepository.update(FileRepository.java:1433) at com.ibm.ws.management.repository.client.LocalConfigRepositoryClient.update(LocalConfigRepositoryClient.java:189) at com.ibm.ws.sm.workspace.impl.WorkSpaceMasterRepositoryAdapter.update(WorkSpaceMasterRepositoryAdapter.java:665) at com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.update(RepositoryContextImpl.java:1998) at com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.synch(RepositoryContextImpl.java:1946) at com.ibm.ws.sm.workspace.impl.WorkSpaceImpl.synch(WorkSpaceImpl.java:549) at com.ibm.ws.management.configservice.ConfigServiceImpl.save(ConfigServiceImpl.java:719) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:49) at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:256) at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148) at java.security.AccessController.doPrivileged(AccessController.java:252) at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30) at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41) at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:995) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:774) at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228) at com.ibm.ws.management.remote.AdminServiceForwarder.invoke(AdminServiceForwarder.java:346) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1465) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:85) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1306) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1398) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) at javax.management.remote.rmi._RMIConnectionImpl_Tie.invoke(_RMIConnectionImpl_Tie.java:751) at javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(_RMIConnectionImpl_Tie.java:158) at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:669) at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:523) at com.ibm.rmi.iiop.ORB.process(ORB.java:523) at com.ibm.CORBA.iiop.ORB.process(ORB.java:1575) at com.ibm.rmi.iiop.Connection.doRequestWork(Connection.java:3039) at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2922) at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64) at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815)

The running configuration: WebSphere 8.5 with MyFaces 2.0.2 (IBM custom version).

What does that error mean? What need to be done in order to get the dependency injection work?

1

1 Answers

1
votes

Info, http://docs.oracle.com/javaee/6/api/javax/faces/bean/ManagedBean.html

Eager with application. Forces it to load first. Remove eager, seems others have similar bugs Eager ApplicationScoped managed beans constructed multiple times

There are duplicate packages for the some annotations. Cam u chec. They are right