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 243467 - Rerun tests in Maven projects does not work, when tests were executed in debugging mode
Summary: Rerun tests in Maven projects does not work, when tests were executed in debu...
Status: REOPENED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-02 06:59 UTC by markiewb
Modified: 2017-01-09 16:03 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Shows output and running debug process (202.35 KB, image/png)
2014-04-02 06:59 UTC, markiewb
Details
fix (2.03 KB, patch)
2014-07-23 10:23 UTC, Theofanis Oikonomou
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2014-04-02 06:59:59 UTC
Created attachment 146487 [details]
Shows output and running debug process

* maven project with tests
* assign shortcut to action "Rerun Tests"
* open test class and execute "Debug Test File" action
* -> Test will be debugged and after that the debugging session is over
* invoke the shortcut for "Rerun Tests"

ACTUAL:
a) Debugging the test fails with
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection refused
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]
b) Debugger toolbar is activated and it seems that there is a running debug process (stop toolbar icon is enabled)


NetBeans: JPDA Listening Start...
JPDA Address: PC-ECG-71543:64627
Port:64627
cd C:\seu\wsgitnb\mavenproject3; JAVA_HOME=C:\\seu\\java\\jdk1.6.0_45_x64 M2_HOME=C:\\seu\\maven\\apache-maven-3.0.5 cmd /c "\"\"C:\\seu\\maven\\apache-maven-3.0.5\\bin\\mvn.bat\" -Dtest=NewClassTest -DforkMode=once -Dmaven.surefire.debug=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=64621\" -Djpda.listen=true -DnetbeansProjectMappings= -Djpda.address=64627 -Dmaven.ext.class.path=C:\\seu\\ide\\NetBeans8.0\\java\\maven-nblib\\netbeans-eventspy.jar;C:\\seu\\ide\\NetBeans8.0\\java\\maven-nblib\\netbeans-eventspy.jar -Dfile.encoding=UTF-8 --batch-mode -B -DskipGwtCompile surefire:test\""
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects...
                                                                        
------------------------------------------------------------------------
Building mavenproject3 1.0-SNAPSHOT
------------------------------------------------------------------------

--- maven-surefire-plugin:2.10:test (default-cli) @ mavenproject3 ---
Surefire report directory: C:\seu\wsgitnb\mavenproject3\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection refused
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]

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.753s
Finished at: Wed Apr 02 08:54:31 CEST 2014
Final Memory: 3M/121M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-cli) on project mavenproject3: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Check Maven network proxy...

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: Updates available
Java: 1.8.0; Java HotSpot(TM) 64-Bit Server VM 25.0-b70
Runtime: Java(TM) SE Runtime Environment 1.8.0-b132
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)
User directory: C:\Users\markiewb\AppData\Roaming\NetBeans\8.0
Cache directory: C:\Users\markiewb\AppData\Local\NetBeans\Cache\8.0
Comment 1 Milos Kleint 2014-04-07 14:30:48 UTC
theofanis: for some reason the rerun tests in test output window is disabled, the shortcut for the action bypasses the enablement check apparently. Was there a reason to disable the re-running?
Comment 2 Theofanis Oikonomou 2014-07-18 14:19:38 UTC
(In reply to Milos Kleint from comment #1)
> theofanis: for some reason the rerun tests in test output window is
> disabled, the shortcut for the action bypasses the enablement check
> apparently. Was there a reason to disable the re-running?

This seems to happen because debug doesn't property update debug port in runconfig, so rerun actions are disabled. This can be spotted in the log

NetBeans: JPDA Listening Start...
JPDA Address: PC-ECG-71543:64627
Port:64627
cd C:\seu\wsgitnb\mavenproject3; JAVA_HOME=C:\\seu\\java\\jdk1.6.0_45_x64 M2_HOME=C:\\seu\\maven\\apache-maven-3.0.5 cmd /c "\"\"C:\\seu\\maven\\apache-maven-3.0.5\\bin\\mvn.bat\" -Dtest=NewClassTest -DforkMode=once -Dmaven.surefire.debug=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=64621\" -Djpda.listen=true -DnetbeansProjectMappings= -Djpda.address=64627

current port for debugging is 64627 but port 64621 from previous run was passed from runconfig. 

I can easily fix this if you can point me to a way to get the current port debug is listening to from the RunConfig object. If this is not possible or if I am missing some maven internals I could just also do not allow the shortcut for the action to bypass the enablement check. Please advise on which behavior is preferable. Thanks
Comment 3 Theofanis Oikonomou 2014-07-23 10:23:42 UTC
Created attachment 148229 [details]
fix

With the patch the rerun tests button is enabled in Test Results window when debugging and the port is properly updated. Tomasi could you please verify it? Thx
Comment 4 Tomas Stupka 2014-07-23 11:00:29 UTC
> Created attachment 148229 [details]
> fix
> With the patch the rerun tests button is enabled in Test Results window when debugging and the port is properly updated. Tomasi could you please verify it? Thx
thanks. feel free to apply ...
Comment 5 Theofanis Oikonomou 2014-07-23 11:17:15 UTC
Changeset: 18476c8a1f5b
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2014-07-23 13:11
Message:
Comment 6 Quality Engineering 2014-07-24 02:40:31 UTC
Integrated into 'main-silver', will be available in build *201407240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/18476c8a1f5b
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Task #243467 - Rerun tests in Maven projects does not work, when tests were executed in debugging mode
Comment 7 markiewb 2014-07-26 09:58:56 UTC
Verified. 

Product Version: NetBeans IDE Dev (Build 201407260001)
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 8 gaurav_gupta 2017-01-09 15:47:53 UTC
Debugger toolbar is activated for different port and there is a running debug process .


JPDA Listening Start...
JPDA Address: gg2146A:56536
Port:56536
cd D:\Payara-master\appserver\transaction\jts; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_102" cmd /c "\"\"D:\\software\\netbeans-8.2-201609300101-javaee\\netbeans\\java\\maven\\bin\\mvn.bat\" -Dtest=com.sun.enterprise.transaction.jts.JUnitTest -DforkMode=never -Dmaven.surefire.debug=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=56536\" -Djpda.listen=true -Djpda.address=56536 -Dmaven.ext.class.path=D:\\software\\netbeans-8.2-201609300101-javaee\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar -Dfile.encoding=UTF-8 surefire:test\""
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects...
                                                                        
------------------------------------------------------------------------
Building JTS Implementation for Glassfish 4.1.1.171-SNAPSHOT
------------------------------------------------------------------------

--- maven-surefire-plugin:2.4.3:test (default-cli) @ jts ---
Surefire report directory: D:\Payara-master\appserver\transaction\jts\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.sun.enterprise.transaction.jts.NewEmptyJUnitTest

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 2.089s
Finished at: Mon Jan 09 21:15:32 IST 2017
Final Memory: 22M/441M
------------------------------------------------------------------------
Comment 9 gaurav_gupta 2017-01-09 16:03:03 UTC
By following this solution , it works : http://stackoverflow.com/a/17046062

Just define a goal exec:java and add the property jpda.listen=maven .