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

发布于 2024-08-23 07:00:01 字数 2478 浏览 8 评论 0原文

我将其包含在我的 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 和所有最新的 commons 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>

谢谢

I included this in my index.jsp JSF file:

<%@ taglib prefix="ui" uri="http://java.sun.com/jsf/facelets"%>

and Eclipse underlines the URL, hovering gives this:

Cannot find the tag library descriptor for "http://java.sun.com/jsf/facelets"

Deploying and trying to start Tomcat 6 using the Tomcat plugin causes this:

|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)

My web.xml contains this

<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

My face-config.xml contains this

    <application>
    <!-- tell JSF to use Facelets -->
    <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>

And my application build has the latest JSF 2.0.2 jsf-api.jar and jsf-impl.jar. I've also got MyFaces 1.2.8 and all the latest commons jars. The app was building fine til I upgraded JSF. I would at least expect a run time error but here Eclipse cannot see the taglib. What else could I be missing?

EDIT

For full information - I took out Mojarra and left in Myfaces. This meant I needed to remove this from my web.xml:

<listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener> 

and replace it with the equivalent for myfaces:

<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酷遇一生 2024-08-30 07:00:01

不要将 JSF 2.0 与 JSF 2.0 之前版本混合。它可能会导致意想不到的结果(如上面的结果)。

选择 JSF 2.0 实现(看起来是 mojarra)并删除所有 myfaces 和 Facelets 库。

Do not mix JSF 2.0 with JSF pre-2.0. It may lead to unexpected results (like the one above).

Choose a JSF 2.0 implementation (mojarra as it seems) and remove all myfaces and facelets libraries.

花开浅夏 2024-08-30 07:00:01

嗯,这很烦人。我在几个地方读到新的 Mojarra 发布了嵌入式 Facelets。我将 jsf-facelets-1.1.14.jar 添加到我的构建中,并且部署正常。

Well that's annoying. I read in a couple of places that the new Mojarra release embedded facelets. I added jsf-facelets-1.1.14.jar to my build and it deployed ok.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文