Closed ThomasRSkinner closed 4 years ago
Can you try again running your JavaFX app with this: --add-modules java.instrument
?
OpenJ9 seems to have the module, but maybe it is not available unless explicitly included.
Hi Jose Tried it - no difference. Also tried using Hotspot - no difference.
Regards Tom
On Dec 31 2018, at 8:23 pm, José Pereda notifications@github.com wrote:
Can you try again running your JavaFX app with this: --add-modules java.instrument? OpenJ9 seems to have the module, but maybe it is not available unless explicitly included.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub (https://link.getmailspring.com/link/1546341819.local-7f16f5a9-f1b6-v1.5.4-1d923cf4@getmailspring.com/0?redirect=https%3A%2F%2Fgithub.com%2FJonathanGiles%2Fscenic-view%2Fissues%2F44%23issuecomment-450624160&recipient=cmVwbHkrMDI0Y2Y5MzlmYjhkMTU2YjZjNjAzMWZlMmM0MTIzMTg1YTZhMDY5NzQ1MjIwNjkwOTJjZjAwMDAwMDAxMTg0MWExZmI5MmExNjljZTE3OGEwMDhkQHJlcGx5LmdpdGh1Yi5jb20%3D), or mute the thread (https://link.getmailspring.com/link/1546341819.local-7f16f5a9-f1b6-v1.5.4-1d923cf4@getmailspring.com/1?redirect=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAkz5OWWRDcm-uUhVfgnYiLswUqANUuflks5u-dd7gaJpZM4ZlKNT&recipient=cmVwbHkrMDI0Y2Y5MzlmYjhkMTU2YjZjNjAzMWZlMmM0MTIzMTg1YTZhMDY5NzQ1MjIwNjkwOTJjZjAwMDAwMDAxMTg0MWExZmI5MmExNjljZTE3OGEwMDhkQHJlcGx5LmdpdGh1Yi5jb20%3D).
With Java 11 I had a similar problem with scenicview attaching to the running java 11 program.
Following jperedadnr's suggestion to make java.instrument
available I used the following command line VM option which fixed the problem: -
--add-opens
java.base/java.instrument=ALL-UNNAMED
When I try --add-opens java.base/java.instrument=ALL-UNNAMED it just gives me an additional warning WARNING: package java.instrument not in java.base and the same error as before.
I downloaded the source and build locally under Open JDK 11.0.1+13 and it runs, and detects my JavaFX app (shows data in the tree and the node details tab) but with the error java.io.IOException: Late attach connection to self disabled. Set jdk.attach.allowAttachSelf=true at jdk.attach/com.ibm.tools.attach.attacher.OpenJ9VirtualMachine.tryAttachTarget(OpenJ9VirtualMachine.java:403) at jdk.attach/com.ibm.tools.attach.attacher.OpenJ9VirtualMachine.attachTarget(OpenJ9VirtualMachine.java:121) at jdk.attach/com.ibm.tools.attach.attacher.OpenJ9AttachProvider.attachVirtualMachine(OpenJ9AttachProvider.java:84) at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:249) at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.getRunningJavaFXApplications(RemoteConnectorImpl.java:368) at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.connect(RemoteConnectorImpl.java:251) 0 JavaFX applications found at org.scenicview.scenicview/org.scenicview.model.update.RemoteVMsUpdateStrategy.getActiveApps(RemoteVMsUpdateStrategy.java:57) at org.scenicview.scenicview/org.scenicview.model.update.RemoteVMsUpdateStrategy.work(RemoteVMsUpdateStrategy.java:77) at org.scenicview.scenicview/org.fxconnector.helper.WorkerThread.run(WorkerThread.java:43)
Thomas,
That is quite strange as java.instrument is definitely in the java.base package Java 11 documentation for java.instrument.
Looking at the stack trace I am a bit suspicious about the line
at jdk.attach/com.ibm.tools.attach.attacher.OpenJ9AttachProvider.attachVirtualMachine(OpenJ9AttachProvider.java:84)
The name OpenJ9AttachProvider
suggests that it might be coming from a Java 9 VM. Equally I am also surprised that it is provided by IBM. Are you running scenicview or the program under test using an IBM Java 9 perhaps?
I don't have Java 9 on my machine.
The trace results from using jdk-11.0.1+13 AdoptOpenJDK https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=openj9
I have also used 11.0.1 ZuluFX zulu11.2.5-ca-fx-jdk11.0.1-win_x64 https://www.azul.com/downloads/zulu/zulufx/ which gives a different stack trace, but the same errors/warnings.
WARNING: package java.instrument not in java.base
Platform running
Launching ScenicView v11.0.1
Startup done
Creating server
Server done
Number of running Java applications found: 3
Error while obtaining properties for JVM:sun.tools.attach.AttachProviderImpl@552a8dd4: 944 org.scenicview.scenicview/org.scenicview.ScenicView
java.io.IOException: Can not attach to current VM
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.
I can see that scenic view is running under Java 11.01 but what counts is the program that you are trying to observe as IMHO that is the one that has to run the java.instrumentation.
If you don't have Java 9 installed then it seems that that is unlikely to be the problem. From the trace it looks like the program under test has not had the java.instrumentation module made available to it.
All my work is under OSGI and so I have not converted to using the Java module system and that is why I am using --add-opens java.base/java.instrument=ALL-UNNAMED.
If your program under test is using the Java module system then you probably need to add a dependency on java.instrumentation to the program. That way it will be available when scenicview tries to connect.
Sorry I cannot be of more help.
I have a similar issue: Spring Boot 2 application running in a tomcat container with docker (FROM tomcat:9-jre11). I get the following error:
Using regular expression provided through VM argument net.sf.ehcache.pool.sizeof.ignore.pattern for IgnoreSizeOf annotation : ^.*cache\..*IgnoreSizeOf$
Detected JVM data model settings of: 64-Bit OpenJDK JVM with Compressed OOPs and Concurrent Mark-and-Sweep GC
Failed to attach to VM and load the agent: class java.io.IOException: Can not attach to current VM
Any ideas?
Maybe this will help: I was getting same error on OpenJDK 11 trying to run jamm and did get it to work after adding -Djdk.attach.allowAttachSelf=true
Runs fine under Java 11.33.15 and 13.28.11
With Java 23, it helps to add --add-opens java.base/java.instrument=ALL-UNNAMED
to the "VM options" in IntelliJ
Running Windows 10 1809 OpenJdk jdk-11.0.1+13 OpenJ9
Output as follows - Platform running Launching ScenicView v11.0.1 Startup done Creating server Server done Number of running Java applications found: 2 Error while obtaining properties for JVM:sun.tools.attach.AttachProviderImpl@7ec6952e: 1552 org.scenicview.scenicview/org.scenicview.ScenicView java.io.IOException: Can not attach to current VM at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.(Unknown Source)
at jdk.attach/sun.tools.attach.VirtualMachineImpl.(Unknown Source)
at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(Unknown Source)
at jdk.attach/com.sun.tools.attach.spi.AttachProvider.attachVirtualMachine(Unknown Source)
at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(Unknown Source)
at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.getRunningJavaFXApplications(Unknown Source)
at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.connect(Unknown Source)
at org.scenicview.scenicview/org.scenicview.model.update.RemoteVMsUpdateStrategy.getActiveApps(Unknown Source)
at org.scenicview.scenicview/org.scenicview.model.update.RemoteVMsUpdateStrategy.work(Unknown Source)
at org.scenicview.scenicview/org.fxconnector.helper.WorkerThread.run(Unknown Source)
Obtaining properties for Java application with PID:13672
1 JavaFX applications found
Loading agent from: D:\scenicview\lib\scenicview.jar
Loading agent for:sun.tools.attach.AttachProviderImpl@7ec6952e: 13672 ID:13672 on port:7559 took:101ms using agent defined in D:\scenicview\lib\scenicview.jar
com.sun.tools.attach.AgentLoadException: Failed to load agent library: java.lang.module.FindException: Module java.instrument not found
at jdk.attach/sun.tools.attach.VirtualMachineImpl.execute(Unknown Source)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(Unknown Source)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(Unknown Source)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgent(Unknown Source)
at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.loadAgent(Unknown Source)
at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.access$200(Unknown Source)
at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl$3.run(Unknown Source)
com.sun.tools.attach.AgentLoadException: Failed to load agent library: java.lang.module.FindException: Module java.instrument not found
at jdk.attach/sun.tools.attach.VirtualMachineImpl.execute(Unknown Source)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(Unknown Source)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(Unknown Source)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgent(Unknown Source)
at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.loadAgent(Unknown Source)
at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.access$200(Unknown Source)
at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl$3.run(Unknown Source)