Friday, October 18, 2013

Icefaces dateTimeEntry component issue with Chrome Browser

Icefaces calendar component that is having issues when used inside a datatable which is rendered inside another datatable.
May be you come across some javascript error and upon typing some entry in date field and onblur the entry is wiped off.
else you might come across the following script error:

Uncaught TypeError: Cannot call method 'init' of undefined
(anonymous function)
runScripts
doUpdate
response
onComplete
AjaxEngine.req.xmlReq.onreadystatechange

The solution to this issue is copy the following code into your web.xml file and run, surprisingly you don't see this script error.

<context-param>
     <param-name>org.icefaces.mandatoryResourceConfiguration</param-name>
     <param-value>dateTimeEntry</param-value>
</context-param>

Wednesday, October 9, 2013

java.lang.LinkageError loader constraint violation ELResover

java.lang.LinkageError due to constraint violation loader will prevent the server startup and will throw Exception sending context destroyed event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener and says "SEVERE: Error listenerStart"

In detail you might see following error in your console:

Oct 8, 2013 11:24:36 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Oct 8, 2013 11:24:36 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/ACTS] startup failed due to previous errors
Oct 8, 2013 11:24:36 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Oct 8, 2013 11:24:36 AM org.apache.catalina.core.ApplicationContext log
INFO: Shutting down log4j
Oct 8, 2013 11:24:36 AM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/catalina/loader/WebappClassLoader) previously initiated loading for a different type with name "javax/el/ExpressionFactory"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider.destroyInstance(NoInjectionAnnotationLifecycleProvider.java:94)
at org.apache.myfaces.webapp.AbstractMyFacesListener.doPreDestroy(AbstractMyFacesListener.java:61)
at org.apache.myfaces.webapp.StartupServletContextListener.doPredestroy(StartupServletContextListener.java:213)
at org.apache.myfaces.webapp.StartupServletContextListener.contextDestroyed(StartupServletContextListener.java:190)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3882)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4523)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4387)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Oct 8, 2013 11:24:37 AM org.apache.coyote.http11.Http11Protocol start

This error is mainly due to the ELResolver has multiple interfaces and hence the conflict.

If your using eclipse, try to search for ELResolver class by using Open Type (Ctrl + Shift + t) and check those are declared in your POM file with scope "provided"
Mostly if you see any jar file having ELResolver which is not used in any POM file, remove them or try hard refresh your project

Hope that solves the problem.

If you find any other ways to solve the problem, please post in the comments, so atleast that helps others.