如何在Oracle Weblogic 12.1中部署JSF 2.1 webapp? [英] How to deploy a JSF 2.1 webapp in Oracle Weblogic 12.1?

查看:852
本文介绍了如何在Oracle Weblogic 12.1中部署JSF 2.1 webapp?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将JSF 2.1 Web应用程序部署到Weblogic 12.1应用程序服务器,但部署失败并出现以下异常

I am trying to deploy a JSF 2.1 webapplication to a Weblogic 12.1 application server, but the deployment fails with the following exception

<javax.enterprise.resource.webcontainer.jsf.config> <BEA-000000> 
<Critical error during deployment:
 com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! 
    com.oracle.injection.integration.jsf.WeblogicFacesConfigResourceProvider
                     cannot be cast to com.sun.faces.spi.ConfigurationResourceProvider
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:377)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:223)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:582)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    Truncated. see log file for complete stacktrace

我使用的是Mojarra实现版本2.1.13 - 这里是相应的 pom.xml 条目:

I am using the Mojarra implementation Version 2.1.13 - here is the corresponding pom.xml entry:

<dependency>
  <groupId>com.sun.faces</groupId>
  <artifactId>jsf-api</artifactId> 
  <version>2.1.13</version>
</dependency>
<dependency>
  <groupId>com.sun.faces</groupId>
  <artifactId>jsf-impl</artifactId>
  <version>2.1.13</version>
</dependency>

我将以下行添加到 weblogic.xml 防止weblogic服务器加载附带的jsf实现:

I added the following lines to the weblogic.xml to prevent the weblogic server from loading the shipped jsf implementation:

<container-descriptor>
    <prefer-web-inf-classes>false</prefer-web-inf-classes>
    <prefer-application-packages>
        <package-name>javax.faces.*</package-name>
        <package-name>com.sun.faces.*</package-name>
        <package-name>com.bea.faces.*</package-name>
    </prefer-application-packages>

    <prefer-application-resources>
        <resource-name>javax.faces.*</resource-name>
        <resource-name>com.sun.faces.*</resource-name>
        <resource-name>com.bea.faces.*</resource-name>
        <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
    </prefer-application-resources>
</container-descriptor>

WeblogicFacesConfigResourceProvider 包含在 weblogic.jar

那么这里出了什么问题? - 任何提示?

So what's going wrong here? - Any hints?

好的,我找到了解决方案:您必须将 META-INF / services / com.sun.faces.spi.FacesConfigResourceProvider 添加到 prefer-application-resources < weblogic.xml 中的/ code> -section。这个配置对我有用:

false

javax.faces。
com.sun.faces。

com。 bea.faces。*

Okay, I found the solution: you have to add the META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider to the prefer-application-resources-section in the weblogic.xml. This configuration works for me: false javax.faces. com.sun.faces. com.bea.faces.*

    <prefer-application-resources>
        <resource-name>javax.faces.*</resource-name>
        <resource-name>com.sun.faces.*</resource-name>
        <resource-name>com.bea.faces.*</resource-name>
        <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
        <resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</resource-name>
    </prefer-application-resources>
</container-descriptor>


推荐答案

添加提到的解决方案oehmiche 在他的问题中作为答案。

Adding the solution mentioned by oehmiche in his question as an answer.

将META-INF / services / com.sun.faces.spi.FacesConfigResourceProvider添加到首选项中weblogic.xml中的-application-resources-section。这个配置适用于我:false javax.faces。 com.sun.faces。 com.bea.faces。*

Add the META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider to the prefer-application-resources-section in the weblogic.xml. This configuration works for me: false javax.faces. com.sun.faces. com.bea.faces.*

<prefer-application-resources>
    <resource-name>javax.faces.*</resource-name>
    <resource-name>com.sun.faces.*</resource-name>
    <resource-name>com.bea.faces.*</resource-name>
    <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
    <resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</resource-name>
</prefer-application-resources>

这篇关于如何在Oracle Weblogic 12.1中部署JSF 2.1 webapp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆