'Netbeans 12.6 and 13.0 SQL profiler no longer works for Java 8

I get this error stack when trying to SQL profile a Java 8 project which I don't get on 12.5 and below:

Profiler Agent: Established connection with the tool
Profiler Agent: Local accelerated session
Exception in thread "*** Profiler Agent Communication Thread" java.lang.NoSuchMethodError: java.nio.MappedByteBuffer.rewind()Ljava/nio/MappedByteBuffer;
    at org.netbeans.lib.profiler.server.EventBufferManager.openBufferFile(EventBufferManager.java:144)
    at org.netbeans.lib.profiler.server.ProfilerInterface.createEventBuffer(ProfilerInterface.java:682)
    at org.netbeans.lib.profiler.server.ProfilerInterface.initiateProfiling(ProfilerInterface.java:615)
    at org.netbeans.lib.profiler.server.ProfilerServer.handleClientCommand(ProfilerServer.java:1398)
    at org.netbeans.lib.profiler.server.ProfilerServer.listenToClient(ProfilerServer.java:1753)
    at org.netbeans.lib.profiler.server.ProfilerServer.run(ProfilerServer.java:676)


Solution 1:[1]

I had the same problem. Could not solve it with the answers supplied in comments here. The solution is to review the file nbactions.xml, preferably going back to a copy from a new project. My one perhaps got slightly corrupted by switching between different Java platforms.

Solution 2:[2]

In my case I have project written in Java 8 that is run in production with Java 8, and I used Netbeans 13 to profile it.

To run Netbeans 13, I have Java 17 on the machine. The project is configured as Source/binary format: 1.8 in properties>sources; and Java platform JDK 1.8 in properties>build>compile.

I was getting the same error about NoSuchMethodError in MappedByteBuffer.rewind() until I changed properties>build>compile to JDK 17.

I then was able to avoid this error.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user250343
Solution 2 Asu