[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2022-01-03 Thread Guillaume Nodet (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17468099#comment-17468099
 ] 

Guillaume Nodet commented on MNG-6275:
--

I think a better solution was provided with 
https://github.com/apache/maven/commit/39004f6aee634a0ac6daa1f99add29

> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Stephen Connolly
>Priority: Critical
>  Labels: intern
> Fix For: 4.x / Backlog
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2020-03-28 Thread Hudson (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17069729#comment-17069729
 ] 

Hudson commented on MNG-6275:
-

Build failed in Jenkins: Maven TLP » maven-studies » maven-metrics #4

See 
https://builds.apache.org/job/maven-box/job/maven-studies/job/maven-metrics/4/

> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Stephen Connolly
>Priority: Critical
> Fix For: 3.x / Backlog
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2019-09-10 Thread Matthias Hild (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16926655#comment-16926655
 ] 

Matthias Hild commented on MNG-6275:


This is issue is rightfully marked as critical and blocks migration to Java >= 
9 for any plugins relying on ServiceLoader logic.

Could you please comment on _where you see the problem_ with the August 2017 
commit that was trying to address the issue:

[https://github.com/apache/maven/commit/27a2bda3f4a8f5385c4cab360ed7365d3d3d3c09#diff-1cb44e9c06f435b494a39ea8bbaed863]

This commit uses the class-loader of {{ClassRealmManager.class}} as the parent 
class-loader when creating a new {{ClassRealm}}. This commit was reverted in 
October 2017:

[https://github.com/apache/maven/commit/cae779e4fbc6565a581f2c6adf9fb15348005603#diff-1cb44e9c06f435b494a39ea8bbaed863]

I recompiled 3.6.3-SNAPSHOT with this fix in place and, for example, the JS 
ScriptEngine (Nashorn) now loads as expected.

Moreover, the logic of this fix seems at first glance correct.

Many thanks for your great work!!!

M.

PS: With the risk of restating what is already obvious the the committers, here 
a brief problem statement for the uninitiated: {{java.util.ServiceLoader}} was 
heavily revised in Java 9 (see comments in code) and its method {{public 
Iterator iterator()}} now delegates to an iterator constructed of the inner 
classes {{ModuleServicesLookupIterator}} and {{LazyClassPathLookupIterator}}.

In the following code snippet from  {{ModuleServicesLookupIterator, 
}}{{DefaultClassRealmManager}} is the {{currentLoader}}. As its {{.parent}} is 
null in the released versions of Maven, {{iteratorFor(null)}} uses the 
{{BootLoader}}'s {{ServiceCatalog}} where the requested services cannot be not 
found (as pointed out in earlier posts). 

 
{quote}@Override
 public boolean hasNext() {
  while (nextProvider == null && nextError == null) {
  // get next provider to load
  while (!iterator.hasNext()) {
    if (currentLoader == null) {
      return false;
    } else {
      currentLoader = currentLoader.getParent();
      iterator = iteratorFor(currentLoader);
    }
  }

  ...

}
{quote}
 

> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Stephen Connolly
>Priority: Critical
> Fix For: 3.x / Backlog
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2019-04-02 Thread Chapman Flack (JIRA)


[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16808303#comment-16808303
 ] 

Chapman Flack commented on MNG-6275:


Hi,

By following a link from the maven-antrun-plugin, I am under the impression 
that this issue might be the underlying reason I am seeing this error with a 
build that includes a 

[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2018-12-30 Thread Robert Scholte (JIRA)


[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16730938#comment-16730938
 ] 

Robert Scholte commented on MNG-6275:
-

No, it has been reverted


> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Stephen Connolly
>Priority: Critical
> Fix For: 3.5.2
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2018-12-29 Thread Sylwester Lachiewicz (JIRA)


[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16730837#comment-16730837
 ] 

Sylwester Lachiewicz commented on MNG-6275:
---

I think we fixed this problem with 3.5.2 - I can see both commits in master.

> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Stephen Connolly
>Priority: Critical
> Fix For: 3.5.2
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2017-10-17 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16208094#comment-16208094
 ] 

Hudson commented on MNG-6275:
-

SUCCESS: Integrated in Jenkins build maven-3.x #1672 (See 
[https://builds.apache.org/job/maven-3.x/1672/])
Revert "[MNG-6275] Maven Embedder compatible fix" (stephen.alan.connolly: 
[http://git-wip-us.apache.org/repos/asf/?p=maven.git=commit=cae779e4fbc6565a581f2c6adf9fb15348005603])
* (edit) 
maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
* (delete) 
maven-core/src/test/java/org/apache/maven/classrealm/DefaultClassRealmManagerTest.java


> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Stephen Connolly
>Priority: Critical
> Fix For: 3.5.1
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2017-09-11 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16160980#comment-16160980
 ] 

Hudson commented on MNG-6275:
-

SUCCESS: Integrated in Jenkins build maven-3.x #1670 (See 
[https://builds.apache.org/job/maven-3.x/1670/])
[MNG-6275] Defang the tests when their core assumption is invalid. 
(stephen.alan.connolly: 
[http://git-wip-us.apache.org/repos/asf/?p=maven.git=commit=542a7a89156263b34d1472e9d9c1a2795afccd2d])
* (edit) 
maven-core/src/test/java/org/apache/maven/classrealm/DefaultClassRealmManagerTest.java


> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Stephen Connolly
>Priority: Critical
> Fix For: 3.5.1
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2017-09-09 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16159891#comment-16159891
 ] 

Hudson commented on MNG-6275:
-

SUCCESS: Integrated in Jenkins build maven-3.x #1668 (See 
[https://builds.apache.org/job/maven-3.x/1668/])
[MNG-6275] Maven Embedder compatible fix (stephen.alan.connolly: 
[http://git-wip-us.apache.org/repos/asf/?p=maven.git=commit=27a2bda3f4a8f5385c4cab360ed7365d3d3d3c09])
* (edit) 
maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
* (add) 
maven-core/src/test/java/org/apache/maven/classrealm/DefaultClassRealmManagerTest.java


> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Stephen Connolly
>Priority: Critical
> Fix For: 3.5.1
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2017-08-31 Thread Stephen Connolly (JIRA)

[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16148694#comment-16148694
 ] 

Stephen Connolly commented on MNG-6275:
---

Pulling back in scope for 3.5.1 as we look to have a candidate viable fix: 
https://builds.apache.org/blue/organizations/jenkins/maven-3.x-jenkinsfile/activity?branch=mng-6275
 https://github.com/apache/maven/compare/mng-6275

> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Robert Scholte
>Priority: Critical
> Fix For: 3.5.1
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2017-08-30 Thread Stephen Connolly (JIRA)

[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16146953#comment-16146953
 ] 

Stephen Connolly commented on MNG-6275:
---

https://builds.apache.org/view/M-R/view/Maven/job/maven-3.x-jenkinsfile/job/mng-6275/
 will have the test status but a local run of the integration tests reveals 
this change at least gets past testBootstrap, so likely is good

> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Robert Scholte
>Priority: Critical
> Fix For: 3.6.x-candidate
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2017-08-30 Thread Stephen Connolly (JIRA)

[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16146948#comment-16146948
 ] 

Stephen Connolly commented on MNG-6275:
---

I believe I have the fix... 
https://github.com/apache/maven/commit/39004f6aee634a0ac6daa1f99add299ff439f5ec

> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Robert Scholte
>Priority: Critical
> Fix For: 3.6.x-candidate
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2017-08-24 Thread Robert Scholte (JIRA)

[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16140270#comment-16140270
 ] 

Robert Scholte commented on MNG-6275:
-

Hi Igor,

moving this to dev-list.
I've asked an explanation of the Java developers team. They confirm that  
they've made a more clear separation of boot-, system- and  
application-classloader. They wondered why we put "null" there in the  
first place, because in general the boot classloader is not enough.
I've tested if and this change would be the required fix for MANTRUN-200.  
I haven't found any failing tests yet.
If this causes issues for other frameworks we need to have a look what  
should be changed combined with the impact. Were they relying on a bug in  
Maven. Based on the analysis so far this should be the proper fix.
Can you somehow try to verify first if this is really an issue. I'm not  
sure if this should be reverted because of _potential_ issues, because in  
the end every change could result in new issues.

I'll try to prepare new Maven installation locally and run other Maven  
subprojects as well.

thanks,
Robert

ps Stephen gave me the +1 for merging.


On Thu, 24 Aug 2017 14:30:00 +0200, Igor Fedorenko (JIRA)  



> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Robert Scholte
>Priority: Critical
> Fix For: 3.5.1
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (MNG-6275) ServiceLoaderFactory can't find implementations via ClassRealm

2017-08-24 Thread Igor Fedorenko (JIRA)

[ 
https://issues.apache.org/jira/browse/MNG-6275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16139975#comment-16139975
 ] 

Igor Fedorenko commented on MNG-6275:
-

I don't have time to do proper analysis of this, but this change will likely 
cause problems in m2e, plugin testing, jenkins and other embedded usecases, 
where contents of system classloader is generally unknown and can contain 
classes that either collide or confuse plugins in some other ways (e.g. 
random/unrelated components visible to plugins in only some environments, which 
will be very hard to troubleshoot).

PS: didn't we agree to get all core changes reviewed and +1'ed by at least one 
other developer before pushing to master? 

> ServiceLoaderFactory can't find implementations via ClassRealm
> --
>
> Key: MNG-6275
> URL: https://issues.apache.org/jira/browse/MNG-6275
> Project: Maven
>  Issue Type: Bug
>  Components: Class Loading
>Reporter: Robert Scholte
>Assignee: Robert Scholte
>Priority: Critical
> Fix For: 3.5.1
>
>
> Spotted this issue via MANTRUN-200. The reason is that in the 
> {{DefaultClassRealmManager}} a new realm is created where the parent 
> classLoader is {{null}}. This implies that the bootstrap classloader is used 
> as parent.
> With Java8 nashorn has become an extension and is not part of the bootstrap 
> classloader anymore.
> It is kind of strange that we want the bootstrap classloader here, it makes 
> more sense if the system classloader is used (but with Java 7 and older 
> versions of Java this was not an issue, both worked fine).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)