On Saturday, December 5, 2020 12:38:54 AM CET Cris Rockwell wrote:
> Thanks Oliver.

Hi Cris,

> Helps a lot. At least when using the latest sling-bundle-parent, the project
> builds with Java 8.  Unfortunately, neither
> sling-org-apache-sling-servlets-annotations nor
> sling-org-apache-sling-junit-core [0] build with Java 11 [1] on my
> localhost or in by the CI.

Before we look into the details again, can you merge the IT module into the 
main module and clean up? For me it looks like you don't need the 
PaxExamServer rule at all.

Have a look at Scripting FreeMarker¹ and use it as a blueprint.

Regards,
O.

[1] https://github.com/apache/sling-org-apache-sling-scripting-freemarker


> sling-org-apache-sling-junit-core... it/annotations-it bundle has this
> error…
> 
> [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> 4.509 s <<< FAILURE! - in org.apache.sling.junit.annotations.ReferenceIT
> [ERROR] org.apache.sling.junit.annotations.ReferenceIT  Time elapsed: 4.499
> s  <<< ERROR! org.ops4j.pax.exam.TestContainerException:
> org.osgi.framework.BundleException: Could not create bundle object. at
> org.ops4j.pax.exam.forked.ForkedTestContainer.start(ForkedTestContainer.jav
> a:168) at
> org.ops4j.pax.exam.junit.PaxExamServer.before(PaxExamServer.java:87) at
> org.apache.sling.junit.annotations.it@1.0.0/org.apache.sling.junit.annotati
> ons.ReferenceIT$1.before(ReferenceIT.java:61) at
> org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50) at
> org.junit.rules.RunRules.evaluate(RunRules.java:20)
>       at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
>       at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
>       at
> org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java
> :364) at
> org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Prov
> ider.java:272) at
> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provid
> er.java:237) at
> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:
> 158) at
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBoot
> er.java:428) at
> org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162
> ) at
> org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562) at
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)
> Caused by: org.osgi.framework.BundleException: Could not create bundle
> object. at org.apache.felix.framework.Felix.installBundle(Felix.java:3312)
> at
> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImp
> l.java:147) at
> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImp
> l.java:120) at
> org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.installBundle(RemoteFr
> ameworkImpl.java:132) at
> jdk.internal.reflect.GeneratedMethodAccessor8.invoke(Unknown Source) at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Delegati
> ngMethodAccessorImpl.java:43) at
> java.base/java.lang.reflect.Method.invoke(Method.java:566)
>       at
> java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359
> ) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) at
> java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) at
> java.base/java.security.AccessController.doPrivileged(Native Method) at
> java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at
> java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.jav
> a:562) at
> java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTrans
> port.java:796) at
> java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(
> TCPTransport.java:677) at
> java.base/java.security.AccessController.doPrivileged(Native Method) at
> java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransp
> ort.java:676) at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecu
> tor.java:1128) at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExec
> utor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
>       at
> java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Str
> eamRemoteCall.java:303) at
> java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.ja
> va:279) at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:164) at
> java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(R
> emoteObjectInvocationHandler.java:217) at
> java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectI
> nvocationHandler.java:162) at com.sun.proxy.$Proxy10.installBundle(Unknown
> Source)
>       at
> org.ops4j.pax.exam.forked.ForkedTestContainer.installAndStartBundles(Forked
> TestContainer.java:285) at
> org.ops4j.pax.exam.forked.ForkedTestContainer.start(ForkedTestContainer.jav
> a:165) ... 14 more
> Caused by: java.lang.UnsupportedOperationException: Unable to add extension
> bundle. at
> org.apache.felix.framework.ExtensionManager.addExtensionBundle(ExtensionMan
> ager.java:430) at
> org.apache.felix.framework.Felix.installBundle(Felix.java:3279) at
> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImp
> l.java:147) at
> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImp
> l.java:120) at
> org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.installBundle(RemoteFr
> ameworkImpl.java:132) at
> jdk.internal.reflect.GeneratedMethodAccessor8.invoke(Unknown Source) at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Delegati
> ngMethodAccessorImpl.java:43) at
> java.base/java.lang.reflect.Method.invoke(Method.java:566)
>       at
> java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359
> ) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) at
> java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) at
> java.base/java.security.AccessController.doPrivileged(Native Method) at
> java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at
> java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.jav
> a:562) at
> java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTrans
> port.java:796) at
> java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(
> TCPTransport.java:677) at
> java.base/java.security.AccessController.doPrivileged(Native Method) at
> java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransp
> ort.java:676) at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecu
> tor.java:1128) at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExec
> utor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
> 
> 
> sling-org-apache-sling-servlets-annotations appears to have the same
> problem. But it's CI is happy… I don’t think the CI for
> sling-org-apache-sling-servlets-annotations builds with Java 11 [2]?  So do
> you think building with Java 11 matters for
> sling-org-apache-sling-junit-core?
> 
> Thanks
> Cris
> 
> [0] https://github.com/apache/sling-org-apache-sling-junit-core/pull/5
> <https://github.com/apache/sling-org-apache-sling-junit-core/pull/5> [1]
> https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fs
> ling-org-apache-sling-junit-core/detail/SLING-9915-Support-for-SlingAnnotati
> onsTestRunner/10/pipeline/33
> <https://ci-builds.apache.org/blue/organizations/jenkins/Sling/modules/slin
> g-org-apache-sling-junit-core/detail/SLING-9915-Support-for-SlingAnnotations
> TestRunner/10/pipeline/33> [2]
> https://github.com/apache/sling-org-apache-sling-servlets-annotations/pull/
> 3
> <https://github.com/apache/sling-org-apache-sling-servlets-annotations/pull
> /3>
> > On Dec 4, 2020, at 4:06 PM, Oliver Lietz <apa...@oliverlietz.de> wrote:
> > 
> > On Friday, December 4, 2020 7:38:30 PM CET Cris Rockwell wrote:
> >> Thanks for the link to sample projects. I reviewed some of these but it
> >> seems to be mixed bag whether they build successfully for me with Java 11
> >> or not.
> > 
> > Don't get confused, there are some "heavyweight" tests which fail randomly
> > on Jenkins but run fine locally.
> > 
> >> I’m asking because of a PAX exam test bundle added to PR
> >> sling-org-apache-sling-junit-core [0] that works with Java 8 but will not
> >> build successfully with Java 11. I modeled this bundle after
> >> sling-org-apache-sling-servlets-annotations [1] which also seems to build
> >> with Java 8 but not with 11.
> >> 
> >> Maybe it’s fine that way since the pom.xml states…
> >> 
> >>            <sling.java.version>8</sling.java.version>
> >> 
> >> Another seemly odd aspect relates to the parent version, 33. Using parent
> >> version 35 or later, the build fails using Java 8 as well.  Resulting in
> >> the error
> > 
> > Make sure you use latest *sling-bundle-parent* (not *sling* which is for
> > plain JARs). See also my fixes in
> > https://github.com/apache/sling-org-apache-sling-servlets-annotations-it/
> > commit/65a06c2aaee54f4365745d9045f9604d03950b87 and my comments in
> > SLING-9929.
> > 
> > It works also with Testing PaxExam 3.1.0, no need to upgrade to 4.0.0-
> > SNAPSHOT. You can simply remove the org.apache.sling.testing.paxexam
> > bundle
> > from the base configuration as it returns a ModifiableCompositeOption.
> > 
> > https://github.com/apache/sling-org-apache-sling-testing-paxexam/blob/
> > org.apache.sling.testing.paxexam-3.1.0/src/main/java/org/apache/sling/test
> > ing/ paxexam/TestSupport.java#L83
> > 
> > Regards,
> > O.
> > 
> >> [INFO] -------------------------------------------------------
> >> [INFO]  T E S T S
> >> [INFO] -------------------------------------------------------
> >> [INFO] Running org.apache.sling.junit.annotations.ReferenceIT
> >> [main] INFO org.ops4j.pax.exam.spi.DefaultExamSystem - Pax Exam System
> >> (Version: 4.13.4) created. [main] INFO org.ops4j.pax.exam.ExamJavaRunner
> >> -
> >> ExamJavaRunner completed successfully
> >> 
> >> [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> >> 4.225 s <<< FAILURE! - in org.apache.sling.junit.annotations.ReferenceIT
> >> [ERROR] org.apache.sling.junit.annotations.ReferenceIT  Time elapsed:
> >> 4.218
> >> s  <<< ERROR! org.ops4j.pax.exam.TestContainerException:
> >> [file:/Users/cmrockwe/Documents/a3workspace/sling-org-apache-sling-junit-
> >> co
> >> re/src/it/annotations-it/target/org.apache.sling.junit.annotations.it-1.0
> >> .0. jar] is not a valid bundle (bundleSymbolicName and bundleName are
> >> null) at
> >> org.ops4j.pax.exam.forked.provision.PlatformImpl.validateBundle(Platform
> >> Imp l.java:290) at
> >> org.ops4j.pax.exam.forked.provision.PlatformImpl.download(PlatformImpl.ja
> >> va
> >> 
> >> :151)
> >> 
> >> Inspecting the bundle META-INF/MANIFEST.MF illustrates the problem. But
> >> not
> >> sure why the bundle is so incomplete...
> >> 
> >> Manifest-Version: 1.0
> >> Implementation-Title: Apache Sling Junit Server Annotations IT
> >> Implementation-Version: 1.0.0
> >> Specification-Vendor: The Apache Software Foundation
> >> Specification-Title: Apache Sling Junit Server Annotations IT
> >> Build-Jdk-Spec: 1.8
> >> Created-By: Maven Jar Plugin 3.2.0
> >> Specification-Version: 1.0
> >> Implementation-Vendor: The Apache Software Foundation
> >> 
> >> 
> >> [0] https://github.com/apache/sling-org-apache-sling-junit-core/pull/5
> >> [1]
> >> https://github.com/apache/sling-org-apache-sling-servlets-annotations/tre
> >> e/
> >> master/src/it/annotations-it
> >> 
> >>> On Dec 3, 2020, at 5:42 AM, Oliver Lietz <apa...@oliverlietz.de> wrote:
> >>> 
> >>> On Wednesday, December 2, 2020 11:45:28 PM CET Cris Rockwell wrote:
> >>>> Hi Sling Devs
> >>> 
> >>> Hi Cris,
> >>> 
> >>>> Can anyone advise whether it is possible to use sling-testing-paxexam
> >>>> [0]
> >>>> for projects based on Sling 12 Starter with Java11? Docs show how to
> >>>> configure a slingQuickstart [1] but I was not and to get it working
> >>>> with
> >>>> Java 11.
> >>> 
> >>> Sling Testing PaxExam is not using the Starter but the bundles and
> >>> configurations from Sling's Karaf Features.
> >>> 
> >>> See the list of modules which use it, they build with 8, 11 and 14:
> >>> 
> >>> https://github.com/apache/sling-org-apache-sling-testing-paxexam/network
> >>> /
> >>> dependents
> >>> 
> >>> HTH,
> >>> O.
> >>> 
> >>>> Thanks
> >>>> Cris
> >>>> 
> >>>> [0] https://github.com/apache/sling-org-apache-sling-testing-paxexam
> >>>> [1]
> >>>> https://sling.apache.org/documentation/development/testing-paxexam.html
> >>>> #3
> >>>> -c
> >>>> reate-a-test-class-and-provide-a-configuration




Reply via email to