Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 6.0.4 GA
-
Component/s: API > JavaScript
-
Labels:None
-
Environment:Liferay 6.0.4 bundled with Glassfish
-
Similar Issues:
Description
In the class JspFactoryWrapper there is the line:
JspFactory.setDefaultFactory(_jspFactoryWrapper);
Due to this the jspFactory is changed for all of the webapp withing the same JVM (if the JSP is in the same classloader for all of them which is normal)
In jsp-impl 2.2.1 there is the following function when an el expression is evaluated:
private static ExpressionFactory getExpressionFactory(
PageContext pageContext)
On this there is a ClassCastException because the PageContext is not the implementation of the jsp-impl but the implementation of liferay: com.liferay.portal.kernel.servlet.PageContextWrapper
To reproduce:
- Download cas-server war and depoy it
- Visit any of the servlet of cas, for example /login
The following exception will occur:
[#|2010-07-28T14:49:49.634+0200|WARNING|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=42;_ThreadName=Thread-1;|org.apache.catalina.core.StandardHostValve@12d44f8d: Exception Processing ErrorPage[errorCode=500, location=/WEB-INF/view/jsp/errors.jsp]
org.apache.jasper.JasperException: java.lang.ClassCastException: com.liferay.portal.kernel.servlet.PageContextWrapper cannot be cast to org.apache.jasper.runtime.PageContextImpl
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:483)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:373)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:802)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:664)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:499)
at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:468)
at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:364)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:475)
at org.apache.catalina.core.StandardHostValve.dispatchToErrorPage(StandardHostValve.java:669)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:364)
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:329)
at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:241)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:334)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:229)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:334)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:814)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:743)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:936)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:682)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: com.liferay.portal.kernel.servlet.PageContextWrapper cannot be cast to org.apache.jasper.runtime.PageContextImpl
at org.apache.jasper.runtime.PageContextImpl.getExpressionFactory(PageContextImpl.java:952)
at org.apache.jasper.runtime.PageContextImpl.evaluateExpression(PageContextImpl.java:1002)
at org.apache.jsp.WEB_002dINF.view.jsp.errors_jsp._jspx_meth_c_when_0(errors_jsp.java from :212)
at org.apache.jsp.WEB_002dINF.view.jsp.errors_jsp._jspx_meth_c_choose_0(errors_jsp.java from :183)
at org.apache.jsp.WEB_002dINF.view.jsp.errors_jsp._jspService(errors_jsp.java from :91)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:406)
... 23 more
I am not sure if it is a good idea to set the static property of JspFactory to the liferay implementation because it is set appserver wide. If it is set, somehow it should be found out if the request is within a Liferay portlet and if not the original jspfactory impl functions should be used without any change in the behavior (using the original jsp-impl pagecontext).
Issue Links
- relates
-
LPS-12022
ServerDetector returns true for isTomcat even in Glassfish and other app servers
-

Liferay 6.0.3 also fails with Glassfish. It seems that (JSP) Expression Language cannot be used in Liferay with Glassfish. For me it makes it impossible to use Liferay on Glassfish