我正在尝试使用jsf 2.2创建一个Web应用程序。我的应用程序使用 JERSEY Restful,jre 1.8,JSF 2.2,Primefaces。
它在我的本地计算机上完全正常,但在AWS(EC2- Tomcat by bitnami-free tier)上我收到错误(错误日志在底部。)
非常感谢您在Advance中提供的帮助。
我使用以下库
这是我的Web.xml文件代码:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>MYAPP</display-name>
<welcome-file-list>
<welcome-file>welcome.jsf</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Jersey Rest Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Rest Service</servlet-name>
<url-pattern>/webresources/*</url-pattern>
</servlet-mapping>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
</web-app>
错误记录 201-Apr-2018 03:33:43.130 SEVERE [localhost-startStop-23] org.apache.catalina.core.StandardContext.listenerStart将上下文初始化事件发送到类[com.sun.faces.config.ConfigureListener]的侦听器实例的异常 java.lang.RuntimeException:java.lang.NoSuchMethodError:javax.faces.application.Application.addSearchKeywordResolver(Ljavax / faces / component / search / SearchKeywordResolver;)V at com.sun.faces.config.ConfigureListener.contextInitialized(Unknown Source) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) 在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986) 在org.apache.catalina.startup.HostConfig $ DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624) 在java.lang.Thread.run(Thread.java:748) 引起: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) 在javax.faces.event.SystemEvent.processListener(未知来源) at com.sun.faces.application.ApplicationImpl.processListeners(Unknown Source) at com.sun.faces.application.ApplicationImpl.invokeListenersFor(Unknown Source) at com.sun.faces.application.ApplicationImpl.publishEvent(Unknown Source) at com.sun.faces.config.ConfigManager.publishPostConfigEvent(Unknown Source) ......还有14个
26-Apr-2018 03:33:43.463 SEVERE [localhost-startStop-23] org.apache.catalina.core.StandardContext.listenerStart将上下文初始化事件发送到类[com.sun.faces.config]的侦听器实例的异常.ConfigureListener] java.lang.RuntimeException:java.lang.NoSuchMethodError:javax.faces.application.Application.addSearchKeywordResolver(Ljavax / faces / component / search / SearchKeywordResolver;)V at com.sun.faces.config.ConfigureListener.contextInitialized(Unknown Source) 在org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4743) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) 在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986) 在org.apache.catalina.startup.HostConfig $ DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624) 在java.lang.Thread.run(Thread.java:748) 引起: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) 在javax.faces.event.SystemEvent.processListener(未知来源) at com.sun.faces.application.ApplicationImpl.processListeners(Unknown Source) at com.sun.faces.application.ApplicationImpl.invokeListenersFor(Unknown Source) at com.sun.faces.application.ApplicationImpl.publishEvent(Unknown Source) at com.sun.faces.config.ConfigManager.publishPostConfigEvent(Unknown Source) ......还有14个
26-Apr-2018 03:39:45.299 SEVERE [localhost-startStop-24] org.apache.catalina.core.StandardContext.listenerStart将上下文初始化事件发送到类[com.sun.faces.config]的侦听器实例的异常.ConfigureListener] java.lang.RuntimeException:java.lang.NoSuchMethodError:javax.faces.application.Application.addSearchKeywordResolver(Ljavax / faces / component / search / SearchKeywordResolver;)V at com.sun.faces.config.ConfigureListener.contextInitialized(Unknown Source) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) 在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986) 在org.apache.catalina.startup.HostConfig $ DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624) 在java.lang.Thread.run(Thread.java:748) 引起: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) 在javax.faces.event.SystemEvent.processListener(未知来源) at com.sun.faces.application.ApplicationImpl.processListeners(Unknown Source) at com.sun.faces.application.ApplicationImpl.invokeListenersFor(Unknown Source) at com.sun.faces.application.ApplicationImpl.publishEvent(Unknown Source) at com.sun.faces.config.ConfigManager.publishPostConfigEvent(Unknown Source) ......还有14个
26-Apr-2018 03:39:45.716 SEVERE [localhost-startStop-24] org.apache.catalina.core.StandardContext.listenerStart将上下文初始化事件发送到类[com.sun.faces.config]的侦听器实例的异常.ConfigureListener] java.lang.RuntimeException:java.lang.NoSuchMethodError:javax.faces.application.Application.addSearchKeywordResolver(Ljavax / faces / component / search / SearchKeywordResolver;)V at com.sun.faces.config.ConfigureListener.contextInitialized(Unknown Source) 在org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4743) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) 在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986) 在org.apache.catalina.startup.HostConfig $ DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624) 在java.lang.Thread.run(Thread.java:748) 引起: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) 在javax.faces.event.SystemEvent.processListener(未知来源) at com.sun.faces.application.ApplicationImpl.processListeners(Unknown Source) at com.sun.faces.application.ApplicationImpl.invokeListenersFor(Unknown Source) at com.sun.faces.application.ApplicationImpl.publishEvent(Unknown Source) at com.sun.faces.config.ConfigManager.publishPostConfigEvent(Unknown Source) ......还有14个
26-Apr-2018 04:57:18.310 SEVERE [localhost-startStop-25] org.apache.catalina.core.StandardContext.listenerStart将上下文初始化事件发送到类[com.sun.faces.config]的侦听器实例的异常.ConfigureListener] java.lang.RuntimeException:java.lang.NoSuchMethodError:javax.faces.application.Application.addSearchKeywordResolver(Ljavax / faces / component / search / SearchKeywordResolver;)V at com.sun.faces.config.ConfigureListener.contextInitialized(Unknown Source) 在org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4743) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) 在org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986) 在org.apache.catalina.startup.HostConfig $ DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624) 在java.lang.Thread.run(Thread.java:748) 引起: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) 在javax.faces.event.SystemEvent.processListener(未知来源) at com.sun.faces.application.ApplicationImpl.processListeners(Unknown Source) at com.sun.faces.application.ApplicationImpl.invokeListenersFor(Unknown Source) at com.sun.faces.application.ApplicationImpl.publishEvent(Unknown Source) at com.sun.faces.config.ConfigManager.publishPostConfigEvent(Unknown Source) ......还有14个
答案 0 :(得分:3)
您似乎在项目中包含了导致问题的不同版本的JSF。我可以在你的依赖项中看到javax.faces-2.3.2以及jsf-api-2.2.9 / jsf-impl-2.2.9。方法addSearchKeywordResolver in javax.faces.application.Application被调用但无法找到(正如堆栈跟踪告诉你的那样)。这种方法只是 JSF 2.3的一部分。但是似乎使用了JSF 2.2类。该方法由PrimeFaces调用,因为PrimeFaces认为您使用的是JSF 2.3,因为类javax.faces.component.UIImportConstants可以在类路径中找到(在javax.faces-2.3.2依赖项中)。我认为解决方案只包括一个JSF版本的依赖。