Building TomEE with JDK8 and running with JDK11

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

Building TomEE with JDK8 and running with JDK11

Jean-Louis MONTEIRO
Hi all,

In parallel of the Java 11 TCK on the actual TomEE binary, I looked at the
build again.
Remember that I merged a PR 2 weeks ago and ended up reverting because
TomEE binaries can already work with Java 11.

So here is what I have done so far

1/ Build TomEE with JDK 8
On a terminal with JDK 8, `mvn clean install -DskipTests`

2/ Run tests with JDK 11
Started with the examples first. So in another terminal, I ran `mvn test -f
examples`

It fails pretty much immediately with
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)

That's ok, because as specified in https://openjdk.java.net/jeps/320 JAXB
with some other APIs aren't available anymore.

There is a way to activate javaee modules but it's not recommended as it
will disappear soon. The recommended approach is to add the dependencies
straight in the project as regular dependencies.

In TomEE, the interesting thing is that, the actual binaries shipped to
users (zip, tag.gz) already have those dependencies so TomEE can run on IBM
JVM for instance. That's the reason why I can run TCK with either JDK8 or
JDK11 without any change.

If you check the PR I reverted, I have added the extra dependencies inside
a profile which is activated by default on Java 11. See
https://github.com/apache/tomee/pull/523/files#diff-350f248c5779512fd39778551f6e5ec1R714

What do you guys think?

Should add the APIs straights in the javaee-api?
Add the dependencies straights without profiles?






--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com
   --
    Jean-Louis Monteiro
    http://twitter.com/jlouismonteiro
    http://www.tomitribe.com
Reply | Threaded
Open this post in threaded view
|

Re: Building TomEE with JDK8 and running with JDK11

Cesar Hernandez
Hi Jean-Louis,

Thanks for the information.
My +1 is for: Add the dependencies straights without profiles.

For others who may want to give it a try to this compileIn8+runWith11, I
use sdk man [1] and installed 8.0.222.hs-adpt and also 11.0.4.hs-adpt.
My steps how I ran Jean-Louis instructions were:

Pull and checkout lastest tomee/master
sdk  use java 8.0.222.hs-adpt
mvn clean install -DskipTests
sdk  use java 11.0.4.hs-adpt
cd examples
mvn test #This fails as Jean-Louis explained

[1] https://sdkman.io/

El jue., 8 ago. 2019 a las 5:38, Jean-Louis Monteiro (<
[hidden email]>) escribió:

> Hi all,
>
> In parallel of the Java 11 TCK on the actual TomEE binary, I looked at the
> build again.
> Remember that I merged a PR 2 weeks ago and ended up reverting because
> TomEE binaries can already work with Java 11.
>
> So here is what I have done so far
>
> 1/ Build TomEE with JDK 8
> On a terminal with JDK 8, `mvn clean install -DskipTests`
>
> 2/ Run tests with JDK 11
> Started with the examples first. So in another terminal, I ran `mvn test -f
> examples`
>
> It fails pretty much immediately with
> Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
> at
>
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
>
> That's ok, because as specified in https://openjdk.java.net/jeps/320 JAXB
> with some other APIs aren't available anymore.
>
> There is a way to activate javaee modules but it's not recommended as it
> will disappear soon. The recommended approach is to add the dependencies
> straight in the project as regular dependencies.
>
> In TomEE, the interesting thing is that, the actual binaries shipped to
> users (zip, tag.gz) already have those dependencies so TomEE can run on IBM
> JVM for instance. That's the reason why I can run TCK with either JDK8 or
> JDK11 without any change.
>
> If you check the PR I reverted, I have added the extra dependencies inside
> a profile which is activated by default on Java 11. See
>
> https://github.com/apache/tomee/pull/523/files#diff-350f248c5779512fd39778551f6e5ec1R714
>
> What do you guys think?
>
> Should add the APIs straights in the javaee-api?
> Add the dependencies straights without profiles?
>
>
>
>
>
>
> --
> Jean-Louis Monteiro
> http://twitter.com/jlouismonteiro
> http://www.tomitribe.com
>


--
Atentamente:
César Hernández.
Reply | Threaded
Open this post in threaded view
|

Re: Building TomEE with JDK8 and running with JDK11

David Blevins-2
In reply to this post by Jean-Louis MONTEIRO
> On Aug 8, 2019, at 4:38 AM, Jean-Louis Monteiro <[hidden email]> wrote:
>
> So here is what I have done so far
>
> 1/ Build TomEE with JDK 8
> On a terminal with JDK 8, `mvn clean install -DskipTests`
>
> 2/ Run tests with JDK 11
> Started with the examples first. So in another terminal, I ran `mvn test -f
> examples`

As noted in the other thread, I attempted to turn that into a builder to help:

 - https://ci.apache.org/builders/tomee-build-jvm8-test-jvm11/builds/0

>
> It fails pretty much immediately with
> Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
> at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
>
[...]

>
> In TomEE, the interesting thing is that, the actual binaries shipped to
> users (zip, tag.gz) already have those dependencies so TomEE can run on IBM
> JVM for instance. That's the reason why I can run TCK with either JDK8 or
> JDK11 without any change.
>
> If you check the PR I reverted, I have added the extra dependencies inside
> a profile which is activated by default on Java 11. See
> https://github.com/apache/tomee/pull/523/files#diff-350f248c5779512fd39778551f6e5ec1R714
>
> What do you guys think?
>
> Should add the APIs straights in the javaee-api?
> Add the dependencies straights without profiles?

I took a look and we had both the Geronimo JAXB 2.2 and Jakarta JAXB 2.3 APIs in use on different modules so they were both getting sucked in.  We also had copies of the corresponding excludes all over the place.

Not entirely sure if this is a good idea or not, but we have 400+ excludes across our project, most of them redundant, so I experimented with a way we could reduce them through BOMs:

 - https://github.com/apache/tomee/tree/master/boms
 - https://github.com/apache/tomee/blob/master/boms/jaxb-runtime/pom.xml

Despite that fanciness, your suggestion to include the JAXB API in the javaee-api jar is probably the best.  If we did that and openejb-jee declared a dependency on the runtime, most users could avoid having to add JAXB stuff to their pom as they'd already have  both of those.

We could potentially delete all the jaxb dependencies in all the examples and see if it really works.

Note if we're going to modify the javaee-api jar, I went ahead and did an audit to see what else we might need to change.  I posted that in "Java EE 8 versions of APIs" thread.


-David


Reply | Threaded
Open this post in threaded view
|

Re: Building TomEE with JDK8 and running with JDK11

Jean-Louis MONTEIRO
On the japaee-api updates, I was looking the other day and noticed some
outdated dependencies.
Thanks for pushing the tickets, you made my life easier to fix some of them
when they exist.
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com


On Tue, Aug 13, 2019 at 9:41 AM David Blevins <[hidden email]>
wrote:

> > On Aug 8, 2019, at 4:38 AM, Jean-Louis Monteiro <
> [hidden email]> wrote:
> >
> > So here is what I have done so far
> >
> > 1/ Build TomEE with JDK 8
> > On a terminal with JDK 8, `mvn clean install -DskipTests`
> >
> > 2/ Run tests with JDK 11
> > Started with the examples first. So in another terminal, I ran `mvn test
> -f
> > examples`
>
> As noted in the other thread, I attempted to turn that into a builder to
> help:
>
>  - https://ci.apache.org/builders/tomee-build-jvm8-test-jvm11/builds/0
>
> >
> > It fails pretty much immediately with
> > Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
> > at
> >
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
> >
> [...]
> >
> > In TomEE, the interesting thing is that, the actual binaries shipped to
> > users (zip, tag.gz) already have those dependencies so TomEE can run on
> IBM
> > JVM for instance. That's the reason why I can run TCK with either JDK8 or
> > JDK11 without any change.
> >
> > If you check the PR I reverted, I have added the extra dependencies
> inside
> > a profile which is activated by default on Java 11. See
> >
> https://github.com/apache/tomee/pull/523/files#diff-350f248c5779512fd39778551f6e5ec1R714
> >
> > What do you guys think?
> >
> > Should add the APIs straights in the javaee-api?
> > Add the dependencies straights without profiles?
>
> I took a look and we had both the Geronimo JAXB 2.2 and Jakarta JAXB 2.3
> APIs in use on different modules so they were both getting sucked in.  We
> also had copies of the corresponding excludes all over the place.
>
> Not entirely sure if this is a good idea or not, but we have 400+ excludes
> across our project, most of them redundant, so I experimented with a way we
> could reduce them through BOMs:
>
>  - https://github.com/apache/tomee/tree/master/boms
>  - https://github.com/apache/tomee/blob/master/boms/jaxb-runtime/pom.xml
>
> Despite that fanciness, your suggestion to include the JAXB API in the
> javaee-api jar is probably the best.  If we did that and openejb-jee
> declared a dependency on the runtime, most users could avoid having to add
> JAXB stuff to their pom as they'd already have  both of those.
>
> We could potentially delete all the jaxb dependencies in all the examples
> and see if it really works.
>
> Note if we're going to modify the javaee-api jar, I went ahead and did an
> audit to see what else we might need to change.  I posted that in "Java EE
> 8 versions of APIs" thread.
>
>
> -David
>
>
>
   --
    Jean-Louis Monteiro
    http://twitter.com/jlouismonteiro
    http://www.tomitribe.com