gpt4 book ai didi

java - App Engine 上的 JSF 2 错误 "Unable to instantiate ExpressionFactory"

转载 作者:行者123 更新时间:2023-11-30 05:02:24 28 4
gpt4 key购买 nike

对于在 NetBeans 6.9.1 中创建的新 JSF 2.0 应用程序,此错误消息会在生产服务器上启动时出现在日志文件中:

com.sun.faces.config.ConfigureListener contextInitialized: Initializing Mojarra 2.0.2 (FCS b10) for context ''

com.sun.faces.spi.InjectionProviderFactory createInstance: JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.

> com.sun.faces.config.ConfigureListener installExpressionFactory: Unable to instantiate ExpressionFactory 'com.sun.el.ExpressionFactoryImpl'

Failed startup of context com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@7616ad{/,/base/data/home/apps/scroogedemo/1.350894485313261302} com.sun.faces.config.ConfigurationException: It appears the JSP version of the container is older than 2.1 and unable to locate the EL RI expression factory, com.sun.el.ExpressionFactoryImpl. If not using JSP or the EL RI, make sure the context initialization parameter, com.sun.faces.expressionFactory, is properly set. at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:638)

该应用程序使用 NetBeans 提供的 JSF 2.0 引用实现,其中似乎包含 EL RI(包 javax.faces.el)。

应用程序在开发服务器中运行良好。我在 web.xml 中使用这些配置条目:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
...
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.enableThreading</param-name>
<param-value>false</param-value>
</context-param>

我检查了页面https://sites.google.com/a/wildstartech.com/adventures-in-java/Java-Platform-Enterprise-Edition/JavaServer-Faces/sun-javaserver-faces-reference-implementation/configuring-jsf-20-to-run-on-the-google-appengine/javaserverfaces-20-and-google-app-engine-compatibility-issues有关此错误的信息,但此处未涵盖此问题。

更新:上面提到的页面说项目中需要包含el-api和el-impl文件。它们不在 NetBeans 库列表中,因此尚未在服务器部署过程中上传。我猜它们是由本地开发服务器提供的 - 但在生产 GAE 上缺失。事实证明这是解决方案,请参见下文。

最佳答案

使用 el-api-2.2.jar 和 el-impl-2.2.jar 部署应用程序解决了问题。

关于java - App Engine 上的 JSF 2 错误 "Unable to instantiate ExpressionFactory",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6236268/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com