java.lang.ClassNotFoundException: com.sun.el.lang.VariableMapperImpl [Fixed] for Glassfish JSF

By , 18 March 2012

java.lang.ClassNotFoundException: com.sun.el.lang.VariableMapperImpl [Fixed] for Glassfish JSF
java.lang.ClassNotFoundException: com.sun.el.lang.VariableMapperImpl [Fixed] for Glassfish JSF

Using Glassfish 3.1.2, JSF 2.1.x and Facelets with client side state saving, if you pass a bean reference by EL and try to dereference that expression you will get the following error:

Servlet.service() for servlet Faces Servlet threw exception
java.lang.ClassNotFoundException: com.sun.el.lang.VariableMapperImpl
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1509)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at com.sun.faces.renderkit.ApplicationObjectInputStream.resolveClass(ApplicationObjectInputStream.java:95)
	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)
	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
	at com.sun.el.MethodExpressionImpl.readExternal(MethodExpressionImpl.java:320)
	at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
	at com.sun.faces.facelets.el.TagMethodExpression.readExternal(TagMethodExpression.java:158)
	at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
	at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1666)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1322)
	at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1666)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1322)
	at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1666)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1322)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
	at java.util.HashMap.readObject(HashMap.java:1030)
	at sun.reflect.GeneratedMethodAccessor264.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
	at com.sun.faces.renderkit.ClientSideStateHelper.doGetState(ClientSideStateHelper.java:255)
	at com.sun.faces.renderkit.ClientSideStateHelper.getState(ClientSideStateHelper.java:198)
	at com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:100)
	at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:227)
	at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:188)
	at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:453)
	at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:148)
	at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:303)
	at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:303)
	at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

The workaround is to add el-ri.jar to your project. You can do it in maven like this:

    <dependency>
      <groupId>com.sun.el</groupId>
      <artifactId>el-ri</artifactId>
      <version>1.0</version>
      <scope>compile</scope>
    </dependency>

The problem is tracked by the JAVASERVERFACES-1828 bug.

java.lang.ClassNotFoundException: com.sun.el.lang.VariableMapperImpl [Fixed] for Glassfish JSF

About Roger Keays

java.lang.ClassNotFoundException: com.sun.el.lang.VariableMapperImpl [Fixed] for Glassfish JSF

I guess I'd call myself a problem solver. Either that, or I'm some sort of organic machine designed to convert oxygen into carbon dioxide. You could go either way on that. I'm into languages and stuff. I wrote a book. It's okay, I guess. What else? I like reading, swimming, eating, and playing music. Satisfied? Sheesh.

Leave a Comment

Please visit https://rogerkeays.com/java-lang-classnotfoundexception-com-sun-el-lang-variablemapperimpl-fixed-for-glassfish-jsf to add your comments.

Comment posted by: alvaro, 4 years ago

Good,  my error was fixed

thanks