Re: maven and java11

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: maven and java11

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 <[hidden email]>
wrote:

> 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
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: maven and java11

Romain Manni-Bucau
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>


Le mer. 14 nov. 2018 à 10:00, Tibor Digana <[hidden email]> a
écrit :

> 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 <[hidden email]>
> wrote:
>
> > 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
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: maven and java11

Romain Manni-Bucau
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>


Le jeu. 15 nov. 2018 à 08:01, Romain Manni-Bucau <[hidden email]> a
écrit :

> @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>
>
>
> Le jeu. 15 nov. 2018 à 07:56, Andreas Dangel <[hidden email]>
> a écrit :
>
>> 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
>>
>>
>> Am 14.11.2018 um 16:34 schrieb Romain Manni-Bucau:
>> > 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
>> >
>> >
>> >
>> > Le mer. 14 nov. 2018 à 10:00, Tibor Digana <[hidden email]> a
>> > écrit :
>> >
>> >> 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 <
>> [hidden email]>
>> >> wrote:
>> >>
>> >>> 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
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>