Shi Jinghai created OFBIZ-9483:
----------------------------------
Summary: Enable EL in OFBiz
Key: OFBIZ-9483
URL: https://issues.apache.org/jira/browse/OFBIZ-9483
Project: OFBiz
Issue Type: Improvement
Components: ALL COMPONENTS
Affects Versions: 16.11.02
Reporter: Shi Jinghai
Assignee: Shi Jinghai
Priority: Trivial
While deploying CAS and Drools-Workbench in OFBiz 16.11.02, the pages with EL
report error messages:
{code:java}
java.lang.NullPointerException
javax.el.CompositeELResolver.add(CompositeELResolver.java:117)
org.apache.jasper.el.JasperELResolver.add(JasperELResolver.java:70)
org.apache.jasper.el.JasperELResolver.<init>(JasperELResolver.java:58)
org.apache.jasper.runtime.JspApplicationContextImpl.createELResolver(JspApplicationContextImpl.java:120)
org.apache.jasper.runtime.JspApplicationContextImpl.createELContext(JspApplicationContextImpl.java:89)
org.apache.jasper.runtime.PageContextImpl.getELContext(PageContextImpl.java:949)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:934)
org.apache.jsp.WEB_002dINF.view.jsp.default_.ui.casGenericSuccessView_jsp._jspService(casGenericSuccessView_jsp.java:152)
{code}
According to the doc of javax.el.ExpressionFactorym
(http://docs.oracle.com/javaee/6/api/javax/el/ExpressionFactory.html):
{code:java}
Creates a new instance of a ExpressionFactory?. This method uses the following
ordered lookup procedure to determine the ExpressionFactory? implementation
class to load:
•Use the Services API (as detailed in the JAR specification). If a resource
with the name of META-INF/services/javax.el.ExpressionFactory? exists, then its
first line, if present, is used as the UTF-8 encoded name of the implementation
class.
•Use the properties file "lib/el.properties" in the JRE directory. If this file
exists and it is readable by the java.util.Properties.load(InputStream?)
method, and it contains an entry whose key is "javax.el.ExpressionFactory?",
then the value of that entry is used as the name of the implementation class.
•Use the javax.el.ExpressionFactory? system property. If a system property with
this name is defined, then its value is used as the name of the implementation
class.
•Use a platform default implementation.
{code}
I added an el.properties in ${jre_home}/lib/, the el.properties has one line:
{code:java}
javax.el.ExpressionFactory=org.apache.el.ExpressionFactoryImpl
{code}
Restarting OFBiz, the error messages are still there, so there is at least a
META-INF/services/javax.el.ExpressionFactory in runtime jars. It comes to
'de.odysseus.juel:juel-spi:2.2.7', unzip it, it only contains a
javax.el.ExpressionFactory file with de.odysseus.el.ExpressionFactoryImpl.
Remove runtime 'de.odysseus.juel:juel-spi:2.2.7' and restart OFBiz, the error
messages are still there. Unzip 'de.odysseus.juel:juel-impl:2.2.7', an
OSGI-INF/services.xml found:
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
<scr:component name="de.odysseus.el.ExpressionFactoryImpl">
<implementation class="de.odysseus.el.ExpressionFactoryImpl"/>
<service>
<provide interface="javax.el.ExpressionFactory"/>
</service>
</scr:component>
</root>
{code}
It's easy to get it defines javax.el.ExpressionFactory implemented by
de.odysseus.el.ExpressionFactoryImpl. Unzip it and create a new jar with
command:
{code:java}
jar cf juel-impl-no-osgi-2.2.7.jar de/ META-INF/
{code}
Put the juel-impl-no-osgi-2.2.7.jar under ${ofbiz.home}/lib/, change the
build.gradle:
{code:java}
// compile 'de.odysseus.juel:juel-impl:2.2.7'
compile files('./lib/juel-impl-no-osgi-2.2.7.jar')
{code}
Restart OFBiz, both OFBiz pages and EL pages are ok now.
Stop OFBiz, remove ${jre_home}/lib/el.properties, start OFBiz, EL pages fail.
Obviously, this fail is caused by no javax.el.ExpressionFactory defined. Add a
META-INF/javax.el.ExpressionFactory with one line content of
org.apache.el.ExpressionFactoryImpl in juel-impl-no-osgi-2.2.7.jar.
Restart OFBiz, all OFBiz and EL pages are right.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)