This is a minimalistic web application to illustrate a problem with Java 17 I asked for help on stackoverflow. It uses the following application stack:
- JDK 17
- JakartaEE8
- JSF 2.3
- Weld 3.1
When deployed to Wildfly 26.1.1.Final, an access to index.xhtml leads to the following stacktrace:
10:14:17,651 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-1) Error Rendering View[/index.xhtml]: javax.el.ELException: /index.xhtml @23,74 value="raw offset=#{myWarBean.defaultTZ.rawOffset}": java.lang.IllegalAccessException: class javax.el.BeanELResolver cannot access class sun.util.calendar.ZoneInfo (in module java.base) because module java.base does not export sun.util.calendar to unnamed module @72b47abc
at [email protected]//com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:77)
at [email protected]//javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at [email protected]//javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:181)
at [email protected]//javax.faces.component.UIOutput.getValue(UIOutput.java:140)
at [email protected]//com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:198)
at [email protected]//com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:328)
at [email protected]//com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:143)
at [email protected]//javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:600)
at [email protected]//com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:286)
at [email protected]//com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:90)
at [email protected]//javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:571)
at [email protected]//javax.faces.component.UIComponent.encodeAll(UIComponent.java:1648)
at [email protected]//javax.faces.component.UIComponent.encodeAll(UIComponent.java:1651)
at [email protected]//javax.faces.component.UIComponent.encodeAll(UIComponent.java:1651)
at [email protected]//com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:461)
at [email protected]//com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:170)
at [email protected]//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at [email protected]//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at [email protected]//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at deployment.my-war-1.0-SNAPSHOT.war//org.omnifaces.viewhandler.OmniViewHandler.renderView(OmniViewHandler.java:151)
at [email protected]//com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
at [email protected]//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
at [email protected]//com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
at [email protected]//javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)
at [email protected]//javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
at [email protected]//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at [email protected]//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at io.opentracing.contrib.opentracing-jaxrs2//io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:52)
at [email protected]//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at [email protected]//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at [email protected]//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at [email protected]//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at [email protected]//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at [email protected]//io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at [email protected]//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
at [email protected]//io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:275)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
at [email protected]//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at [email protected]//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1544)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
at [email protected]//io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)
at [email protected]//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:852)
at [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at [email protected]//org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: javax.el.ELException: java.lang.IllegalAccessException: class javax.el.BeanELResolver cannot access class sun.util.calendar.ZoneInfo (in module java.base) because module java.base does not export sun.util.calendar to unnamed module @72b47abc
at [email protected]//javax.el.BeanELResolver.getValue(BeanELResolver.java:193)
at [email protected]//com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:156)
at [email protected]//com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:184)
at [email protected]//com.sun.el.parser.AstValue.getValue(AstValue.java:114)
at [email protected]//com.sun.el.parser.AstValue.getValue(AstValue.java:177)
at [email protected]//com.sun.el.parser.AstDeferredExpression.getValue(AstDeferredExpression.java:39)
at [email protected]//com.sun.el.parser.AstCompositeExpression.getValue(AstCompositeExpression.java:44)
at [email protected]//com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
at [email protected]//org.jboss.weld.module.web.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at [email protected]//org.jboss.weld.module.web.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at [email protected]//com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
... 57 more
Caused by: java.lang.IllegalAccessException: class javax.el.BeanELResolver cannot access class sun.util.calendar.ZoneInfo (in module java.base) because module java.base does not export sun.util.calendar to unnamed module @72b47abc
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
at java.base/java.lang.reflect.Method.invoke(Method.java:560)
at [email protected]//javax.el.BeanELResolver.getValue(BeanELResolver.java:186)
... 67 more
To build the application simply run
mvn package
You will then find a WAR in the target
directory which you can copy to
wildfly's deploy directory:
cp target/my-war-1.0-SNAPSHOT.war ${WILDFLY_HOME}/standalone/deployments/
Once deployed to Wildfly, you can access the application by pointing your browser to
http://localhost:8080//my-war-1.0-SNAPSHOT/
This is an issue in the EL specification, which was reported by BalusC right after my question was published.
A workaround suggested as an
answer on StackOverflow
is to provide a Getter for the rawOffset
attribute
public int getDefaultTZrawOffset() {
return getDefaultTZ().getRawOffset();
}
and use this in the EL:
#{myWarBean.defaultTZrawOffset}