WebSphere 7, JSF 2.0 and classloaders

跟風遠走 提交于 2019-12-24 06:03:30

问题


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.

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

"org.apache.myfaces.webapp.StartupServletContextListener" getting loaded at startup from the base_v7/plugins/org.apache.myfaces1_2.jar

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

"com/ibm/ws/classloader/CompoundClassLoader@116a116a" previously initiated loading for a different type with name "javax/el/ExpressionFactory" defined by loader "org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader@2a502a50"

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


回答1:


Got it..

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

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




回答2:


I had got the same type error in Spring MVC. I just removed jsp-api-2.1.jar from WEB-INF/lib and it's working for me. You can get more information from

http://forum.springsource.org/showthread.php?73991-Getting-Linkage-error-while-trying-to-show-the-error-set-in-controller

I do not know JSF. I just share my problem that I had faced.



来源:https://stackoverflow.com/questions/3214373/websphere-7-jsf-2-0-and-classloaders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!