You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WebLogic 12.2.1.4部署JSF 2.2开发的EAR文件出现NoSuchMethodError如何解决

问题报错

你使用WebLogic 12.2.1.4版本部署基于JSF 2.2开发的EAR文件时,抛出如下异常:

Caused by: java.lang.NoSuchMethodError: javax.faces.application.Application.addSearchKeywordResolver(Ljavax/faces/component/search/SearchKeywordResolver;)V
        at org.primefaces.util.Jsf23Helper.addSearchKeywordResolvers(Jsf23Helper.java:27)
        at org.primefaces.webapp.PostConstructApplicationEventListener.processEvent(PostConstructApplicationEventListener.java:48)
        at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
        at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
        at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
        at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:294)
        at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:739)
        at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:704)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:270)
        at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:719)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344)
        at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
        at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
        at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
        at weblogic.servlet.internal.EventsManager.executeContextListener(EventsManager.java:251)
        at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:204)
        at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:191)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1929)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3191)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1864)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:919)
        at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360)
        at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
根因分析

addSearchKeywordResolver是JSF 2.3版本才新增的API,WebLogic 12.2.1.4默认内置的JSF实现版本为2.2,本身不包含该方法。报错栈中的Jsf23Helper类说明你引入的PrimeFaces版本默认适配JSF 2.3,运行时尝试调用不存在的JSF 2.3 API就抛出了NoSuchMethodError。

解决方案
  • 方案1:降级PrimeFaces到适配JSF 2.2的版本。PrimeFaces 10及更早版本均支持JSF 2.2,若当前使用的是PrimeFaces 11+版本,降级到10.x或更低版本即可解决适配问题。
  • 方案2:升级WebLogic的JSF实现版本到2.3。可在WebLogic控制台更新全局JSF实现,或在EAR包中配置优先加载自身打包的JSF 2.3实现,需在weblogic-application.xml中配置类加载优先级,覆盖服务器自带的JSF 2.2包。
  • 方案3:若必须同时使用高版本PrimeFaces和JSF 2.2,可在项目的web.xml中添加如下配置,关闭PrimeFaces的JSF 2.3兼容特性:
<context-param>
    <param-name>primefaces.JSF23_AVAILABLE</param-name>
    <param-value>false</param-value>
</context-param>

内容的提问来源于stack exchange,提问作者Valleyman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.23 20:06:00