可以在WebLogic 12c上使用MyFaces + CDI吗? [英] Can MyFaces + CDI be used on WebLogic 12c?

查看:166
本文介绍了可以在WebLogic 12c上使用MyFaces + CDI吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试使该设置运行了几天,但仍然没有运气.这是我一直在使用的测试应用程序:

I've been trying to get this setup running for a couple of days now but still no luck. Here's the test application i've been using:

@Named
@RequestScoped
public class Test {

    private String test = "test";
    public String getTest() { return test; }
    public void setTest(String test) { this.test = test; }
}

在jsf页面中:

<h:outputText value="#{test.test}"/>

在没有MyFaces的情况下运行此示例可以很好地工作(可以像应试的那样进行测试"),但是当我在WAR文件中部署MyFaces并在weblogic.xml中进行必要的配置时,CDI似乎停止工作(或者至少是集成) (在JSF和CDI之间),并且输出html中什么也不显示.不过,MyFaces本身似乎还可以.

Running this sample without MyFaces works fine (renders "test" like it should), but when i deploy MyFaces in the WAR file and do the necessary configuration within weblogic.xml CDI seems to stop working (or at least, the integration bewteen JSF and CDI) and nothing is displayed in the output html. MyFaces itself seems to be ok, though.

我的基本配置如下:

  • WebLogic Server 12c(12.1.1.0),补丁程序应该是最新的,因为我昨天刚刚下载了一个开发版本,以确保
  • MyFaces-2.1.10,部署在WEB-INF/libs中
  • 已安装Beans.xml
  • org.apache.myfaces.webapp.StartupServletContextListener已在web.xml中注册
  • 将WebLogic配置为使用weblogic.xml使用MyFaces

Weblogic.xml内容:

Weblogic.xml contents:

<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>
    <resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</resource-name>
</prefer-application-resources>

到目前为止,我学到了什么:

What i've learned so far:

  • WL12c作为其CDI实现配备了Weld 1.1.3.
  • 我读过某处(不记得在哪里),每当您决定切换JSF实现时,您都要负责自己集成JSF/CDI.这是真的吗(肯定没有希望)?

到目前为止我已经尝试过的事情:

Things i've tried so far:

  • 将MyFaces CODI添加到混合物中,希望它将以某种方式将Weld和MyFaces粘合在一起,但事实并非如此.
  • 将OpenWebBeans的Weld替换为CDI实现.这似乎起初是可行的,但后来在某些内部sun.reflection包中提供了各种有趣的ClassCastExceptions.无论如何,这是我宁愿避免的解决方案.
  • 使用web.xml和faces-config.xml中的各种选项来手动触发焊接.这似乎使Weld陷入了困境,因为它淹没了各种错误消息的日志.在某种程度上,可以通过将weblogic升级到较新的Weld版本来修复"这些错误,但是每次执行此操作时,都会遇到下一个错误.再说一次,我宁愿也不要走这条路线.

在保持CDI支持的同时在WL12c上使用MyFaces真的很难吗?或者我只是错过了显而易见的东西?感谢您的帮助.

Is it really that hard to use MyFaces on WL12c while preserving CDI support or am i just missing the obvious ? Thanks for any help.

推荐答案

恐怕没有办法.焊接胶代码必须存在.那些微小的集成层是wls可部署jsf库的一部分,不适用于myfaces ....

I'm afraid there is no way to do it. The weld glue code needs to be there. Those tiny little integration layer that is part of the wls deployable libraries for jsf isn't available for myfaces ....

这篇关于可以在WebLogic 12c上使用MyFaces + CDI吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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