trilogy
trilogy

Reputation: 1795

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)

Upvotes: 2

Views: 1188

Answers (3)

David Rochin
David Rochin

Reputation: 377

I was able to make it work by going to my nbactions.xml file and commenting out the profile action such as:

            ...
            <properties>
                <exec.vmArgs></exec.vmArgs>
                <exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
                <exec.mainClass>com.macnt.app.Aplicacion</exec.mainClass>
                <exec.executable>java</exec.executable>
                <exec.appArgs></exec.appArgs>
            </properties>
        </action>

        <!-- Commented out this -->
        <!--<action>
            <actionName>profile</actionName>
            <packagings>
                <packaging>jar</packaging>
            </packagings>
            <goals>
                <goal>process-classes</goal>
                <goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal>
            </goals>
            <properties>
                <exec.args>-classpath %classpath com.macnt.app.Aplicacion</exec.args>
                <exec.executable>java</exec.executable>
            </properties>
        </action>-->

    </actions>

Upvotes: 0

Asu
Asu

Reputation: 1843

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.

Upvotes: -1

user250343
user250343

Reputation: 1183

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.

Upvotes: 1

Related Questions