我正在使用Hibernate、Spring和JSF进行一个web项目。当我运行该项目时,我得到以下异常:
Servlet.service() for servlet Faces Servlet threw exception
java.lang.UnsupportedOperationException
at javax.faces.application.Application.getResourceHandler(Application.java:286)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:307)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
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:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
这是怎么造成的,我该如何解决?
这个问题是因为运行时类路径中缺少适合JSFneneneba API的JSF实现。解决方案是将JSF实现JAR文件放在运行时类路径中。
换句话说,您有一个/WEB-INF/lib/jsf-api.jar
文件,但没有/WEB-INF/lib/jsf-impl.jar
文件,至少与JSFneneneba API JAR文件的版本不同。你需要确保你提供了一个,至少是正确的版本。