JDK9 Modules
Stephen Felts
stephen.felts at oracle.com
Tue Jul 5 20:54:54 UTC 2016
Add -Djdk.launcher.addexports.0=java.base/sun.nio.ch=ALL-UNNAMED to _JAVA_OPTIONS.
Also, kill the daemon before running.
-----Original Message-----
From: Malachi de Ælfweald [mailto:malachid at gmail.com]
Sent: Tuesday, July 05, 2016 4:50 PM
To: Alan Bateman
Cc: jigsaw-dev at openjdk.java.net
Subject: Re: JDK9 Modules
Regarding the Neo4j one, I tried adding
'-XaddExports:java.base/sun.nio.ch=ALL-UNNAMED'
to both build.gradle and jdk9args, but it still says:
Caused by: java.lang.IllegalAccessError: class org.neo4j.io.pagecache.impl.SingleFilePageSwapper (in unnamed module
@0x49070868) cannot access class sun.nio.ch.FileChannelImpl (in module
java.base) because module java.base does not export sun.nio.ch to unnamed module @0x49070868
Malachi de Ælfweald
http://www.google.com/profiles/malachid
On Tue, Jul 5, 2016 at 1:21 AM, Malachi de Ælfweald <malachid at gmail.com>
wrote:
> Hi Alan,
>
>
> On Tue, Jul 5, 2016 at 1:03 AM, Alan Bateman <Alan.Bateman at oracle.com>
> wrote:
>
>> On 05/07/2016 08:00, Malachi de Ælfweald wrote:
>>
>> :
>>>
>>> Neo4j fails due to internal Sun classes being used:
>>> cannot access class sun.nio.ch.FileChannelImpl (in module java.base)
>>> because module java.base does not export sun.nio.ch to unnamed
>>> module @0x6166e06f
>>>
>> In this case then I assume the exception has more detail to explain this.
>> This may be a case where a bug needs to be submitted to Neo4j so that
>> the maintainers look at this usage. In the mean-time, then the
>> -XaddExports option can be used a workaround to keep existing versions working as before.
>>
>
> I did submit a bugreport to them with their debug log.
> You are correct - the full error message was:
> Exception occurred while setting up store modules. Attempting to close
> things down. class org.neo4j.io.pagecache.impl.SingleFilePageSwapper
> (in unnamed module @0x6166e06f) cannot access class
> sun.nio.ch.FileChannelImpl (in module java.base) because module
> java.base does not export sun.nio.ch to unnamed module @0x6166e06f
> java.lang.IllegalAccessError: class
> org.neo4j.io.pagecache.impl.SingleFilePageSwapper (in unnamed module
> @0x6166e06f) cannot access class sun.nio.ch.FileChannelImpl (in module
> java.base) because module java.base does not export sun.nio.ch to
> unnamed module @0x6166e06f (with a stack trace of course)
>
> Is there documentation on how to properly use the -XaddExports? Is it
> something like:
> -XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
>
>
>
>>
>>
>>> Dagger fails due to the @Generated:
>>> NoClassDefFoundError: javax/annotation/Generated
>>>
>>> :
>>>
>>> For the Dagger case, I know it is accepting the '-addmods' argument,
>>> because it gives an error if I use '-J-addmods'. I also know that
>>> it is accepting "java.annotations.common" because if I change it to
>>> javax, it gives an error. But it still can't find the class. I've
>>> also tried ALL-SYSTEM and ALL-UNNAMED.
>>>
>>> Is this the Dagger annotation processor? In that case then you might
>> need `-J-addmods -Jjava.annotations.common` (getting the command line
>> right when there is white space is awkward but we have an update
>> coming that will make this easier).
>
>
> It is the Google version of the Dagger apt processor. I did see that
> suggestion in one of the bugreports. With the -J-addmods, it complains
> about the option not existing (it doesn't with -addmods). With the
> -Jjava.annotations.common, it complains that the module can't be found.
> Without the -J it just fails to find the annotation.
>
>
>
>
>>
>>
>> -Alan
>>
>
>
More information about the jigsaw-dev
mailing list