Eclipse / Tomcat 6无法识别Facelets选项卡库

时间:2010-03-03 18:04:55

标签: eclipse jsf facelets myfaces

我将它包含在我的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和所有最新的公共罐子。该应用程序正在建设,直到我升级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>

由于

2 个答案:

答案 0 :(得分:6)

不要将JSF 2.0与JSF pre-2.0混合使用。这可能会导致意想不到的结果(如上图所示)。

选择一个JSF 2.0实现(看起来像mojarra)并删除所有myfaces和facelets库。

答案 1 :(得分:1)

那太烦人了。我在几个地方读到新的Mojarra发布嵌入式facelets。我将jsf-facelets-1.1.14.jar添加到我的构建中并部署好了。