Discussion:
maven and java11
Romain Manni-Bucau
2018-11-13 16:35:12 UTC
Permalink
Hi guys,

did you plan to fix and upgrade classworlds to support java11?

The trick is in org.codehaus.plexus.classworlds.realm.ClassRealm#findClass.
This method assumes it can't be called outside loadClass(String[,boolean])
but in j11 there is loadClass(String, String) defaulting to it as well so
it just fails and breaks a lot of mojo. One lib using that feature is jaxb
= 2.3.0 so any mojo relying on jaxb 2.3 is broken.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Tibor Digana
2018-11-14 09:00:22 UTC
Permalink
Hi Romain,

Which class could not be loaded?
JAXB or CDI class?
Some class from Maven dist or another one?

BR,
Tibor
Post by Romain Manni-Bucau
Hi guys,
did you plan to fix and upgrade classworlds to support java11?
The trick is in org.codehaus.plexus.classworlds.realm.ClassRealm#findClass.
This method assumes it can't be called outside loadClass(String[,boolean])
but in j11 there is loadClass(String, String) defaulting to it as well so
it just fails and breaks a lot of mojo. One lib using that feature is jaxb
= 2.3.0 so any mojo relying on jaxb 2.3 is broken.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<
https://www.packtpub.com/application-development/java-ee-8-high-performance
Romain Manni-Bucau
2018-11-14 15:34:30 UTC
Permalink
assume i have a standard package-info.json with @XmlSchema, nothing crazy
in jaxb land.

jaxb will do a loadClass(module, "com.foo.mypackage.package-info"), this
will call findClass(String /*module.getName()*/, String) which will call
findClass(String) (default impl in ClassLoader parent class of any
classloader impl).

ClassRealm will expect findClass(String) to be loaded from
loadClass(String[,boolean]) so always throws ClassNotFoundException since
it is not expected to be used (instead the lookup strategy - API - is
used).

So in the previous cases of jaxb the loadClass will throw a ClassNotFound
which makes the metadata just wrong.

This is a vicious bug which means not a single mojo can use the java 11
classloader API. By itself it sounds ok but since a lot of libs are
starting to use it, it means mojo are not working under java 11 until the
mojo creates another classloader which is not the case for standard simple
tasks mojos.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Post by Tibor Digana
Hi Romain,
Which class could not be loaded?
JAXB or CDI class?
Some class from Maven dist or another one?
BR,
Tibor
Post by Romain Manni-Bucau
Hi guys,
did you plan to fix and upgrade classworlds to support java11?
The trick is in
org.codehaus.plexus.classworlds.realm.ClassRealm#findClass.
Post by Romain Manni-Bucau
This method assumes it can't be called outside
loadClass(String[,boolean])
Post by Romain Manni-Bucau
but in j11 there is loadClass(String, String) defaulting to it as well so
it just fails and breaks a lot of mojo. One lib using that feature is
jaxb
Post by Romain Manni-Bucau
= 2.3.0 so any mojo relying on jaxb 2.3 is broken.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<
https://www.packtpub.com/application-development/java-ee-8-high-performance
Hervé BOUTEMY
2018-11-14 22:12:56 UTC
Permalink
oh, subtle issue

can you provide a unit test, please?

regards,

Hervé
Post by Romain Manni-Bucau
in jaxb land.
jaxb will do a loadClass(module, "com.foo.mypackage.package-info"), this
will call findClass(String /*module.getName()*/, String) which will call
findClass(String) (default impl in ClassLoader parent class of any
classloader impl).
ClassRealm will expect findClass(String) to be loaded from
loadClass(String[,boolean]) so always throws ClassNotFoundException since
it is not expected to be used (instead the lookup strategy - API - is
used).
So in the previous cases of jaxb the loadClass will throw a ClassNotFound
which makes the metadata just wrong.
This is a vicious bug which means not a single mojo can use the java 11
classloader API. By itself it sounds ok but since a lot of libs are
starting to use it, it means mojo are not working under java 11 until the
mojo creates another classloader which is not the case for standard simple
tasks mojos.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau>
| LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance
Post by Tibor Digana
Hi Romain,
Which class could not be loaded?
JAXB or CDI class?
Some class from Maven dist or another one?
BR,
Tibor
Post by Romain Manni-Bucau
Hi guys,
did you plan to fix and upgrade classworlds to support java11?
The trick is in
org.codehaus.plexus.classworlds.realm.ClassRealm#findClass.
Post by Romain Manni-Bucau
This method assumes it can't be called outside
loadClass(String[,boolean])
Post by Romain Manni-Bucau
but in j11 there is loadClass(String, String) defaulting to it as well so
it just fails and breaks a lot of mojo. One lib using that feature is
jaxb
Post by Romain Manni-Bucau
= 2.3.0 so any mojo relying on jaxb 2.3 is broken.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<
https://www.packtpub.com/application-development/java-ee-8-high-performanc
e
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@maven.apache.org
For additional commands, e-mail: dev-***@maven.apache.org
Andreas Dangel
2018-11-14 19:58:36 UTC
Permalink
The problem is maybe, that JAXB has been removed with java11: [1]

The reference implementation [2] can be used as a replacement.


Regards,

Andreas


1: https://openjdk.java.net/jeps/320

2:
https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.sun.xml.bind%22%20AND%20a%3A%22jaxb-ri%22
Post by Romain Manni-Bucau
in jaxb land.
jaxb will do a loadClass(module, "com.foo.mypackage.package-info"), this
will call findClass(String /*module.getName()*/, String) which will call
findClass(String) (default impl in ClassLoader parent class of any
classloader impl).
ClassRealm will expect findClass(String) to be loaded from
loadClass(String[,boolean]) so always throws ClassNotFoundException since
it is not expected to be used (instead the lookup strategy - API - is
used).
So in the previous cases of jaxb the loadClass will throw a ClassNotFound
which makes the metadata just wrong.
This is a vicious bug which means not a single mojo can use the java 11
classloader API. By itself it sounds ok but since a lot of libs are
starting to use it, it means mojo are not working under java 11 until the
mojo creates another classloader which is not the case for standard simple
tasks mojos.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Post by Tibor Digana
Hi Romain,
Which class could not be loaded?
JAXB or CDI class?
Some class from Maven dist or another one?
BR,
Tibor
Post by Romain Manni-Bucau
Hi guys,
did you plan to fix and upgrade classworlds to support java11?
The trick is in
org.codehaus.plexus.classworlds.realm.ClassRealm#findClass.
Post by Romain Manni-Bucau
This method assumes it can't be called outside
loadClass(String[,boolean])
Post by Romain Manni-Bucau
but in j11 there is loadClass(String, String) defaulting to it as well so
it just fails and breaks a lot of mojo. One lib using that feature is
jaxb
Post by Romain Manni-Bucau
= 2.3.0 so any mojo relying on jaxb 2.3 is broken.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<
https://www.packtpub.com/application-development/java-ee-8-high-performance
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@maven.apache.org
For additional commands, e-mail: dev-***@maven.apache.org
Romain Manni-Bucau
2018-11-15 07:01:52 UTC
Permalink
@Andreas: no, the bug is in plexus as explained before, jaxb is provided
but plexus classloader is not java11 compatible
@Hervé: i'll try to send a PR on plexus soon, will probably be faster than
mail exchanges ;)

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Post by Andreas Dangel
The problem is maybe, that JAXB has been removed with java11: [1]
The reference implementation [2] can be used as a replacement.
Regards,
Andreas
1: https://openjdk.java.net/jeps/320
https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.sun.xml.bind%22%20AND%20a%3A%22jaxb-ri%22
Post by Romain Manni-Bucau
in jaxb land.
jaxb will do a loadClass(module, "com.foo.mypackage.package-info"), this
will call findClass(String /*module.getName()*/, String) which will call
findClass(String) (default impl in ClassLoader parent class of any
classloader impl).
ClassRealm will expect findClass(String) to be loaded from
loadClass(String[,boolean]) so always throws ClassNotFoundException since
it is not expected to be used (instead the lookup strategy - API - is
used).
So in the previous cases of jaxb the loadClass will throw a ClassNotFound
which makes the metadata just wrong.
This is a vicious bug which means not a single mojo can use the java 11
classloader API. By itself it sounds ok but since a lot of libs are
starting to use it, it means mojo are not working under java 11 until the
mojo creates another classloader which is not the case for standard
simple
Post by Romain Manni-Bucau
tasks mojos.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
Post by Romain Manni-Bucau
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<
https://www.packtpub.com/application-development/java-ee-8-high-performance
Post by Romain Manni-Bucau
Post by Tibor Digana
Hi Romain,
Which class could not be loaded?
JAXB or CDI class?
Some class from Maven dist or another one?
BR,
Tibor
On Tue, Nov 13, 2018 at 5:35 PM Romain Manni-Bucau <
Post by Romain Manni-Bucau
Hi guys,
did you plan to fix and upgrade classworlds to support java11?
The trick is in
org.codehaus.plexus.classworlds.realm.ClassRealm#findClass.
Post by Romain Manni-Bucau
This method assumes it can't be called outside
loadClass(String[,boolean])
Post by Romain Manni-Bucau
but in j11 there is loadClass(String, String) defaulting to it as well
so
Post by Romain Manni-Bucau
Post by Tibor Digana
Post by Romain Manni-Bucau
it just fails and breaks a lot of mojo. One lib using that feature is
jaxb
Post by Romain Manni-Bucau
= 2.3.0 so any mojo relying on jaxb 2.3 is broken.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<
https://www.packtpub.com/application-development/java-ee-8-high-performance
---------------------------------------------------------------------
Romain Manni-Bucau
2018-11-15 08:20:45 UTC
Permalink
FYI https://github.com/sonatype/plexus-classworlds/pull/16

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Post by Romain Manni-Bucau
@Andreas: no, the bug is in plexus as explained before, jaxb is provided
but plexus classloader is not java11 compatible
@Hervé: i'll try to send a PR on plexus soon, will probably be faster than
mail exchanges ;)
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github
<https://github.com/rmannibucau> | LinkedIn
<https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Post by Andreas Dangel
The problem is maybe, that JAXB has been removed with java11: [1]
The reference implementation [2] can be used as a replacement.
Regards,
Andreas
1: https://openjdk.java.net/jeps/320
https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.sun.xml.bind%22%20AND%20a%3A%22jaxb-ri%22
crazy
Post by Romain Manni-Bucau
in jaxb land.
jaxb will do a loadClass(module, "com.foo.mypackage.package-info"), this
will call findClass(String /*module.getName()*/, String) which will call
findClass(String) (default impl in ClassLoader parent class of any
classloader impl).
ClassRealm will expect findClass(String) to be loaded from
loadClass(String[,boolean]) so always throws ClassNotFoundException
since
Post by Romain Manni-Bucau
it is not expected to be used (instead the lookup strategy - API - is
used).
So in the previous cases of jaxb the loadClass will throw a
ClassNotFound
Post by Romain Manni-Bucau
which makes the metadata just wrong.
This is a vicious bug which means not a single mojo can use the java 11
classloader API. By itself it sounds ok but since a lot of libs are
starting to use it, it means mojo are not working under java 11 until
the
Post by Romain Manni-Bucau
mojo creates another classloader which is not the case for standard
simple
Post by Romain Manni-Bucau
tasks mojos.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
Post by Romain Manni-Bucau
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<
https://www.packtpub.com/application-development/java-ee-8-high-performance
Post by Romain Manni-Bucau
Post by Tibor Digana
Hi Romain,
Which class could not be loaded?
JAXB or CDI class?
Some class from Maven dist or another one?
BR,
Tibor
On Tue, Nov 13, 2018 at 5:35 PM Romain Manni-Bucau <
Post by Romain Manni-Bucau
Hi guys,
did you plan to fix and upgrade classworlds to support java11?
The trick is in
org.codehaus.plexus.classworlds.realm.ClassRealm#findClass.
Post by Romain Manni-Bucau
This method assumes it can't be called outside
loadClass(String[,boolean])
Post by Romain Manni-Bucau
but in j11 there is loadClass(String, String) defaulting to it as
well so
Post by Romain Manni-Bucau
Post by Tibor Digana
Post by Romain Manni-Bucau
it just fails and breaks a lot of mojo. One lib using that feature is
jaxb
Post by Romain Manni-Bucau
= 2.3.0 so any mojo relying on jaxb 2.3 is broken.
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<
https://www.packtpub.com/application-development/java-ee-8-high-performance
---------------------------------------------------------------------
Continue reading on narkive:
Loading...