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 166968 - Debugger throws error on startup: Cannot load this JVM TI agent twice
Summary: Debugger throws error on startup: Cannot load this JVM TI agent twice
Status: REOPENED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.0.1
Hardware: PC Linux
: P3 blocker with 2 votes (vote)
Assignee: Martin Entlicher
URL:
Keywords:
: 200216 (view as bug list)
Depends on:
Blocks: 200216
  Show dependency tree
 
Reported: 2009-06-12 09:04 UTC by werpu
Modified: 2012-10-30 10:37 UTC (History)
4 users (show)

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 werpu 2009-06-12 09:04:08 UTC
Hello, I have following setup, osx running on apples jdk6, a maven multi project with a testcase in one of the
subprojects. The setupt itself runs fine if I start it normally, so does the TestCase if I run it.
However if I run it from the debugger with Debug Testfile I get following error:

Error occurred during initialization of VM
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
agent library failed to init: jdwp
Java Result: 134

This used to work on 6.5 and as far as I recall earlier 6.7 builds, the current release I use is 6.7 RC2 the all in one
bundle!
Comment 1 Milos Kleint 2009-06-12 09:15:14 UTC
have you modified the debug test action mapping? (easiest way to figure is to check the ${basedir}/nbactions.xml file -
please attach it to the issue)
Comment 2 Martin Entlicher 2009-06-12 09:20:33 UTC
BTW: Milos, how do we turn on verbose output of Maven so that we see what it executes? I mean an equivalent of
"Verbosity Level" in Ant.
Comment 3 Milos Kleint 2009-06-12 09:29:41 UTC
Tools/Option/Misc/Maven has a Debug output checkbox, however I think it will *not* print the java -jar line it executes.
I think it's filed as issue against the exec-maven-plugin. However the first few lines of maven build output that print
out what params is the build executed with shall be sufficient
Comment 4 werpu 2009-06-12 09:33:20 UTC
Actually the nbactions.xml file in my case is empty, 
the nbconfigurations file has following entries:

<project-shared-configuration>
  <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
  <netbeans.compile.on.save>all</netbeans.compile.on.save>
      <netbeans.hint.jdkPlatform>JDK_1.6</netbeans.hint.jdkPlatform>
  </properties>
</project-shared-configuration>
Comment 5 Milos Kleint 2009-06-12 09:36:59 UTC
I see.

mentlicher: in this case the execution is probably performed by ant (via the JavaRunner/CompileOnSave execution)
Comment 6 werpu 2009-06-12 10:26:31 UTC
Ok some additional info, in my command line MAVEN_OPTS I had a debugging port open. I changed that now by removing all MAVN_OPTS restarted Netbeans 
after veryfying the MAVEN_OPTS are blank now, from the command line, but that did not lead to any signifcant change, Netbeans still throws the error.
I also had all Nebeans related files deleted from the filesystem and reimported the project.
Same result! Did not help, what might be is that Netbeans has been importing the settings somewhere and triggering it although the command line itself
does not show it anymore!


Comment 7 Milos Kleint 2009-06-12 10:31:33 UTC
on mac the env vars for applications invoked from GUI are not exactly the same as env vars in console. you might need to
restart the computer and make sure the gui invoked stuff doesn't have the MAVEN_OPTS var defined.
Comment 8 werpu 2009-06-12 10:49:52 UTC
Ok I have restarted as well, the  maven jwpd settings definitely are gone, the problem still persists.

Comment 9 Martin Entlicher 2009-11-16 06:46:31 UTC
In 6.8 dev build 200911160201 it works fine for me.
On Mac (with JDK 1.5) I've created Maven project (Maven Quickstart Archetype) and verified that both "Debug File" and "Debug Test File" works correctly.

Please verify in 6.8 build.
Comment 10 keithbrown 2009-12-21 16:37:21 UTC
I am having the exact same issue under Windows XP.  I have experienced the same issues with 6.7, I have done most of my recent work with 6.5 because it works there.

While I haven't explored an exact recipe, it seems to occur when I have the following open.

1. Create a maven POM project.
2. Create another maven project using the initial project as the root folder.
(In my case I am importing existing projects but this should be the same.)
Comment 11 Martin Entlicher 2009-12-22 09:39:05 UTC
Can you please try this in NetBeans 6.8? It worked fine for me there...
Comment 12 keithbrown 2009-12-22 09:40:54 UTC
Sorry, I should have mentioned that I was using 6.8.
Comment 13 Martin Entlicher 2009-12-22 09:49:22 UTC
O.K. I'll check again in NB 6.8 under Windows.
Comment 14 jfelfouly 2010-01-12 02:04:37 UTC
I've got this problem too (6.8 FCS, Windows XP)
Comment 15 kramachandran 2010-02-24 12:36:09 UTC
I'm running across the same issue. I'm running Netbeans 6.8 with JDK 1.6.18 on OSX. 

The exact error is : 
Have no FileObject for /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jsfd.jar
Have no FileObject for /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/sunrsasign.jar
Error occurred during initialization of VM
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
agent library failed to init: jdwp
Java Result: 1
Comment 16 kramachandran 2010-02-24 12:37:10 UTC
By the way I'm working with the Spring-WS code base.
Comment 17 hohonuuli 2010-04-15 20:46:05 UTC
I have the same problem. I'm using Mac OS X 10.6.3 and Netbeans 6.8 and Java:

java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)

The error message when I try to debug a unit test (in a Maven project) is:

Have no FileObject for /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jsfd.jar
Have no FileObject for /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/sunrsasign.jar
ERROR: transport error 202: connect failed: Operation timed out
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
Java Result: 134
debug-test:
BUILD SUCCESSFUL (total time: 1 minute 20 seconds)
Comment 18 tvaughan 2010-05-19 17:29:50 UTC
This is happening in my environment too.

Netbeans 6.8
Ubuntu 9.04
Java openjdk 1.6.0_0

Maven-based project without any subprojects.

Putting a break point in a Junit 4.3.1 test and running "Debug --> Debug Test File" results in Output window errors:

Have no FileObject for /usr/lib/jvm/java-6-openjdk/jre/lib/sunrsasign.jar
Have no FileObject for /usr/lib/jvm/java-6-openjdk/jre/classes
Error occurred during initialization of VM
agent library failed to init: jdwp
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Java Result: 1
debug-test:
BUILD SUCCESSFUL (total time: 6 seconds)
Comment 19 Martin Entlicher 2010-11-10 15:13:51 UTC
This works fine for me in NetBeans 7.0, therefore it seems to be already fixed.
Please verify.
Comment 20 yoosiba 2011-06-30 09:48:53 UTC
Actually, I am experiencing the same issue. Additionally if I change forkMode property in Actions before every execution, debugging works.



Flow:
1) Debug test -> crash ('Cannot load this JVM TI agent twice')
2) change in action mapping forkMode='never'
3) debug test -> whole test package is executed, but debugger is not attached
4) change in action mapping forkMode='once'
5) Debug test -> works ok, test are started, debugger is attached, I can debug test


It is pain to change settings back and forth before each debugging. Additionally waiting for whole package to execute in step 3... :/


My Env:
Product Version: NetBeans IDE Dev (Build 201106260600)
Java: 1.6.0_23; Java HotSpot(TM) Client VM 19.0-b09
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)


My Action Mapping:
jpda.listen=true
maven.failsafe.debug=-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}
forkMode=once
test=${packageClassName}
Comment 21 Martin Entlicher 2011-07-19 12:04:24 UTC
*** Bug 200216 has been marked as a duplicate of this bug. ***
Comment 22 Martin Entlicher 2011-07-19 12:05:57 UTC
Thanks for your findings regarding forkMode.
Comment 23 hefest 2011-10-18 21:53:45 UTC
I have the same problem with NB7.0 running on Ubuntu 10.10 and the following:

$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)

$ mvn -version
Apache Maven 2.2.1 (rdebian-4)
Java version: 1.6.0_20
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.35-28-generic-pae" arch: "i386" Family: "unix
Comment 24 mdm42 2012-04-03 12:53:36 UTC
Confirmed on Linux (Ubuntu 10.10) JDK 1.6.0_26, attempting to debug with JBoss-5.1.0. Serverplugins seems the more appropriate component than debugger...
Comment 25 robski 2012-10-30 10:37:11 UTC
Just a quick fix for this for those who have stumbled upon this when looking for a solution to the issue.

This appears to work for Win XP and 7, and for NetBeans 6.8 and 7.0.1:

Open the Project Properties for the test.
Go to 'Actions'
Select the 'Debug test' entry.
In the 'Set properties' you need to remove the 
-Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}
option from the second line.

This results in:
jpda.listen=true
maven.surefire.debug=-Xdebug
forkMode=once
test=${packageClassName}

Click the OK button, save everything and restart Netbeans.
The restart may or may not be necessary - might depend on OS or precise Netbeans version.

Try again, should debug the maven project test OK.