Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#7812 Java 17 - compatibility #7811

Merged
merged 6 commits into from Sep 27, 2021
Merged

Conversation

christophs78
Copy link
Contributor

No description provided.

@christophs78 christophs78 changed the title CI - Java 17 instead of Java 16 #7812 Java 17 - compatibilty Sep 12, 2021
@melloware melloware linked an issue Sep 12, 2021 that may be closed by this pull request
3 tasks
@melloware
Copy link
Member

I haven't looked at what is failing but did JDK 17 actually remove those things that used to be warnings about IllegalReflective activities?

@christophs78
Copy link
Contributor Author

christophs78 commented Sep 12, 2021

Yep. Maybe it´s a issue with OpenEJB comming with TomEE. To some degree it look´s like OpenEJB is dead. Had to replace this with Weld for JakartaEE-branch of Primefaces-test.
And maybe we should move our integrationtests from TomEE to Jetty to be more flexible and to be on a plattform which is better maintained. (@tandraschko - any thoughts about this?)

java.lang.InternalError: 
LocalBeanProxyFactory.createProxy: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @2064d52f
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
	at org.apache.openejb.util.proxy.LocalBeanProxyFactory$Unsafe.getClassLoaderDefineClassMethod(LocalBeanProxyFactory.java:845)
	at org.apache.openejb.util.proxy.LocalBeanProxyFactory$Unsafe.defineClass(LocalBeanProxyFactory.java:828)
	at org.apache.openejb.util.proxy.LocalBeanProxyFactory.createProxy(LocalBeanProxyFactory.java:142)
	at org.apache.openejb.util.proxy.LocalBeanProxyFactory.createProxy(LocalBeanProxyFactory.java:152)
	at org.apache.tomee.catalina.TomcatWebAppBuilder.eagerInitOfLocalBeanProxies(TomcatWebAppBuilder.java:1598)
	at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1344)
	at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1160)
	at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
	at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWar(TomcatWebAppBuilder.java:687)
	at org.apache.tomee.catalina.TomcatWebAppBuilder.deployWebApps(TomcatWebAppBuilder.java:616)
	at org.apache.tomee.catalina.deployment.TomcatWebappDeployer.deploy(TomcatWebappDeployer.java:47)
	at org.apache.tomee.embedded.Container.deploy(Container.java:883)
	at org.primefaces.integrationtests.PrimeFacesSeleniumTomEEAdapter.startup(PrimeFacesSeleniumTomEEAdapter.java:70)
	at org.primefaces.selenium.internal.junit.BootstrapExtension.beforeAll(BootstrapExtension.java:42)
	at ...

@melloware
Copy link
Member

Do we need to run with --illegal-access=permit since in JDK17 that have officially turned off reflective access? I have read some places it is removed entirely in JDK17 so we may not be able to make it work. Other places say add --illegal-access=permit but not sure. I would think we would have the same problem with JDK16.

@melloware
Copy link
Member

Here is a good article explaining it all! https://www.infoq.com/news/2021/06/internals-encapsulated-jdk17/

@melloware
Copy link
Member

Looks like we need to use --add-opens java.base/java.lang=ALL-UNNAMED should fix this above error.

@melloware
Copy link
Member

OK this is tricky if I add to the pom.xml the compiler args thta we need.

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <compilerArgs>
                        <arg>--add-modules</arg>
                        <arg>ALL-SYSTEM</arg>
                        <arg>--add-opens</arg>
                        <arg>java.base/jdk.internal.util=ALL-UNNAMED</arg>
                        <arg>--add-opens</arg>
                        <arg>java.base/java.lang=ALL-UNNAMED</arg>
                    </compilerArgs>
                    <argLine>
                            --add-modules ALL-SYSTEM
                            --add-opens java.base/jdk.internal.util=ALL-UNNAMED
                            --add-opens java.base/java.lang=ALL-UNNAMED
                    </argLine>
                </configuration>
                ```

It fails on JDK8 saying "add-open" is not a valid JDK8 option.  So not sure how we are going to make this work for JDK17 unless we add a Compiler plugin in a profile that activates only on JDK17.  Which we probably have to do.

@tandraschko
Copy link
Member

in general i thought java17 would break much more as SecurityManager has been removed? maybe the methods are still there but otherwise it would even compile

@melloware
Copy link
Member

You are right I think there is going to be much more involved to make JDK17 work and possibly need updates from libraries etc.

@melloware
Copy link
Member

Well I got it compiling with this profile. But not sure about it running in a container yet

<profile>
            <id>java17</id>
            <activation>
                <jdk>17</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.8.1</version>
                        <configuration>
                            <source>11</source>
                            <target>11</target>
                            <encoding>${project.build.sourceEncoding}</encoding>
                            <compilerArgs>
                                <arg>--add-modules</arg>
                                <arg>ALL-SYSTEM</arg>
                                <arg>--add-opens</arg>
                                <arg>java.base/jdk.internal.util=ALL-UNNAMED</arg>
                            </compilerArgs>
                            <argLine>
                            --add-modules ALL-SYSTEM
                            --add-opens java.base/jdk.internal.util=ALL-UNNAMED
                            </argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        ```

@christophs78
Copy link
Contributor Author

I'll try https://www.codejava.net/servers/tomcat/how-to-embed-tomcat-server-into-java-web-applications later. Together with adding CDI, MyFaces/Mojarra,... via Maven-Dependency.

@christophs78
Copy link
Contributor Author

christophs78 commented Sep 13, 2021

Made some progress, but currently stuck to this one:

java.lang.ClassCastException: class org.primefaces.selenium.internal.PrimefacesSeleniumPhaseListener cannot be cast to class javax.faces.event.PhaseListener (org.primefaces.selenium.internal.PrimefacesSeleniumPhaseListener is in unnamed module of loader 'app'; javax.faces.event.PhaseListener is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @4910f85f)
	at com.sun.faces.config.processor.LifecycleConfigProcessor.addPhaseListeners(LifecycleConfigProcessor.java:124)
	at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:96)
	at com.sun.faces.config.ConfigManager.lambda$initialize$0(ConfigManager.java:295)
	at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
	at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:293)
	at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:207)

Some idea´s WTF is going on there? (Did already some debugging, but without success.)

(With Mojarra. MyFaces has some other issues, i did not analyze yet.)

@christophs78
Copy link
Contributor Author

Made significant progress.
Most of our integrationtests are up and running on base Tomcat plus necessary libraries. On Java 8, 11, 16 and 17.
Need to look why some test´s are failing on Github.

This way we should be flexible to test whatever combination we wan´t / need to test. In theory we should be able to test with MyFaces-next too.

There are still some rough edges to work on. But for now happy to reached this point.

@tandraschko
Copy link
Member

do we really need to support both weld and owb?

for me its ok to have a plain tomcat but we may need to add multiple libs in the future like bval, jpa and so on
therfore tomee is smarter of course

we may even wait for the next tomee release, which will support java17

@christophs78
Copy link
Contributor Author

TomEE even does not have a final Jakarta EE 9 release. They have some milestone-release for Jakarta EE 9. But no TomEE embedded yet. From my feeling TomEE makes less progress.

Personally i come from the Spring (Boot)-side of things and like the approach of having a simple container and adding the thing you need on your own. (Way more agile compared to what we did with Websphere Traditional before.)

@tandraschko
Copy link
Member

yeah but they have in theory
the problem is that TomEE8 is javax and they shade a TomEE9
thats all not perfect, same like e.g. in PF or OWB

@tandraschko
Copy link
Member

many impls decided in the apache world to just shade a release for EE9 as the API is completely the same
this will change for EE10 anyway, just a big work
so all PF maintainers are invited to help :P

@christophs78
Copy link
Contributor Author

Overall javax to jakarta is IMO a sad story. Too much work and not enough resources. And overall too much people which say JavaEE / JakartaEE is dying and other negativ things.

@tandraschko
Copy link
Member

tandraschko commented Sep 14, 2021

true
but in general the import APIs currently gets improved
just some low resources on the IMPL side on some specs (like OpenJPA)
it think it will get better when EE10 is released

@christophs78
Copy link
Contributor Author

Hope so. People need to get some faith into Jakarta EE and it´s future. (Not so easy after years of stagnation.)

@christophs78
Copy link
Contributor Author

All (integration-)tests´s green. On Java 8, 11, 16 and 17. :-)
Think we can say PrimeFaces works with Java 17.

I have to do some cleanup-work later to get this PR into "production-quality".

@GedMarc
Copy link
Contributor

GedMarc commented Sep 15, 2021

OOOO you can now seal off your shaded packages!

RestEasy doesn't support modularization at all, the SPI jar is external to the operations and it throws invalid module definition (the class file has to be in the same jar that calls the serviceloader)
how did you get that running in JDK (anything 11 and over)

Are you using modules? or are the test cases purely still in classpath mode?
When we say JDK 11 compatible, are we including modules as a base requirement of that?

@GedMarc
Copy link
Contributor

GedMarc commented Sep 15, 2021

@melloware let's try not open up the system or allow illegal access during compilation - is there any reason why that was necessary??
ASM to 9.2 should sort that out

My default build config looks to work without any opening of illegal access

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${jdk.release}</source>
                    <target>${jdk.release}</target>
                    <release>${jdk.release}</release>
                    <compilerArgs>
                        <compilerArg>--enable-preview</compilerArg>
                    </compilerArgs>
                    <failOnError>true</failOnError>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm</artifactId>
                        <version>9.2</version>
                    </dependency>
                </dependencies>
            </plugin>

@christophs78
Copy link
Contributor Author

Maybe different expectations?
This PR let´s our integrationtests run on Java 17 (JRE). But we still compile with Java 8 - target.
Think our integrationtests are still purely in classpath mode.

@GedMarc
Copy link
Contributor

GedMarc commented Sep 15, 2021

Ok thanks!
I create modular shades (https://github.com/GedMarc/GuicedEE-Services/tree/master/primefaces / https://github.com/GedMarc/GuicedEE-Services/tree/master/primefaces-extensions) and pulling in the latest full of breaks,

Doesn't even compile in JDK 11 now cause of RestEasy now in the default set of dependencies and everything is in the modular compiler -

Will make the changes necessary on my end, understandable for JDK 8 compatibility not just using the straight JDK for the rest calls

Siiiiiigggghhhhh :) Thanks @christophs78

@christophs78
Copy link
Contributor Author

christophs78 commented Sep 15, 2021

Do you know some JAX-RS-impl we may use instead of RestEasy which is compatible with Java 11+ and modules?

@GedMarc
Copy link
Contributor

GedMarc commented Sep 15, 2021

I've been hard pressed to find one for a long time, truth is, I doubt we will ever see/need one

It's not necessary with the JDK java.net updates, it's quicker to write it in raw Java than it is to add a dependency to the POM file

The rest libraries are definitely only for JDK 8 and below, no point in making one for JDK 11 and up, hence, no worries - i can sort it out on my end, also gives a good base for when EE10 comes out on a modular front, EE9 was nothing short of an abortion for this

@christophs78 christophs78 changed the title #7812 Java 17 - compatibilty #7812 Java 17 - compatibility Sep 15, 2021
@christophs78 christophs78 marked this pull request as ready for review September 15, 2021 18:47
@tandraschko
Copy link
Member

same for properties like resteasy.version
it just blows up the pom and you manually change it once in a year max

@melloware
Copy link
Member

OK no problem. Just a warning though you may get multiple dependabot PR's one for each project for things likee Jetty etc.

@christophs78
Copy link
Contributor Author

OWB (instead of Weld) for Integration Tests causes this one:

[WARNING] Failed startup of context o.e.j.m.p.JettyWebAppContext@7543fe74{primefaces-integration-tests,/integrationtests,[file:///C:/Users/chris/IdeaProjects/primefaces/primefaces-integration-tests/src/main/webapp/, jar:file:///C:/Users/chris/.m2/repository/org/primefaces/primefaces-selenium-runtime/11.0.0-SNAPSHOT/primefaces-selenium-runtime-11.0.0-SNAPSHOT.jar!/META-INF/resources, jar:file:///C:/Users/chris/.m2/repository/org/glassfish/jakarta.faces/2.3.16/jakarta.faces-2.3.16.jar!/META-INF/resources, jar:file:///C:/Users/chris/.m2/repository/org/primefaces/primefaces/11.0.0-SNAPSHOT/primefaces-11.0.0-SNAPSHOT.jar!/META-INF/resources],UNAVAILABLE}{file:///C:/Users/chris/IdeaProjects/primefaces/primefaces-integration-tests/src/main/webapp/}
org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.AmbiguousResolutionException: There is more than one Bean with type com.sun.faces.push.WebsocketUserManager Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  socketUsers, Bean Owner : [WebsocketPushContextProducer, WebBeansType:MANAGED, Name:null, API Types:[java.lang.Object,com.sun.faces.cdi.WebsocketPushContextProducer], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
found beans: 
WebsocketUserManager, WebBeansType:MANAGED, Name:null, API Types:[com.sun.faces.push.WebsocketUserManager,java.lang.Object], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any] from jar:file:/C:/Users/chris/.m2/repository/org/glassfish/jakarta.faces/2.3.16/jakarta.faces-2.3.16.jar!/com/sun/faces/push/WebsocketUserManager.class
WebsocketUserManager, WebBeansType:MANAGED, Name:null, API Types:[com.sun.faces.push.WebsocketUserManager,java.lang.Object], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any] from jar:file:/C:/Users/chris/.m2/repository/org/glassfish/jakarta.faces/2.3.16/jakarta.faces-2.3.16.jar!/com/sun/faces/push/WebsocketUserManager.class

(Via Jetty-Plugin, similar with Tomcat-embedded. Same like a few days ago when i tried it the first time. )

Maybe i should try one more time in a few more days. Or someone some idea´s?

@tandraschko: You prefer OWB over Weld because it´s an Apache - project? So switchting Showcase to Weld is not an option?

@melloware
Copy link
Member

melloware commented Sep 21, 2021

That OWB error I think I solved in PrimeFaces test with an openwebbeans.properties file.

You could try org.apache.webbeans.scanBeansXmlOnly=false or org.apache.webbeans.scanBeansXmlOnly=true to see if it helps.

@tandraschko
Copy link
Member

i prefer OWB for the same reason i prefer MyFaces (perf, footprint, stricter spec compatibility, apache, ...)

@christophs78
Copy link
Contributor Author

christophs78 commented Sep 21, 2021

org.apache.webbeans.scanBeansXmlOnly

Helps with Jetty-Maven-plugin but not with embedded Tomcat.

Maybe part of the complicated "truth" is 'org.apache.webbeans.scanExclusionPaths':
https://github.com/apache/openwebbeans/blob/e348f45b8ab3ef825c73dca8a01bb00a0d68e1ad/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans.properties#L189
This explicit excludes myfaces-api, myfaces-impl and mojarra.
But not jakarta.faces-.
Maybe no one updated this after mojarra was renamed to jakarta-faces-...

/jsr305-, \
/guice-, \
/jsoup-, \
/jakarta.faces-
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a hack which makes OWB working together with Mojarra (Jakarta Faces) and Tomcat embedded.
Holy ....

@tandraschko
Copy link
Member

tandraschko commented Sep 21, 2021

actually the scan exclusions is JUST for faster startup as they are known JARs which doesnt require scanning
more about it here: https://issues.apache.org/jira/browse/OWB-1298

i will talk with romain again, how we can make it work and either create a issue on mojarra or OWB side

@christophs78
Copy link
Contributor Author

christophs78 commented Sep 21, 2021

Thanks Thomas for talking with Romain again!
(We know there are good guys in the whole eco-system. On the other side there are devs consuming our eco-system with less frustration tolerance than ourselves expecting this things to just work.)

Probably one last thing to fix for Mojarra + OWB:

First 13 tests pro testclass work, afterwards they break:
image
image

Do we need to increase some limit, or set .... ?

Sep 21, 2021 10:45:15 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
SCHWERWIEGEND: Error Rendering View[/datatable/dataTable001Dynamic.xhtml]
javax.el.ELException: /datatable/dataTable001Dynamic.xhtml @28,182 value="#{dataTable001Dynamic.columns}": Error reading [columns] on type [org.primefaces.integrationtests.datatable.DataTable001Dynamic$$OwbNormalScopeProxy0]
	at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:77)
	at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:179)
	at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:166)
	at javax.faces.component.UIData.getValue(UIData.java:736)
	at org.primefaces.component.api.UIData.getDataModel(UIData.java:610)
	at org.primefaces.component.api.UIData.setRowModel(UIData.java:401)
	at org.primefaces.component.api.UIData.setRowIndexWithoutRowStatePreserved(UIData.java:394)
	at org.primefaces.component.api.UIData.setRowIndex(UIData.java:454)
	at org.primefaces.component.api.ColumnAware.lambda$resetDynamicColumns$6(ColumnAware.java:332)
	at org.primefaces.component.api.ColumnAware.forEachColumn(ColumnAware.java:82)
	at org.primefaces.component.api.ColumnAware.forEachColumn(ColumnAware.java:56)
	at org.primefaces.component.api.ColumnAware.resetDynamicColumns(ColumnAware.java:330)
	at org.primefaces.component.datatable.DataTable.preEncode(DataTable.java:979)
	at org.primefaces.component.api.UIData.encodeBegin(UIData.java:1251)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1644)
	at javax.faces.render.Renderer.encodeChildren(Renderer.java:152)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:566)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1647)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:468)
	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:170)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
	at javax.faces.lifecycle.LifecycleWrapper.render(LifecycleWrapper.java:88)
	at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:89)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.el.ELException: Error reading [columns] on type [org.primefaces.integrationtests.datatable.DataTable001Dynamic$$OwbNormalScopeProxy0]
	at javax.el.BeanELResolver.getValue(BeanELResolver.java:89)
	at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:156)
	at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:184)
	at org.apache.el.parser.AstValue.getValue(AstValue.java:168)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
	at org.apache.webbeans.el22.WrappedValueExpression.getValue(WrappedValueExpression.java:68)
	at org.apache.webbeans.el22.WrappedValueExpression.getValue(WrappedValueExpression.java:68)
	at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
	... 53 more
Caused by: java.lang.NullPointerException
	at com.sun.faces.application.view.ViewScopeContextManager.destroyBeans(ViewScopeContextManager.java:169)
	at com.sun.faces.application.view.ViewScopeContextManager.clear(ViewScopeContextManager.java:120)
	at com.sun.faces.application.view.ViewScopeManager.removeEldestViewMap(ViewScopeManager.java:420)
	at com.sun.faces.application.view.ViewScopeManager.processPostConstructViewMap(ViewScopeManager.java:317)
	at com.sun.faces.application.view.ViewScopeManager.processEvent(ViewScopeManager.java:263)
	at com.sun.faces.application.view.ViewScopeEventListener.processEvent(ViewScopeEventListener.java:45)
	at javax.faces.event.SystemEvent.processListener(SystemEvent.java:123)
	at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:110)
	at com.sun.faces.application.applicationimpl.Events.processListeners(Events.java:253)
	at com.sun.faces.application.applicationimpl.Events.invokeListenersFor(Events.java:231)
	at com.sun.faces.application.applicationimpl.Events.publishEvent(Events.java:112)
	at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:127)
	at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
	at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
	at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1680)
	at com.sun.faces.application.view.ViewScopeContextManager.createBean(ViewScopeContextManager.java:146)
	at com.sun.faces.application.view.ViewScopeContext.get(ViewScopeContext.java:114)
	at org.apache.webbeans.context.CustomPassivatingContextImpl.get(CustomPassivatingContextImpl.java:46)
	at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:101)
	at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.get(NormalScopedBeanInterceptorHandler.java:71)
	at org.primefaces.integrationtests.datatable.DataTable001Dynamic$$OwbNormalScopeProxy0.getColumns(org/primefaces/integrationtests/datatable/DataTable001Dynamic.java)
	at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at javax.el.BeanELResolver.getValue(BeanELResolver.java:85)
	... 60 more

@tandraschko
Copy link
Member

Can you explain what causes that error?

@christophs78
Copy link
Contributor Author

Can you explain what causes that error?

Hm. ViewScopeManager#processPostConstructViewMap detects there are too many views in (Mojarra) ACTIVE_VIEW_MAPS. So it decides to remove the eldest.
Then ViewScopeContextManager#destroyBeans fails with NPE because beanManager is null.

Caused by: java.lang.NullPointerException
	at com.sun.faces.application.view.ViewScopeContextManager.destroyBeans(ViewScopeContextManager.java:169)
	at com.sun.faces.application.view.ViewScopeContextManager.clear(ViewScopeContextManager.java:120)
	at com.sun.faces.application.view.ViewScopeManager.removeEldestViewMap(ViewScopeManager.java:420)
	at com.sun.faces.application.view.ViewScopeManager.processPostConstructViewMap(ViewScopeManager.java:317)
	at com.sun.faces.application.view.ViewScopeManager.processEvent(ViewScopeManager.java:263)

Hm. An initialization-order issue?

I currently work around with a HttpSessionListener which sets
event.getSession().setAttribute( "com.sun.faces.application.view.activeViewMapsSize", 100);
on sessionCreated.

@christophs78
Copy link
Contributor Author

Yeah.

Mojarra has some special treatment for Weld, but non for OWB.
https://github.com/eclipse-ee4j/mojarra/blob/98189bea9d485c8bf459718eae1e127b063c4fad/impl/src/main/java/com/sun/faces/util/Util.java#L1582

Better to go to bed before i write (more) bad things.

@tandraschko
Copy link
Member

Yeah, thats: eclipse-ee4j/mojarra#4642

Maybe you can create a PR at mojarra side for the most recent branches

@christophs78
Copy link
Contributor Author

Yes, i will do this later this week. MyFaces does this aspect better. I will try do port this good aspects to Mojarra.

@tandraschko
Copy link
Member

The first issue about the scanning exclusions is probably really something that OWB doesnt follow the spec in every detail. I will discuss it and try to fix.
If we commited it, we can probably do a realease soon.

Would be great if you can create the PR about the Mojarra issue, to use CDI.current as fallback.

@tandraschko
Copy link
Member

@christophs78 can you set org.apache.webbeans.scanExtensionJars=false instead of the exclude list? this must work and enforces spec compatiblity for this case
also OWB will exclude jakarta.faces per default in the next release, so we also dont need that property anymore and OWB+Mojarra works OOTB

@christophs78
Copy link
Contributor Author

@christophs78 can you set org.apache.webbeans.scanExtensionJars=false instead of the exclude list? this must work and enforces spec compatiblity for this case
also OWB will exclude jakarta.faces per default in the next release, so we also dont need that property anymore and OWB+Mojarra works OOTB

Due to some reasons i don´t understand (yet) org.apache.webbeans.scanExtensionJars=false does not work in this usecase. It did not work on my dev-machine and same with Github Actions.

@tandraschko
Copy link
Member

weird but ok
the next release will fix it anyway

christophs78 referenced this pull request Sep 24, 2021
fix Mojarra + OWB (fix typo)

fix Mojarra + OWB

OWB instead of Weld

ConfirmPopup001Test - GuardAjax

Jetty-plugin up and running

Jetty-plugin up and running

Cleanup test vs compile/runtime - scope and Jetty-Maven-Plugin WIP

modify deployment to Tomcat - unused import

modify deployment to Tomcat

fix maven-scope for MyFaces-next

src/main vs src/test; back; something is weird with classpath

cleanup src/main vs src/test

org.apache.myfaces.USE_LAMBDA_METAFACTORY=false

removed one dependency too much

MyFaces Next, cleanup

cleanup

remove Java17 - profile

REST(easy)

Hibernate Validator + Rollback copy WAR to tempdir

copy WAR to tempdir

kind of working on MyFacess too?

kind of working on Mojarra?

Tomcat instead of TomEE - WIP - not working yet and cleanup needed afterwards

JDK17 profile

JDK17 Profile

Reverted

Attempt --add-open fix

broken with Java 17-ea, what´s our state with Java 16?

run integrationtests also on Java 17

run integrationtests also on Java 17

CI - Java 17 instead of Java 16

CI - Java 17 instead of Java 16

CI - Java 17 instead of Java 16

CI - Java 17 instead of Java 16

CI - Java 17 instead of Java 16
@christophs78
Copy link
Contributor Author

Squashed and rebased onto master.
Selenium auto-driver-download works fine one my windows-dev-notebook. Good work!

@tandraschko tandraschko merged commit 49c8117 into primefaces:master Sep 27, 2021
@christophs78 christophs78 deleted the Java17 branch October 30, 2021 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java 17 - compatibilty
4 participants