This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 269523 - InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.findLoadedClass accessible: module java.base does not "opens java.lang" to unnamed module
Summary: InaccessibleObjectException: Unable to make protected final java.lang.Class j...
Status: RESOLVED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Engine (show other bugs)
Version: 8.2
Hardware: All All
: P2 normal (vote)
Assignee: Tomas Hurka
URL:
Keywords: JDK_9, VISUALVM
Depends on:
Blocks:
 
Reported: 2017-01-10 13:25 UTC by Tomas Zezula
Modified: 2017-01-14 03:05 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2017-01-10 13:25:05 UTC
java.base does not open java.lang.

java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) accessible: module java.base does not "opens java.lang" to unnamed module @1324409e
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:207)
	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:192)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:186)
	at org.netbeans.lib.profiler.server.ClassLoaderManager.initialize(ClassLoaderManager.java:343)
	at org.netbeans.lib.profiler.server.ProfilerInterface.initProfilerInterface(ProfilerInterface.java:563)
	at org.netbeans.lib.profiler.server.ProfilerServer.initSupportingFunctionality(ProfilerServer.java:985)
	at org.netbeans.lib.profiler.server.ProfilerServer.doActivate(ProfilerServer.java:919)
	at org.netbeans.lib.profiler.server.ProfilerServer.activate(ProfilerServer.java:523)


Steps to reproduce:
1) Add JDK9b150+
2) Create j2se project
3) Set project platform to JDK9b150
4) Set project source level to 9
5) Profile file
Comment 1 Tomas Zezula 2017-01-10 13:48:56 UTC
One of possibilities:
https://gist.github.com/raphw/0652ef2277e8e4027bc712c464cbc18d
Comment 2 Tomas Zezula 2017-01-10 16:50:22 UTC
The solution in comment #1 does not work in b150 unless you use -noverify which is no option.
Comment 3 Tomas Hurka 2017-01-12 12:54:22 UTC
Profiled application must run on JDK 9.
Comment 4 Tomas Hurka 2017-01-13 14:12:33 UTC
Fixed in profiler-main

changeset:   302157:98dab56fe957
user:        Tomas Hurka <thurka@netbeans.org>
date:        Fri Jan 13 14:27:50 2017 +0100
summary:     bugfix #269523, make sure ClassLoaderManager works even if it is not able to acccess ClassLoader.findLoadedClass() and/or ClassLoader.findBootstrapClass()
Comment 5 Quality Engineering 2017-01-14 03:05:19 UTC
Integrated into 'main-silver', will be available in build *201701140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/98dab56fe957
User: Tomas Hurka <thurka@netbeans.org>
Log: bugfix #269523, make sure ClassLoaderManager works even if it is not able to acccess ClassLoader.findLoadedClass() and/or ClassLoader.findBootstrapClass()