jdk 9 reflection problem

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

jdk 9 reflection problem

Michael Musgrove
We have just upgraded our jdk build to 9-ea+149 which has tightened up the accessibility rules. The recommendation seems to be to use the --add-opens flag to override the rules.

I tried export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED" which made no difference. Our jdk 9 FAQ does not provided any hints either.

Can anyone provide advice on how to resolve the following maven build error:


[WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
  at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
  while locating org.apache.maven.plugins.war.WarMojo

...

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed m
odule @669f2128
        at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
        at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
        at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
        at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)


--
Michael Musgrove
Transactions Team
t: +44 191 243 0870

Our mission:To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way. 

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jdk 9 reflection problem

Tomaž Cerar-2
Yeah we need to update FAQ with the latest changes around this.

it is not M2_OPTS that you need to set but in most cases surefire args as you need this as part of test runtime not maven runtime.
but --add-opens is the flag you are properly using for this case.
It in most cases replaces need for --add-exports flags

I would also recommend adding -Dsun.reflect.debugModuleAccessChecks=true flag that should help you with reflection issues.

What is your use case exactly? building a war?
Maybe link to project / pom.xml that has this issue?

--
tomaz

On Thu, Jan 5, 2017 at 1:04 PM, Michael Musgrove <[hidden email]> wrote:
We have just upgraded our jdk build to 9-ea+149 which has tightened up the accessibility rules. The recommendation seems to be to use the --add-opens flag to override the rules.

I tried export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED" which made no difference. Our jdk 9 FAQ does not provided any hints either.

Can anyone provide advice on how to resolve the following maven build error:


[WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
  at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
  while locating org.apache.maven.plugins.war.WarMojo

...

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed m
odule @669f2128
        at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
        at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
        at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
        at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)


--
Michael Musgrove
Transactions Team
t: <a href="tel:+44%20191%20243%200870" value="+441912430870" target="_blank">+44 191 243 0870

Our mission:To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way. 

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jdk 9 reflection problem

Amos Feng
In reply to this post by Michael Musgrove
Hi Mike,

I had tried MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED" and it works.

Amos

----- Original Message -----
From: "Michael Musgrove" <[hidden email]>
To: "WildFly Dev" <[hidden email]>
Sent: Thursday, January 5, 2017 8:04:09 PM
Subject: [wildfly-dev] jdk 9 reflection problem

We have just upgraded our jdk build to 9-ea+149 which has tightened up the accessibility rules. The recommendation seems to be to use the --add-opens flag to override the rules.

I tried export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED" which made no difference. Our jdk 9 FAQ does not provided any hints either.

Can anyone provide advice on how to resolve the following maven build error:


[WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
while locating org.apache.maven.plugins.war.WarMojo

...

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed m
odule @669f2128
at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)


--
Michael Musgrove
Transactions Team
e: [hidden email]
t: +44 191 243 0870

Our mission:To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way.

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jdk 9 reflection problem

Amos Feng
Also it looks like a maven-war-plugin issue https://issues.apache.org/jira/browse/MWAR-397

----- Original Message -----
From: "Amos Feng" <[hidden email]>
To: "Michael Musgrove" <[hidden email]>
Cc: "WildFly Dev" <[hidden email]>
Sent: Thursday, January 5, 2017 10:01:57 PM
Subject: Re: [wildfly-dev] jdk 9 reflection problem

Hi Mike,

I had tried MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED" and it works.

Amos

----- Original Message -----
From: "Michael Musgrove" <[hidden email]>
To: "WildFly Dev" <[hidden email]>
Sent: Thursday, January 5, 2017 8:04:09 PM
Subject: [wildfly-dev] jdk 9 reflection problem

We have just upgraded our jdk build to 9-ea+149 which has tightened up the accessibility rules. The recommendation seems to be to use the --add-opens flag to override the rules.

I tried export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED" which made no difference. Our jdk 9 FAQ does not provided any hints either.

Can anyone provide advice on how to resolve the following maven build error:


[WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
while locating org.apache.maven.plugins.war.WarMojo

...

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed m
odule @669f2128
at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)


--
Michael Musgrove
Transactions Team
e: [hidden email]
t: +44 191 243 0870

Our mission:To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way.

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jdk 9 reflection problem

Michael Musgrove
In reply to this post by Amos Feng
Ah yes it works when I include  java.desktop/java.awt.font

Thanks, but how did you figure out it wanted this one as well?

On Thu, Jan 5, 2017 at 2:01 PM, Amos Feng <[hidden email]> wrote:
Hi Mike,

I had tried MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED" and it works.

Amos

----- Original Message -----
From: "Michael Musgrove" <[hidden email]>
To: "WildFly Dev" <[hidden email]>
Sent: Thursday, January 5, 2017 8:04:09 PM
Subject: [wildfly-dev] jdk 9 reflection problem

We have just upgraded our jdk build to 9-ea+149 which has tightened up the accessibility rules. The recommendation seems to be to use the --add-opens flag to override the rules.

I tried export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED" which made no difference. Our jdk 9 FAQ does not provided any hints either.

Can anyone provide advice on how to resolve the following maven build error:


[WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
while locating org.apache.maven.plugins.war.WarMojo

...

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed m
odule @669f2128
at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)


--
Michael Musgrove
Transactions Team
e: [hidden email]
t: <a href="tel:%2B44%20191%20243%200870" value="+441912430870">+44 191 243 0870

Our mission:To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way.

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev



--
Michael Musgrove
Transactions Team
t: +44 191 243 0870

Our mission:To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way. 

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jdk 9 reflection problem

Eduardo Sant´Ana da Silva
In reply to this post by Michael Musgrove

I found this, that could help:


com.thoughtworks.xstreamxstream  

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module

Happens while initializing org.apache.maven.plugins.war.util.WebappStructureSerializer
maven-war-plugin



2017-01-05 10:04 GMT-02:00 Michael Musgrove <[hidden email]>:
We have just upgraded our jdk build to 9-ea+149 which has tightened up the accessibility rules. The recommendation seems to be to use the --add-opens flag to override the rules.

I tried export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED" which made no difference. Our jdk 9 FAQ does not provided any hints either.

Can anyone provide advice on how to resolve the following maven build error:


[WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
  at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
  while locating org.apache.maven.plugins.war.WarMojo

...

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed m
odule @669f2128
        at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
        at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
        at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
        at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)


--
Michael Musgrove
Transactions Team
t: <a href="tel:+44%20191%20243%200870" value="+441912430870" target="_blank">+44 191 243 0870

Our mission:To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way. 

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev



--
___________________________
Eduardo Sant'Ana da Silva - Ph.D.
Researcher / IT Consultant


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jdk 9 reflection problem

Eduardo Sant´Ana da Silva
In reply to this post by Amos Feng
The Amos´s solution is the same related here: 

....

... the correct fix is to launch the JVM as follows:

# --add-opens has the following syntax: {A}/{package}={B}
java --add-opens java.base/java.lang=ALL-UNNAMED  <<<<<<<<<<<<<<<<<<<<<<<<



2017-01-05 12:01 GMT-02:00 Amos Feng <[hidden email]>:
Hi Mike,

I had tried MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED" and it works.

Amos

----- Original Message -----
From: "Michael Musgrove" <[hidden email]>
To: "WildFly Dev" <[hidden email]>
Sent: Thursday, January 5, 2017 8:04:09 PM
Subject: [wildfly-dev] jdk 9 reflection problem

We have just upgraded our jdk build to 9-ea+149 which has tightened up the accessibility rules. The recommendation seems to be to use the --add-opens flag to override the rules.

I tried export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED" which made no difference. Our jdk 9 FAQ does not provided any hints either.

Can anyone provide advice on how to resolve the following maven build error:


[WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.ExceptionInInitializerError
at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
while locating org.apache.maven.plugins.war.WarMojo

...

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed m
odule @669f2128
at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)


--
Michael Musgrove
Transactions Team
e: [hidden email]
t: <a href="tel:%2B44%20191%20243%200870" value="+441912430870">+44 191 243 0870

Our mission:To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way.

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev



--
___________________________
Eduardo Sant'Ana da Silva - Ph.D.
Researcher / IT Consultant


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jdk 9 reflection problem

David M. Lloyd
In reply to this post by Michael Musgrove
I guess the obvious suggestion is, report a bug to XStream and tell them
to use the comparator() method on TreeMap instead of poking the field.

Reflecting on JDK classes is going to become pretty hard in Java 9
without using Unsafe.

On 01/05/2017 06:04 AM, Michael Musgrove wrote:

> We have just upgraded our jdk build to 9-ea+149 which has tightened up
> the accessibility rules. The recommendation seems to be to use the
> --add-opens flag to override the rules.
>
> I tried export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED"
> which made no difference. Our jdk 9 FAQ does not provided any hints either.
>
> Can anyone provide advice on how to resolve the following maven build error:
>
>
> [WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo
> com.google.inject.ProvisionException: Unable to provision, see the
> following errors:
>
> 1) Error injecting constructor, java.lang.ExceptionInInitializerError
>   at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
>   while locating org.apache.maven.plugins.war.WarMojo
>
> ...
>
> Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
> field private final java.util.Comparator java.util.TreeMap.comparator
> accessible: module java.base does not "opens java.util" to unnamed m
> odule @669f2128
>         at
> java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
>         at
> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
>         at
> java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
>         at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
>         at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
>         at
> com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)
>
>
> --
> Michael Musgrove
> Transactions Team
> e: [hidden email] <mailto:[hidden email]>
> t: +44 191 243 0870
>
> Our mission:To be the catalyst in communities of customers,
> contributors, and partners creating better technology the open source way.
>
> Registered in England and Wales under Company Registration No. 03798903
> Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
> (US), Charles Peters (US)
>
> Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael
> O'Neill(Ireland)
>
>
> _______________________________________________
> wildfly-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>

--
- DML
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jdk 9 reflection problem

Michael Musgrove
Good suggestion David. I have raised the issue with XStream (https://groups.google.com/forum/#!topic/xstream-user/sOHazgzxU2o)

On Fri, Jan 6, 2017 at 4:58 PM, David M. Lloyd <[hidden email]> wrote:
I guess the obvious suggestion is, report a bug to XStream and tell them
to use the comparator() method on TreeMap instead of poking the field.

Reflecting on JDK classes is going to become pretty hard in Java 9
without using Unsafe.

On 01/05/2017 06:04 AM, Michael Musgrove wrote:
> We have just upgraded our jdk build to 9-ea+149 which has tightened up
> the accessibility rules. The recommendation seems to be to use the
> --add-opens flag to override the rules.
>
> I tried export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED"
> which made no difference. Our jdk 9 FAQ does not provided any hints either.
>
> Can anyone provide advice on how to resolve the following maven build error:
>
>
> [WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo
> com.google.inject.ProvisionException: Unable to provision, see the
> following errors:
>
> 1) Error injecting constructor, java.lang.ExceptionInInitializerError
>   at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)
>   while locating org.apache.maven.plugins.war.WarMojo
>
> ...
>
> Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
> field private final java.util.Comparator java.util.TreeMap.comparator
> accessible: module java.base does not "opens java.util" to unnamed m
> odule @669f2128
>         at
> java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
>         at
> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
>         at
> java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
>         at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
>         at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
>         at
> com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)
>
>
> --
> Michael Musgrove
> Transactions Team
> e: [hidden email] <mailto:[hidden email]>
> t: <a href="tel:%2B44%20191%20243%200870" value="+441912430870">+44 191 243 0870
>
> Our mission:To be the catalyst in communities of customers,
> contributors, and partners creating better technology the open source way.
>
> Registered in England and Wales under Company Registration No. 03798903
> Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
> (US), Charles Peters (US)
>
> Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael
> O'Neill(Ireland)
>
>
> _______________________________________________
> wildfly-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>

--
- DML
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev



--
Michael Musgrove
Transactions Team
t: +44 191 243 0870

Our mission:To be the catalyst in communities of customers, contributors, and partners creating better technology the open source way. 

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael O'Neill(Ireland)

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Loading...