首页 文章

JSF 2.2 webapp适用于本地计算机,但不适用于服务器

提问于
浏览
0

我正在尝试使用jsf 2.2创建一个Web应用程序 . 我的申请正在使用 JERSEY Restful, jre 1.8, JSF 2.2, Primefaces.

它在我的本地机器上完全正常,但在AWS(EC2- Tomcat by bitnami-free tier)上我收到错误(底部的错误日志 . )

Thank you so much for your help in Advance.

我正在使用以下库

enter image description here

这是我的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>

Error Log 208-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 )org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)atg.apache.catalina.util.LifecycleBase . 在Org.apache上的org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)的org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)中启动(LifecycleBase.java:150) org.apache.catalina.startup.HostConf上的.catalina.core.StandardHost.addChild(StandardHost.java:734) ig.deployWAR(HostConfig.java:986)atg.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)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java) :624)at 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)位于com的javax.faces.event.SystemEvent.processListener(未知来源)的org.primefaces.webapp.PostConstructApplicationEventListener.processEvent(PostConstructApplicationEventListener.java:48) . com.sun.faces.application.ApplicationIm中的sun.faces.application.ApplicationImpl.processListeners(未知来源)来自com.sun.faces.application.ApplicationImpl.publishEvent(未知来源)的pl.invokeListenersFor(未知来源)com.sun.faces.config.ConfigManager.publishPostConfigEvent(未知来源)... 14更多信息

201-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)位于org.apache.catalina.util.LifecycleBase.start的org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) (LifecycleBase.java:150)位于org.apache的org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) . catalina.core.StandardHost.addChild(StandardHost.java:734)at org.apache.catalina.startup.HostConfig.deployWA R(HostConfig.java:986)atg.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)at 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)at javax.faces.event.SystemEvent.processListener(Unknown Source)at atcom.sun.faces.application.ApplicationImpl.processListeners(未知来源)位于com.sun.faces.application.ApplicationImpl.publishEvent(未知来源)的com.sun.faces.application.ApplicationImpl.invokeListenersFor(未知来源) . sun.faces.config.ConfigManager.publishPostConfigEvent(未知来源)......还有14个

201-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) org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)位于org.apache.catalina.util.LifecycleBase.start的org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) (LifecycleBase.java:150)位于org.apache的org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) . catalina.core.StandardHost.addChild(StandardHost.java:734)at org.apache.catalina.startup.HostConfig.deployWA R(HostConfig.java:986)atg.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)at 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 . 位于com.sun的javax.faces.event.SystemEvent.processListener(未知来源)的org.primefaces.webapp.PostConstructApplicationEventListener.processEvent(PostConstructApplicationEventListener.java:48)中的primefaces.util.Jsf23Helper.addSearchKeywordResolvers(Jsf23Helper.java:27) . com.sun.faces.application.ApplicationImpl.invokeLi中的faces.application.ApplicationImpl.processListeners(未知来源)来自com.sun.faces.application.ApplicationImpl.publishEvent(未知来源)的stenersFor(未知来源)com.sun.faces.config.ConfigManager.publishPostConfigEvent(未知来源)... 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)位于org.apache.catalina.util.LifecycleBase.start的org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) (LifecycleBase.java:150)位于org.apache的org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) . catalina.core.StandardHost.addChild(StandardHost.java:734)at org.apache.catalina.startup.HostConfig.deployWA R(HostConfig.java:986)atg.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)at 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 . 位于com.sun的javax.faces.event.SystemEvent.processListener(未知来源)的org.primefaces.webapp.PostConstructApplicationEventListener.processEvent(PostConstructApplicationEventListener.java:48)中的primefaces.util.Jsf23Helper.addSearchKeywordResolvers(Jsf23Helper.java:27) . faces.application.ApplicationImpl.processListeners(未知来源)atcom.sun.faces.application.App中的com.sun.faces.application.ApplicationImpl.publishEvent(未知来源)的com.sun.faces.application.ApplicationImpl.invokeListenersFor(未知来源).ConfigManager.publishPostConfigEvent(未知来源)...还有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)位于org.apache.catalina.util.LifecycleBase.start的org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) (LifecycleBase.java:150)位于org.apache的org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) . catalina.core.StandardHost.addChild(StandardHost.java:734)at org.apache.catalina.startup.HostConfig.deployWA R(HostConfig.java:986)atg.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)at 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 . 位于com.sun的javax.faces.event.SystemEvent.processListener(未知来源)的org.primefaces.webapp.PostConstructApplicationEventListener.processEvent(PostConstructApplicationEventListener.java:48)中的primefaces.util.Jsf23Helper.addSearchKeywordResolvers(Jsf23Helper.java:27) . com.sun.faces.application.ApplicationImpl.invokeLi中的faces.application.ApplicationImpl.processListeners(未知来源)来自com.sun.faces.application.ApplicationImpl.publishEvent(未知来源)的stenersFor(未知来源)com.sun.faces.config.ConfigManager.publishPostConfigEvent(未知来源)... 14更多信息

1 回答

  • 3

    您似乎在项目中包含了导致问题的不同版本的JSF . 我可以在你的依赖项中看到javax.faces-2.3.2以及jsf-api-2.2.9 / jsf-impl-2.2.9 . 调用javax.faces.application.Application中的方法addSearchKeywordResolver并且找不到(如堆栈跟踪告诉你的那样) . 此方法只是JSF 2.3的一部分 . 但是似乎使用了JSF 2.2类 . 该方法由PrimeFaces调用,因为PrimeFaces认为您使用的是JSF 2.3,因为类javax.faces.component.UIImportConstants可以在类路径中找到(在javax.faces-2.3.2依赖项中) . 我认为解决方案只包括一个JSF版本的依赖项 .

相关问题