ServiceLoader in Java takes System ClassLoader by default. On Mon, Sep 11, 2017 at 11:41 AM, Stephen Connolly < stephen.alan.conno...@gmail.com> wrote:
> https://github.com/apache/maven/commit/542a7a89156263b34d1472e9d9c1a2 > 795afccd2d > > If the JRE does not have a ScriptEngineFactory then the test cannot pass as > it relies on the assumption (invalid for Java 7) that there is always > a ScriptEngineFactory available. > > You can use this small class to check your JRE for ScriptEngineFactory > implementations: > > import java.util.ServiceLoader; > > import javax.script.ScriptEngineFactory; > > public class ProbeScriptEngineFactory { > public static void main(String[] args) { > ServiceLoader<ScriptEngineFactory> sef = ServiceLoader.load( > ScriptEngineFactory.class ); > System.out.println("Boot classloader"); > System.out.println("================"); > System.out.println(); > for (ScriptEngineFactory f: sef) { > System.out.println(f.getClass().getName()); > } > System.out.println(); > sef = ServiceLoader.load( ScriptEngineFactory.class, > ProbeScriptEngineFactory.class.getClassLoader() ); > System.out.println("Main classloader"); > System.out.println("================"); > System.out.println(); > for (ScriptEngineFactory f: sef) { > System.out.println(f.getClass().getName()); > } > } > } > > Here are some outputs: > > Apple JVM > -------------- > > java version "1.6.0_24" > Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334) > Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode) > Boot classloader > ================ > > com.sun.script.javascript.RhinoScriptEngineFactory > > Main classloader > ================ > > com.sun.script.javascript.RhinoScriptEngineFactory > > OpenJDK 7 u60 > --------------------- > > openjdk version "1.7.0-u60-unofficial" > OpenJDK Runtime Environment (build 1.7.0-u60-unofficial-b30) > OpenJDK 64-Bit Server VM (build 24.60-b09, mixed mode) > Boot classloader > ================ > > > Main classloader > ================ > > Oracle Java 7u80 > ----------------------- > > java version "1.7.0_80" > Java(TM) SE Runtime Environment (build 1.7.0_80-b15) > Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode) > Boot classloader > ================ > > com.sun.script.javascript.RhinoScriptEngineFactory > > Main classloader > ================ > > com.sun.script.javascript.RhinoScriptEngineFactory > > Azul's Zulu 7u154 > ----------------------- > > openjdk version "1.7.0_154" > OpenJDK Runtime Environment (Zulu 7.20.0.3-linux64) (build 1.7.0_154-b01) > OpenJDK 64-Bit Server VM (Zulu 7.20.0.3-linux64) (build 24.154-b01, mixed > mode) > Boot classloader > ================ > > > Main classloader > ================ > > Oracle Java 8u131 > ------------------------- > > java version "1.8.0_131" > Java(TM) SE Runtime Environment (build 1.8.0_131-b11) > Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode) > Boot classloader > ================ > > jdk.nashorn.api.scripting.NashornScriptEngineFactory > > Main classloader > ================ > > jdk.nashorn.api.scripting.NashornScriptEngineFactory > > > Now IIUC, Nashorn is part of Java 8 but Rhino was not required as part of > Java 7, hence from Java 8 onwards there should always be a > ScriptEngineFactory, but not every Java 7 was required to have one. > > On 10 September 2017 at 14:58, Stephen Connolly < > stephen.alan.conno...@gmail.com> wrote: > > > Might just be the test is looking for an implementation class not > > available on those jres. Do you have the failure messages > > > > On Sun 10 Sep 2017 at 22:29, Tibor Digana <tibor.dig...@googlemail.com> > > wrote: > > > >> You think it has to do you the commit fixing Class Loader issue or the > >> previous commits as well? > >> > >> On Sun, Sep 10, 2017 at 11:23 PM, Michael Osipov <micha...@apache.org> > >> wrote: > >> > >> > Am 2017-09-10 um 23:19 schrieb Tibor Digana: > >> > > >> >> Definitely I agree! > >> >> Let's see if it is JDK issue or platform issue. Let's exclude Oracle > >> Java > >> >> suspicion and then it's serious issue. > >> >> > >> > > >> > Not a platform one. Reproduced on Windows 10 with Zulu 7 Update 154. I > >> > will download Oracla Java 7 from MOSC and test again. I am pretty sure > >> that > >> > it will fail too. > >> > > >> > > >> > On Sun, Sep 10, 2017 at 11:17 PM, Michael Osipov <micha...@apache.org > > > >> >> wrote: > >> >> > >> >> Am 2017-09-10 um 23:15 schrieb Tibor Digana: > >> >>> > >> >>> This one 1.7.0_80 which is 7u80: > >> >>>> http://www.oracle.com/technetwork/java/javase/downloads/ > >> >>>> java-archive-downloads-javase7-521261.html > >> >>>> > >> >>>> > >> >>> No one will seriously run this one. So if we say that our stuff runs > >> off > >> >>> 7 > >> >>> then we have to test OpenJDK and Zulu too. > >> >>> > >> >>> Michael > >> >>> > >> >>> > >> >>> On Sun, Sep 10, 2017 at 11:12 PM, Michael Osipov <mosi...@gmx.de> > >> wrote: > >> >>> > >> >>>> > >> >>>> Am 2017-09-10 um 23:07 schrieb Tibor Digana: > >> >>>> > >> >>>>> > >> >>>>> Michael, now try with Oracle Java 7. > >> >>>>> > >> >>>>>> > >> >>>>>> > >> >>>>>> Last public version or up-to-date paid version? > >> >>>>> > >> >>>>> On Sun, Sep 10, 2017 at 11:02 PM, Michael Osipov < > >> micha...@apache.org> > >> >>>>> > >> >>>>> wrote: > >> >>>>>> > >> >>>>>> Am 2017-09-10 um 22:27 schrieb Stephen Connolly: > >> >>>>>> > >> >>>>>> > >> >>>>>>> Well I ran the release with 1.7.0_80 which iirc is the last > public > >> >>>>>>> > >> >>>>>>> release > >> >>>>>>>> of Oracle Java 7... > >> >>>>>>>> > >> >>>>>>>> > >> >>>>>>>> Fails also on Windows with Zulu 7: > >> >>>>>>>> > >> >>>>>>> $ mvn -v > >> >>>>>>> Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; > >> >>>>>>> 2017-04-03T21:39:06+02:00) > >> >>>>>>> Maven home: D:\Entwicklung\Programme\apache-maven-3.5.0 > >> >>>>>>> Java version: 1.7.0_154, vendor: Azul Systems, Inc. > >> >>>>>>> Java home: C:\Program Files\Zulu\zulu-7\jre > >> >>>>>>> Default locale: de_DE, platform encoding: Cp1252 > >> >>>>>>> OS name: "windows 10", version: "10.0", arch: "amd64", family: > >> >>>>>>> "windows" > >> >>>>>>> > >> >>>>>>> > >> >>>>>>> > >> >>>>>>> On Sun 10 Sep 2017 at 21:08, Michael Osipov < > micha...@apache.org> > >> >>>>>>> wrote: > >> >>>>>>> > >> >>>>>>> > >> >>>>>>> Folks, > >> >>>>>>>> > >> >>>>>>>> > >> >>>>>>>> tried running master on > >> >>>>>>>>> Maven home: /usr/local/share/java/maven > >> >>>>>>>>> Java version: 1.7.0_151, vendor: Oracle Corporation > >> >>>>>>>>> Java home: /usr/local/openjdk7/jre > >> >>>>>>>>> Default locale: de_DE, platform encoding: UTF-8 > >> >>>>>>>>> OS name: "freebsd", version: "11.1-release-p1", arch: "i386", > >> >>>>>>>>> family: > >> >>>>>>>>> "unix" > >> >>>>>>>>> > >> >>>>>>>>> and I get this: > >> >>>>>>>>> Failed tests: > >> >>>>>>>>> > >> >>>>>>>>> > >> >>>>>>>>> DefaultClassRealmManagerTest.testMNG6275_coreRealmDefaultPar > >> >>>>>>>>> entClassLoader:99 > >> >>>>>>>>> null > >> >>>>>>>>> > >> >>>>>>>>> > >> >>>>>>>>> DefaultClassRealmManagerTest.testMNG6275_extensionRealmDefau > >> >>>>>>>>> ltParentClassLoader:73 > >> >>>>>>>>> null > >> >>>>>>>>> > >> >>>>>>>>> > >> >>>>>>>>> DefaultClassRealmManagerTest.testMNG6275_mavenApiRealmDefaul > >> >>>>>>>>> tParentClassLoader:91 > >> >>>>>>>>> null > >> >>>>>>>>> > >> >>>>>>>>> > >> >>>>>>>>> DefaultClassRealmManagerTest.testMNG6275_pluginRealmDefaultP > >> >>>>>>>>> arentClassLoader:62 > >> >>>>>>>>> null > >> >>>>>>>>> > >> >>>>>>>>> > >> >>>>>>>>> DefaultClassRealmManagerTest.testMNG6275_projectRealmDefault > >> >>>>>>>>> ParentClassLoader:83 > >> >>>>>>>>> null > >> >>>>>>>>> > >> >>>>>>>>> All tests fail with "junit.framework.AssertionFailedError: > >> null". > >> >>>>>>>>> > >> >>>>>>>>> Running with > >> >>>>>>>>> Maven home: /usr/local/share/java/maven > >> >>>>>>>>> Java version: 1.8.0_144, vendor: Oracle Corporation > >> >>>>>>>>> Java home: /usr/local/openjdk8/jre > >> >>>>>>>>> Default locale: de_DE, platform encoding: UTF-8 > >> >>>>>>>>> OS name: "freebsd", version: "11.1-release-p1", arch: "i386", > >> >>>>>>>>> family: > >> >>>>>>>>> "unix" > >> >>>>>>>>> > >> >>>>>>>>> works flawlessly. > >> >>>>>>>>> > >> >>>>>>>>> Any ideas? > >> >>>>>>>>> > >> >>>>>>>>> ------------------------------------------------------------ > >> >>>>>>>>> --------- > >> >>>>>>>>> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org > >> >>>>>>>>> For additional commands, e-mail: dev-h...@maven.apache.org > >> >>>>>>>>> > >> >>>>>>>>> -- > >> >>>>>>>>> > >> >>>>>>>>> Sent from my phone > >> >>>>>>>>> > >> >>>>>>>>> > >> >>>>>>>> > >> >>>>>>>> > >> >>>>>>>> ------------------------------------------------------------ > >> >>>>>>>> --------- > >> >>>>>>>> > >> >>>>>>> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org > >> >>>>>>> For additional commands, e-mail: dev-h...@maven.apache.org > >> >>>>>>> > >> >>>>>>> > >> >>>>>>> > >> >>>>>>> > >> >>>>>>> > >> >>>>>> > >> >>>>>> > >> >>>>> > >> >>>> > >> >>>> > >> >>> ------------------------------------------------------------ > --------- > >> >>> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org > >> >>> For additional commands, e-mail: dev-h...@maven.apache.org > >> >>> > >> >>> > >> >>> > >> >> > >> >> > >> > > >> > >> > >> -- > >> Cheers > >> Tibor > >> > > -- > > Sent from my phone > > > -- Cheers Tibor