0

llegal to register an ELResolver in WebLogic [closed]

asked 2009-11-16 03:07:34 +0800

scerro gravatar image scerro
273 3 9
www.desarrolloagil.es

Hi there,

I have a web app deployed in Tomcat 5.27 and It works ok. I have moved the same web app to weblogic 10 and I get the following error in the console:

It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.

When I removed the internationalization expressions (title="${c:l('register.formname')}") It works OK, but I dont understand what happend with these expressions in WebLogic, doesnt it works with Weblogic? or Shall I change anything in web.xml or zk.xml?

thanks

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by dennis
close date 2013-01-24 02:43:21

13 Replies

Sort by ยป oldest newest

answered 2011-08-02 04:03:40 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

Samu,
Could you test this listener in your project?

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);
		}
	}
}


you need to replace the listener in web.xml from 'org.zkoss.jsp.spec.JspFactoryContextListener' to test.JspFactoryContextListener also.

link publish delete flag offensive edit

answered 2009-11-19 21:50:18 +0800

iantsai gravatar image iantsai
2755 1

could you provide the full stack trace?
because it's hard to identify which part cause this error.
And a piece of source code to reproduce this problem would be very helpful.

link publish delete flag offensive edit

answered 2010-10-15 18:03:16 +0800

ct1 gravatar image ct1
6

updated 2010-10-15 18:06:08 +0800

Need Help. I ran into the same problem. It works on Tomcat but not weblogic 10.3. Did anymore figure this out ?

link publish delete flag offensive edit

answered 2010-10-18 23:39:20 +0800

iantsai gravatar image iantsai
2755 1

could you tell us which version of ZK that you are using? and if that possible please provide us the full error stack trace message to let us can analysis this issue.

In current version of ZK, we repackaged Apache EL and merged it as a default EL module for ZK, so theoretically your problem shouldn't happen.

link publish delete flag offensive edit

answered 2010-10-21 15:24:28 +0800

ct1 gravatar image ct1
6

OK, I isolated the error to the ZK JSP listener.

<listener>
<description>ZK JSP Tags environment initiation </description>
<display-name>ZK JSP Initiator</display-name>
<listener-class>org.zkoss.jsp.spec.JspFactoryContextListener</listener-class>
</listener>

I also tried to deploy the zk-JspTags-demo-1.4.1 on weblogic 10.3 and accessed foreach.jsp, I got the same stacktrace below.



org.zkoss.zk.ui.UiException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.zkoss.lang.Classes.newInstance(Classes.java:76)
at org.zkoss.lang.Exceptions.wrap(Exceptions.java:162)
at org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:44)
at org.zkoss.jsp.zul.impl.RootTag$MyRichlet.service(RootTag.java:313)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:398)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:287)
at org.zkoss.jsp.zul.impl.RootTag.doTag(RootTag.java:273)
at jsp_servlet.__foreach._jspService(__foreach.java:129)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:638)
at org.zkoss.jsp.zul.impl.RootTag$MyRichlet.service(RootTag.java:306)
... 23 more
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at org.zkoss.jsp.zul.impl.LeafTag.doCatch(LeafTag.java:139)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:128)
at jsp_servlet.__foreach$JspFragmentHelper.invoke0(__foreach.java:187)
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:596)
... 24 more
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:638)
at org.zkoss.jsp.zul.impl.BranchTag.doComponentContent(BranchTag.java:64)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:124)
... 26 more
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at org.zkoss.jsp.zul.impl.LeafTag.doCatch(LeafTag.java:139)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:128)
at jsp_servlet.__foreach$JspFragmentHelper.invoke1(__foreach.java:208)
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:599)
... 28 more
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:638)
at org.zkoss.jsp.zul.impl.BranchTag.doComponentContent(BranchTag.java:64)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:124)
... 30 more
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at org.zkoss.jsp.zul.impl.LeafTag.doCatch(LeafTag.java:139)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:128)
at jsp_servlet.__foreach$JspFragmentHelper.invoke2(__foreach.java:242)
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:602)
... 32 more
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:638)
at org.zkoss.jsp.zul.impl.BranchTag.doComponentContent(BranchTag.java:64)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:124)
... 34 more
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at org.zkoss.jsp.zul.impl.LeafTag.doCatch(LeafTag.java:139)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:128)
at jsp_servlet.__foreach$JspFragmentHelper.invoke4(__foreach.java:301)
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:608)
... 36 more
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:638)
at org.zkoss.jsp.zul.impl.BranchTag.doComponentContent(BranchTag.java:64)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:124)
... 38 more
Caused by: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at org.zkoss.jsp.zul.impl.LeafTag.doCatch(LeafTag.java:139)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:128)
at jsp_servlet.__foreach$JspFragmentHelper.invoke5(__foreach.java:340)
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:611)
... 40 more
Caused by: javax.servlet.jsp.JspException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:638)
at org.zkoss.jsp.zul.impl.BranchTag.doComponentContent(BranchTag.java:64)
at org.zkoss.jsp.zul.impl.LeafTag.doTag(LeafTag.java:124)
... 42 more
Caused by: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at weblogic.servlet.jsp.JspApplicationContextImpl.addELResolver(JspApplicationContextImpl.java:55)
at org.zkoss.jsp.spec.v21.JspFactoryImpl.getJspApplicationContext(JspFactoryImpl.java:70)
at weblogic.servlet.jsp.PageContextImpl.getJspApplicationContextImpl(PageContextImpl.java:507)
at weblogic.servlet.jsp.PageContextImpl.getELContext(PageContextImpl.java:498)
at weblogic.servlet.jsp.ELHelper.createValueExpression(ELHelper.java:51)
at weblogic.servlet.jsp.ELHelper.evaluate(ELHelper.java:30)
at jsp_servlet.__foreach$JspFragmentHelper.invoke6(__foreach.java:370)
at jsp_servlet.__foreach$JspFragmentHelper.invoke(__foreach.java:614)
... 44 more

link publish delete flag offensive edit

answered 2010-10-21 21:15:32 +0800

iantsai gravatar image iantsai
2755 1

Okay, I think this one is a zk JSP's bug.

If you don't need to use "ZK EL Context" in your JSP, please remove this listener setting from web.xml.

I'll take a look if there's anyway to fix this.

link publish delete flag offensive edit

answered 2011-04-19 11:55:41 +0800

nj gravatar image nj
3

Did we find a fix for this ?

link publish delete flag offensive edit

answered 2011-04-28 21:03:23 +0800

iantsai gravatar image iantsai
2755 1

This issue had been fixed while using JSP 2.1.

link publish delete flag offensive edit

answered 2011-08-01 03:26:01 +0800

Samu gravatar image Samu
39 2

I found same issue.

JSP 2.1
Oracle Web logic 10.3

org.zkoss.lang.SystemException: java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at org.zkoss.jsp.spec.JspFactoryContextListener.requestInitialized(JspFactoryContextListener.java:60)
at weblogic.servlet.internal.EventsManager.notifyRequestLifetimeEvent(EventsManager.java:322)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
Truncated. see log file for complete stacktrace
java.lang.IllegalStateException: It is illegal to register an ELResolver after all ServletContextListeners have had their contextInitialized methods invoked.
at weblogic.servlet.jsp.JspApplicationContextImpl.addELResolver(JspApplicationContextImpl.java:55)
at org.zkoss.jsp.spec.v21.ZkELInitiatorImpl.init(ZkELInitiatorImpl.java:41)
at org.zkoss.jsp.spec.JspFactoryContextListener.requestInitialized(JspFactoryContextListener.java:55)
at weblogic.servlet.internal.EventsManager.notifyRequestLifetimeEvent(EventsManager.java:322)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:25)
Truncated. see log file for complete stacktrace
>

How to fix it ?

link publish delete flag offensive edit

answered 2011-08-01 15:28:49 +0800

iantsai gravatar image iantsai
2755 1

hi, Samu
which version of ZKJSP that you are using?

link publish delete flag offensive edit

Question tools

Follow

RSS

Stats

Asked: 2009-11-16 03:07:34 +0800

Seen: 1,479 times

Last updated: Jan 23 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More