本文介绍了WebSphere 7,JSF 2.0和类加载器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WAS 7上,我部署了带有一个WAR的EAR. EAR类加载模式设置为PARENT_LAST,WAR类加载模式也设置为PARENT_LAST. WAR的/WEB-INF/lib具有Mojarra JSF 2 RI和Unified EL 2.1 jar.

On a WAS 7, I deployed my EAR with a single WAR in it. The EAR classloading mode is set to PARENT_LAST, and the WAR classloading mode is also set to PARENT_LAST. The WAR's /WEB-INF/lib has the Mojarra JSF 2 RI, and the Unified EL 2.1 jars.

尽管如此,当应用程序启动时,它会尝试从内置的MyFaces 1.2加载一些MyFaces内容. WAR类加载器的类加载器查看器清楚地显示

Despite all this, when the application starts, it tries to load some MyFaces stuff, from the inbuilt MyFaces 1.2. The class loader viewer for the WAR class loader clearly shows

男孩,这太疯狂了..许多其他东西也从其他地方被拾起,并造成了一大堆肮脏的类:

Boy, it's crazy.. Lots of other stuff gets picked up from elsewhere as well and creates a big dirty mess of classes:

您对这里可能出什么问题有任何想法吗?

Do you have any idea of what might be going wrong in here?

推荐答案

知道了.

首先,如果我们在web.xml中设置此上下文参数,则应用程序可以正常运行而不会在ExpressionFactory上发生类加载器冲突:

First, the application will work fine without the classloader conflict on the ExpressionFactory if we set this context-param in the web.xml:


    <context-param>
        <param-name>com.sun.faces.expressionFactory</param-name>
        <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
    </context-param>

( http://ocpsoft.com/java/jsf2-java/jsf2-how-to-add-the-magic-of-el-el2-to-jsf/)

对于MyFaces StartupServletContextListener来说.即使启动时加载它,我也不知道它是否有任何危害.至少直到现在我都没有注意到它存在任何问题.

And for the MyFaces StartupServletContextListener.. I don't know if it does any harm even if it gets loaded at startup.. at least I didn't notice any issue with it being there till now..

这篇关于WebSphere 7,JSF 2.0和类加载器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 19:56