I have Weblogic 10.3.5 installed. I deployed a WAR with JSF 2.0 and JSTL 1.2 on the server. But I need EL 2.2 functionality as well. What JARs do I need? It'd be great if someone can point me to a step-by-step guide from scratch as I've been trying to set this up for hours with no luck.
问题:
回答1:
Easiest is to drop jboss-el.jar, which is an EL 2.1 compatible implementation offering the same features as EL 2.2, in /WEB-INF/lib
and tell the JSF implementation to use that EL implementation instead. How to do that depends on the JSF implementation being used. In case of Mojarra, you need to add the following context parameter to the web.xml
:
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
And in case of MyFaces, it's the following context parameter:
<context-param>
<param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
See also:
- Invoke direct methods or methods with arguments / variables / parameters in EL
回答2:
I feel that the accepted answer may or may not work for every situation, and of course the hook is that you will be stuck to a single JBoss release of EL without any of the support of continuing bug fixes in future patch releases of a proper 2.2 implementation.
Ultimately here is what worked for me on a WebLogic 10.3.6 server.
I downloaded the EL 2.2 API and Implementation jars from Glassfish and included those in the WEB-INF/lib
folder of my web application.
el-api-2.2.jar
el-impl-2.2.0-SNAPSHOT.jar
After doing this you would normally need to add a context parameter to web.xml
to signify the class to load for the new EL implementation like in BalusC's answer. Weblogic doesn't seem to care about this however, its classloader has its own way of things. You need to specify in your weblogic.xml
to give preferential class loading to the EL classes in WEB-INF/lib
. This will allow your Glassfish implementation to be loaded in place of the older EL implementation bundled with WebLogic.
<container-descriptor>
<prefer-application-packages>
<package-name>com.sun.el.*</package-name>
<package-name>javax.el.*</package-name>
</prefer-application-packages>
</container-descriptor>
回答3:
I got to reanimate the question as i found out that the jboss implementation of el 2.2 has a permgenspace memory leak upon redeploying. I tried several other implementations available, namely
- juel 2.2.1
- tomcat-jasper-el 7.0.35
but got none running. Using the 2.2 glassfish implementation didn't work either (even with prefer-web-inf-classes, or prefer-application-package), cause of classloading problems.
I'd appreciate any suggestions which implementation is up to date and works with weblogic without changes in the server classpath.