2

当我尝试加载网页时,出现以下异常: java.lang.NoSuchMethodError: org.primefaces.context.DefaultRequestContext.(Ljavax/faces/context/FacesContext;)V

我试图弄清楚它是从哪里来的,但我什么也没找到:(你有没有遇到过这个异常并且知道如何解决它?

这是 Glassfish 的完整堆栈跟踪:

WARNUNG: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NoSuchMethodError: org.primefaces.context.DefaultRequestContext.<init>(Ljavax/faces/context/FacesContext;)V
at org.primefaces.context.PrimeFacesContext.<init>(PrimeFacesContext.java:16)
at org.primefaces.context.PrimeFacesContextFactory.getFacesContext(PrimeFacesContextFactory.java:23)
at com.sun.faces.context.InjectionFacesContextFactory.getFacesContext(InjectionFacesContextFactory.java:121)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:583)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)[/code]

在此先感谢 Xera

4

2 回答 2

2

正如 RongNK 正确建议的那样,我们的类路径中有多个版本的 PrimeFaces 会导致此错误。再次感谢 RongNK :)

于 2013-05-31T12:25:27.680 回答
0

我从@ManagedBean 收到了类似的错误

java.lang.NoSuchMethodError:package.ManagedBean。

但是 ManagedBean 提供了一个方法 public init() {...}

所以这对我有用:只需为错误类实现一个不带参数的公共构造函数。

于 2015-07-08T07:38:46.473 回答