我有一个简单的渴望应用程序范围的JSFbean:
@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!");
}
}
虽然@ManagedProperty
行被注释掉了(没有依赖注入),但一切都"正常"(除了例外,我不能在该bean中做任何有用的事情)。
然而,在取消注释后,我得到了错误:
java.lang.UnsupportedOperationException:在启动期间不支持此方法
不幸的是,我找不到任何有用的信息,在启动过程中不支持WHAT方法。我只知道依赖项注入有问题。MyBean
没有什么特别的,它是应用程序范围的,它没有依赖关系,它只有一些私有属性,需要为每个应用程序配置(bean在共享库中)。
这是完整的堆栈跟踪:
java.lang.UnsupportedOperationException:不支持此方法在启动期间org.apache.myfaces.context.servlet.StartupServlet ExternalContextImpl.getRequestMap(StartupServlet ExternalContext Impl.java:149)在org.apache.myfaces.config.ManagedBeanBuilder.getScope(ManagedBeanBuildr.java:540)在org.apache.myfaces.config.ManagedBeanBuilder.getNarrowestScope(ManagedBeanBuildr.java:462)在org.apache.myfaces.config.ManagedBeanBuilder.isInValidScope(ManagedBeanBuildr.java:433)在org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(ManagedBeanBuildr.java:322)在org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuildr.java:169)在org.apache.myfaces.webapp.AbstractFacesInitializer._createEagleBeans(AbstractFacesIinitializer.java:235)在org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesIinitializer.java:152)在org.apache.myfaces.webapp.StartupServlet上下文监听器.contextInitialized(StartupServlet上下文侦听器.java:111)在com.ibm.ws.webcontainer.webapp.webapp.notifyServlet上下文创建(webapp.java:1678)在com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)在com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)在com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)在com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)在com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)在com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)在com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)在com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1173)在com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)在com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)在com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)在com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:772)在com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1367)在com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2172)在com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitManageImpl.java:445)在com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)在com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitManagerImpl.java:388)在com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitManager Impl.java:116)在com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitManager Impl.java:663)在com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5549)在com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:55585)在com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)在com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitManager Impl.java:677)在com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitManager Impl.java:621)在com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1259)位于的sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)位于java.lang.reflect.Method.ioke(Method.java:611)sun.reflect.mic.Trampoline.uinvoke(MethodUtil.java:49)位于sun.reflect.GeneratedMethodAccessor66.invoke(未知源)位于sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)位于java.lang.reflect.Method.ioke(Method.java:611)sun.reflect.misc.MethodUtil.ioke(MethodUtil.java:256)javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148)在java.security.AccessController.doPrivileged(AccessController.java:252)在com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)在sun.mic.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)在javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142)在javax.management.modelmbean.RequiredModelMBean.vinvoke(RequiredModelMBean.java:995)在com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.ioke(DefaultMBeanServerInterceptor.java:848)在com.sun.jmx.mbeanserver.JmxMBeanServer.ioke(JmxMBean Server.java:774)在com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)在com.ibm.ws.security.util.AccessController.doPrivileged(访问控制器.java:118)在com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)在com.ibm.ws.management.application.sync.StartDeploymentTask.startDeployment(StartDeploymentTask.java:247)在com.ibm.ws.management.application.sync.StartDeploymentTask.fullAppUpdate(StartDeploymentTask.java:119)在com.ibm.ws.management.application.sync.StartDeploymentTask.performTask(StartDeploymentTask.java:107)在com.ibm.ws.management.application.sync.AppBinaryProcessor$ExpandApp.expand(AppBinaryProcessor.java:1709)在com.ibm.ws.management.application.sync.AppBinaryProcessor.postProcessSynchronousExt(AppBinaryProcessor.java:749)在com.ibm.ws.management.bla.sync.BLABinaryProcessor.postProcess(BLABinaryProcessor.java:590)在com.ibm.ws.management.bla.sync.BLABinaryProcessor.onChangeCompletion(BLABinaryProcessor.java:467)在com.ibm.ws.management.bla.sync.BinaryProcessorWrapper.onChangeCompletion(BinaryProcessorWrapper.java:109)在com.ibm.ws.management.repository.FileRepository.postNotify(FileRepository.java:1924)在com.ibm.ws.management.repository.FileRepository.update(FileRepository.java:1433)在com.ibm.ws.management.repository.client.LocalConfigRepositoryClient.update(LocalConfigRepositoryClient.java:189)在com.ibm.ws.sm.workspace.impl.WorkSpaceMasterRepositoryAdapter.update(WorkSpaceMasterRepositoryAdapter.java:665)在com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.update(RepositoryContextImpl.java:1998)在com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.synch(RepositoryContextImpl.java:1946)在com.ibm.ws.sm.workspace.impl.WorkSpaceImpl.synch(WorkSpaceImpl.java:549)在com.ibm.ws.management.configservice.ConfigServiceImpl.save(ConfigServiceImpl.java:719)位于的sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)位于java.lang.reflect.Method.ioke(Method.java:611)sun.reflect.mic.Trampoline.uinvoke(MethodUtil.java:49)位于sun.reflect.GeneratedMethodAccessor66.invoke(未知源)位于sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)位于java.lang.reflect.Method.ioke(Method.java:611)sun.reflect.misc.MethodUtil.ioke(MethodUtil.java:256)javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148)在java.security.AccessController.doPrivileged(AccessController.java:252)在com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)在sun.mic.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)在javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142)在javax.management.modelmbean.RequiredModelMBean.vinvoke(RequiredModelMBean.java:995)在com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.ioke(DefaultMBeanServerInterceptor.java:848)在com.sun.jmx.mbeanserver.JmxMBeanServer.ioke(JmxMBean Server.java:774)在com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)在com.ibm.ws.security.util.AccessController.doPrivileged(访问控制器.java:118)在com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)在com.ibm.ws.management.remote.AdminServiceForwarder.invoke(AdminServiceForward.java:346)在javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnection Impl.java:1465)在javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnection Impl.java:85)在javax.management.remote.rmi.RMConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1306)在javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnection Impl.java:1398)在javax.management.remote.rmi.MRMConnectionImpl.invoke(RMIConnectionImpl.java:829)在javax.management.remote.rmi.RMIConnectionImpl_Tie.invoke(_RMIConnectionImpl_Tie.java:751)在javax.management.remote.rmi.RMIConnectionImpl_Tie._invoke(_RMIConnectionImpl_Tie.java:158)在com.ibm.CORBA.iop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:669)在com.ibm.CORBA.iop.ServerDelegate.dispatch(ServerDelegate.java:523)网址:com.ibm.rmi.iiop.ORB.produce(ORB.java:523)com.ibm.CORBA.iiop.ORB.process(ORB.java:1575)com.ibm.rmi.iiop.Connection.doRequestWork(Connection.java:3039)com.ibm.rmi.iiop.Connection.doWork(Connection.java:2922)com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64)com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815)
运行的配置:WebSphere 8.5带有MyFaces 2.0.2(IBM自定义版本)。
这个错误是什么意思?需要做些什么才能进行依赖项注入工作?
信息,http://docs.oracle.com/javaee/6/api/javax/faces/bean/ManagedBean.html
渴望申请。强制它先加载。删除急切的,似乎其他人也有类似的错误Eagle ApplicationScoped托管的bean多次构建
某些注释存在重复的包。凸轮。他们是正确的