[hibernate-dev] Java 9: progress on compatibility
Steve Ebersole
steve at hibernate.org
Fri Jun 17 20:22:47 EDT 2016
For the most part we have gotten ORM buildable with Java 9. Some "open
items":
1. Javassist does not seem to support Java 9 much, if at all. I had to
disable some tests in hibernate-core that test enhancement as well as tests
for hibernate-hikari since it uses Javassist extensively too.
hibernate-envers has a bunch of test failures that seem related to
Javassist as well.
2. The tests for hibernate-osgi simply hang. Something in that test
stack does not like Java 9.
Longer term we need to decide how we want to handle non standard modules
moving forward. This mostly came up in regards to JAXB and XJC. For the
moment I added a set of non-transitive dependencies for JAXB and XJC to
hibernate-core and hibernate-jpamodelgen. Since the hibernate-core one is
non-transitive I then had to add a similar fragment to each and every
module that depends on hibernate-core tries to run tests using it. This
gets fugly :) For reference the fragment looks like:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Java 9 ftw!
if ( JavaVersion.current().isJava9Compatible() ) {
// The JDK used to run Gradle is Java 9+, and we assume that that
is the same
// JDK for executing tasks
compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' )
compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' )
compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' )
compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' )
compile( 'javax:javaee-api:7.0' )
testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' )
testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' )
testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' )
testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' )
testCompile( 'javax:javaee-api:7.0' )
testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' )
testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' )
testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' )
testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' )
testRuntime( 'javax:javaee-api:7.0' )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I decided to do this non-transitively since users may (probably) would want
to use a better JAXB impl. Not sure the best way to handle this.
On Wed, Jun 15, 2016 at 3:14 PM Steve Ebersole <steve at hibernate.org> wrote:
> No worries, I understand.
>
> On Wed, Jun 15, 2016 at 3:13 PM Sanne Grinovero <sanne at hibernate.org>
> wrote:
>
>> On 15 June 2016 at 19:29, Steve Ebersole <steve at hibernate.org> wrote:
>> > WRT JAXB (XJC) I am completely lost.
>> >
>> > Sanne I tried your solution of specifying an addmod for jaxb to
>> GRADLE_OPTS
>> > but get the same result (ExceptionInInitializerError) with and without
>> that
>> > change. So not sure how you got that to work.
>>
>> Steve, sorry if that wasn't clear: this didn't work for me either.
>> I used the GRADLE_OPTS to bypass other issues which I had before
>> reaching this point, but then I got stuck on the 'xjc' plugin, and
>> that's were I asked if we could bypass/skip/rewrite the plugin.
>>
>> >
>> > I did try the alternative we discussed of defining an explicit build
>> > dependency on JAXB (which again has no effect):
>> >
>> >
>> > xjc 'org.glassfish.jaxb:jaxb-core:2.2.11'
>> > xjc 'org.glassfish.jaxb:jaxb-xjc:2.2.11'
>> > xjc 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0'
>> > xjc 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0'
>> >
>> >
>> > For some background, XJC is currently performed via Gradle's AntBuilder
>> > support using the jaxb2_commons Ant task
>> > (org.jvnet.jaxb2_commons.xjc.XJC2Task). I also have tried using Sun's
>> > com.sun.tools.xjc.XJCTask directly. Neither make any difference. The
>> > fundamental problem is that for Ant execution Gradle simply reuses its
>> VM.
>> > So to get this applied (iiuc) the only real option is to configure the
>> > Gradle launch to include the addmod (which makes it more odd that
>> > GRADLE_OPTS did not work for me).
>> >
>> > The other option is to write a new Gradle XjcTask that executes the XJC
>> tool
>> > directly. That we can use Gradle to help us fork and pass the addmod
>> option
>> > to the forked process. I think :)
>> >
>> >
>> > On Mon, Jun 13, 2016 at 3:00 AM Gunnar Morling <gunnar at hibernate.org>
>> wrote:
>> >>
>> >> Yep, we discussed that approach last year already:
>> >> http://lists.jboss.org/pipermail/hibernate-dev/2015-March/012250.html
>> >>
>> >> 2016-06-13 9:49 GMT+02:00 Sanne Grinovero <sanne at hibernate.org>:
>> >>
>> >> > On 13 June 2016 at 07:34, Gunnar Morling <gunnar at hibernate.org>
>> wrote:
>> >> > > Hey,
>> >> > >
>> >> > > I hit the same issue with the injection plug-in in HV.
>> >> > >
>> >> > > It was used for obtaining the version of HV at runtime. I worked
>> >> > > around
>> >> > it
>> >> > > by obtaining that from the package instead [1]:
>> >> > >
>> >> > > return
>> SomeHvClass.class.getPackage().getImplementationVersion();
>> >> >
>> >> > Right, that looks a lot like
>> >> > -
>> >> >
>> >> >
>> https://github.com/hibernate/hibernate-search/commit/fde388e9fd822abf877e56ab4147ac95c9fffd51
>> >> > ;)
>> >> >
>> >> > >
>> >> > > If that's all what the injection plug-in is used for in ORM as well
>> >> > > (and
>> >> > you
>> >> > > don't depend on that version info e.g. during testing in the IDE,
>> >> > > where
>> >> > > there is no JAR manifest yet which is the source of the version
>> with
>> >> > > that
>> >> > > approach), you could do the same there.
>> >> > >
>> >> > > --Gunnar
>> >> > >
>> >> > > [1]
>> >> > >
>> >> >
>> >> >
>> https://github.com/hibernate/hibernate-validator/commit/8a0eb0bfbc7610ea6fc9962eef024a98c3f9468c#diff-963bab11ed76f80c4a804903ed66e03fR34
>> >> > >
>> >> > >
>> >> > > 2016-06-12 22:18 GMT+02:00 Sanne Grinovero <sanne at hibernate.org>:
>> >> > >>
>> >> > >> Some more progress by simply setting this environment variable:
>> >> > >>
>> >> > >>
>> >> >
>> >> >
>> GRADLE_OPTS="-XaddExports:java.security.sasl/com.sun.security.sasl.digest=ALL-UNNAMED
>> >> > >> -XaddExports:java.security.sasl/com.sun.security.sasl=ALL-UNNAMED
>> >> > >> -XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
>> >> > >> -XaddExports:jdk.unsupported/sun.reflect=ALL-UNNAMED -addmods
>> >> > >> java.xml.bind"
>> >> > >>
>> >> > >> But it's getting tricky:
>> >> > >>
>> >> > >> Caused by: compile error: javassist.NotFoundException:
>> >> > >> java.lang.String
>> >> > >> at javassist.compiler.Javac.compileBody(Javac.java:229)
>> >> > >> at javassist.CtBehavior.setBody(CtBehavior.java:438)
>> >> > >> ... 76 more
>> >> > >>
>> >> > >> This seems to be caused by the following plugin, which I'm not
>> >> > >> familiar
>> >> > >> with:
>> >> > >> -
>> >> > >>
>> >> >
>> >> >
>> org.hibernate.build.gradle.inject.InjectionAction.execute(InjectionAction.java:62)
>> >> > >> Is this something which we could disable/skip/remove for now, or
>> >> > >> update to not require Javassist?
>> >> > >>
>> >> > >> Thanks,
>> >> > >> sanne
>> >> > >>
>> >> > >> On 12 June 2016 at 20:56, Sanne Grinovero <sanne at hibernate.org>
>> >> > >> wrote:
>> >> > >> > On 11 June 2016 at 18:47, Sanne Grinovero <sanne at hibernate.org>
>> >> > wrote:
>> >> > >> >> On 11 June 2016 at 18:25, Steve Ebersole <steve at hibernate.org>
>> >> > wrote:
>> >> > >> >>> The ORM failure seems to be a Gradle/JDK9 issue. Any idea
>> about
>> >> > that?
>> >> > >> >>
>> >> > >> >> Not sure, that's a new one :)
>> >> > >> >> It could be related to
>> >> > >> >> https://issues.gradle.org/browse/GRADLE-3287
>> >> > ?
>> >> > >> >>
>> >> > >> >> Might be worth trying to upgrade to Gradle 2.12 .. I'm not at a
>> >> > >> >> terminal at the moment, I could try later.
>> >> > >> >
>> >> > >> > I've upgraded to Gradle 2.13, the pull request is here:
>> >> > >> > - https://github.com/hibernate/hibernate-orm/pull/1417#
>> >> > >> >
>> >> > >> > It solved that specific issue, but it's not enough. I'm still
>> >> > >> > trying
>> >> > >> > to hack a workaround for the next step, but in the meantime
>> that PR
>> >> > >> > could be considered independently.
>> >> > >> >
>> >> > >> > I could use some pointers with Gradle and the custom plugins we
>> >> > >> > use;
>> >> > >> > essentially we need to pass some additional JVM flags,
>> including to
>> >> > >> > javac, like here:
>> >> > >> > -
>> >> > >> >
>> >> >
>> >> >
>> https://github.com/hibernate/hibernate-orm/commit/5e6a8ea754e3c4c59925fe7f824092490efc008b
>> >> > >> >
>> >> > >> > But the failure happens during:
>> >> > >> > Execution failed for task ':hibernate-core:xjc'
>> >> > >> >
>> >> > >> > and I'm not sure how to override the JVM flags for that plugin
>> >> > >> > execution.
>> >> > >> >
>> >> > >> > Thanks,
>> >> > >> > Sanne
>> >> > >> >
>> >> > >> >
>> >> > >> >>
>> >> > >> >>>
>> >> > >> >>> On Fri, Jun 10, 2016, 4:39 PM Sanne Grinovero
>> >> > >> >>> <sanne at hibernate.org>
>> >> > >> >>> wrote:
>> >> > >> >>>>
>> >> > >> >>>> Hi all,
>> >> > >> >>>> please try to have a look at this page when you have a
>> moment:
>> >> > >> >>>> - http://ci.hibernate.org/view/JDK9/
>> >> > >> >>>>
>> >> > >> >>>> Hibernate Search is working, and it shouldn't be too hard to
>> get
>> >> > the
>> >> > >> >>>> others "green" as well.
>> >> > >> >>>>
>> >> > >> >>>> I've disabled some integration tests to get there, notably:
>> >> > >> >>>> - OSGi tests: Karaf is not ready for it.
>> >> > >> >>>> - Documentation build: Asciidoc will probably need an
>> update.
>> >> > >> >>>> - WildFly integration tests: the WildFly team is aware, will
>> >> > >> >>>> need
>> >> > a
>> >> > >> >>>> minor upgrade.
>> >> > >> >>>>
>> >> > >> >>>> I don't believe these issues are relevant, so I'm satisfied
>> that
>> >> > all
>> >> > >> >>>> other tests working fine mean that the project will pretty
>> much
>> >> > work
>> >> > >> >>>> out of the box for end users - at worst their container won't
>> >> > >> >>>> work,
>> >> > >> >>>> but that's not our responsibility to test for.
>> >> > >> >>>>
>> >> > >> >>>> Could you all contribute a bit to get all projects show
>> "green"
>> >> > >> >>>> on
>> >> > >> >>>> this
>> >> > >> >>>> page?
>> >> > >> >>>>
>> >> > >> >>>> Some "workarounds" you might want to apply:
>> >> > >> >>>> - the Logger interfaces won't compile because of a known
>> issue,
>> >> > this
>> >> > >> >>>> can be worked around for now by having the compilation phase
>> >> > >> >>>> also
>> >> > >> >>>> explicitly depend on this artifact:
>> >> > >> >>>>
>> >> > >> >>>>
>> >> > >> >>>>
>> >> >
>> >> >
>> https://github.com/hibernate/hibernate-search/blob/master/pom.xml#L878-L883
>> >> > >> >>>> - you'll have a ClassNotFoundException on JAXB usage unless
>> you
>> >> > set
>> >> > >> >>>> this JVM flag:
>> >> > >> >>>>
>> >> > >> >>>>
>> >> >
>> https://github.com/hibernate/hibernate-search/blob/master/pom.xml#L1429
>> >> > >> >>>> (This one is not a bug but will be required to be set by end
>> >> > >> >>>> users
>> >> > as
>> >> > >> >>>> well - or we provide our own XML parser, that might be more
>> user
>> >> > >> >>>> friendly).
>> >> > >> >>>>
>> >> > >> >>>> As far as I know, other issues with the build tools have been
>> >> > solved
>> >> > >> >>>> already - including Gradle.
>> >> > >> >>>>
>> >> > >> >>>> Thanks,
>> >> > >> >>>> Sanne
>> >> > >> >>>> _______________________________________________
>> >> > >> >>>> hibernate-dev mailing list
>> >> > >> >>>> hibernate-dev at lists.jboss.org
>> >> > >> >>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>> >> > >> _______________________________________________
>> >> > >> hibernate-dev mailing list
>> >> > >> hibernate-dev at lists.jboss.org
>> >> > >> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>> >> > >
>> >> > >
>> >> >
>> >> _______________________________________________
>> >> hibernate-dev mailing list
>> >> hibernate-dev at lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>
More information about the hibernate-dev
mailing list