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

问题描述 投票:0回答:1

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

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

非常感谢你在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 26-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来自org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)的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。 org.apache.catalina.startup.HostConfi上的apache.catalina.core.StandardHost.addChild(StandardHost.java:734) g.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.ApplicationImp中的sun.faces.application.ApplicationImpl.processListeners(未知来源)来自com.sun.faces.application.ApplicationImpl.publishEvent(未知来源)的l.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。位于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更多信息

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)。 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 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更多信息

jsf amazon-ec2 primefaces jsf-2.2
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版本的依赖项。

© www.soinside.com 2019 - 2024. All rights reserved.