我将它包含在我的 index.jsp JSF 文件中:
<%@ taglib prefix="ui" uri="http://java.sun.com/jsf/facelets"%>
和 Eclipse 下划线的 URL,悬停给出了这个:
Cannot find the tag library descriptor for "http://java.sun.com/jsf/facelets"
使用 Tomcat 插件部署并尝试启动 Tomcat 6 会导致:
|STDOUT| 2010-03-03 17:57:29,872 | INFO | [main]: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
|STDOUT| 2010-03-03 17:57:29,904 | INFO | [main]: ServletContext 'C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\myapp\' initialized.
|STDOUT| 2010-03-03 17:57:29,904 | INFO | [main]: Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
03-Mar-2010 17:57:29 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
03-Mar-2010 17:57:29 org.apache.catalina.core.StandardContext start
SEVERE: Context [/myapp] startup failed due to previous errors
...
03-Mar-2010 17:57:30 com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804)
我的 web.xml 包含这个
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
我的 face-config.xml 包含这个
<application>
<!-- tell JSF to use Facelets -->
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
我的应用程序构建具有最新的 JSF 2.0.2 jsf-api.jar 和 jsf-impl.jar。我还有 MyFaces 1.2.8 和所有最新的公共 jar。该应用程序构建良好,直到我升级 JSF。我至少预计会出现运行时错误,但这里 Eclipse 看不到 taglib。我还能错过什么?
编辑
有关完整信息 - 我取出 Mojarra 并留在 Myfaces。这意味着我需要从我的web.xml
:
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
并将其替换为 myfaces 的等效项:
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
谢谢