Uploaded image for project: 'ZK JSP'
  1. ZK JSP
  2. ZKJSP-14

EL cannot work on Weblogic

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.4.0
    • 2.3.0
    • None

      This issue is reported from forum http://forum.zkoss.org/question/39137/llegal-to-register-an-elresolver-in-weblogic/

      Dennis has provided a sample implementation.

      package test;
      import javax.servlet.ServletContextEvent;
      import javax.servlet.ServletContextListener;
      import org.zkoss.lang.Classes;
      import org.zkoss.lang.SystemException;
      
      public class JspFactoryContextListener implements ServletContextListener {	
      
      	static volatile boolean hasInitiated = false;
      	public void contextDestroyed(ServletContextEvent event) {
      	}
      
      	public void contextInitialized(ServletContextEvent event) {
      		if (hasInitiated) return;
      		try {
      			Classes.forNameByThread("javax.servlet.jsp.JspApplicationContext");
      			Class initorClass =
      				Classes.forNameByThread("org.zkoss.jsp.spec.v21.ZkELInitiatorImpl");
      			ZkELInitiator initiator = (ZkELInitiator) initorClass.newInstance();
      			initiator.init(event.getServletContext());
      		} catch (ClassNotFoundException e) {
      			initJspFactory("org.zkoss.jsp.spec.v20.JspFactoryImpl");
      		} catch (Exception e) {
      			throw new SystemException(e);
      		}
      		hasInitiated = true;
      	}
      	private void initJspFactory(String facClassName) {
      		try {
      			Classes.forNameByThread(facClassName);
      		} catch (ClassNotFoundException e) {
      			throw new SystemException(e);
      		}
      	}
      }
      

      Related Issue happened in Portlet

      Reproducing Steps:

      1. deploy the attached HelloZulJsp.war to Apache Pluto (2.0.2). This WAR contains zkjsp 2.3 JAR that has this issue.
      2. create a page and add the portlet HelloZulJsp
      3. visit the portlet

      Expected:

      the portlet runs correctly.

      Actual:

      take a look at Pluto's log file, e.g. localhost.[yyyy-mm-dd].log

      when we run a portlet includes a JSP with zkjsp tag in a portal server like Pluto, it throws following exceptions:

      org.zkoss.lang.SystemException: java.lang.IllegalStateException: cannot call addELResolver after the first request has been made
           org.zkoss.jsp.spec.JspFactoryContextListener.requestInitialized(JspFactoryContextListener.java:59)
           org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
           org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
           org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           java.lang.Thread.run(Thread.java:662)
      root cause
      
      java.lang.IllegalStateException: cannot call addELResolver after the first request has been made
           org.apache.jasper.runtime.JspApplicationContextImpl.addELResolver(JspApplicationContextImpl.java:128)
           org.zkoss.jsp.spec.v21.ZkELInitiatorImpl.init(ZkELInitiatorImpl.java:41)
           org.zkoss.jsp.spec.JspFactoryContextListener.requestInitialized(JspFactoryContextListener.java:52)
           org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
           org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
           org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           java.lang.Thread.run(Thread.java:662)
      

            hawk hawk
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: