Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 269794

Summary: External Generic Server Adapter does not support Remote Debugging
Product: [WebTools] WTP ServerTools Reporter: Anders Olsson <anders.x.olsson>
Component: jst.serverAssignee: Gorkem Ercan <gorkem.ercan>
Status: CLOSED FIXED QA Contact: Tim deBoer <deboer>
Severity: major    
Priority: P3 CC: gorkem.ercan
Version: 3.0.3   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/108757
Whiteboard:
Attachments:
Description Flags
Very basic patch that fixes the problem for me none

Description Anders Olsson CLA 2009-03-24 05:22:16 EDT
Build ID: M20080911-1700

Steps To Reproduce:
1. Create a WTP Server type supporting remote hosts using org.eclipse.jst.server.generic.core.internal.GenericServer as main class and org.eclipse.jst.server.generic.core.internal.ExternalServerBehaviour as behaviourClass.
2. Create a new Server Adapter to a remote system using this Server type
3. Launch this Server in Debug mode
4. Publish a project with a set breakpoint, load the page with the BP, and see Eclipse not breaking.

More information:
The ExternalLaunchConfigurationBehaviour Class seem to make assumptions that the server to be debugger should always be local, even if the Server Adapter configuration specifies otherwise.

In the above mentioned Class the method:
private ILaunchConfigurationWorkingCopy createDebuggingConfig(ILaunchConfiguration configuration) 
in R3_0_3 (or HEAD as well, for that matter) the ILaunchConfiguration Object 'configuration' has it's attribute 'hostname' hardcoded to 'localhost', when it should be gotten from the server configuration.

To confirm that debugging was actually working on the remote Application Server, I tried Creating a Remote Java Application Debug Launch Configuration connecting to the Debug port specified in my Serverdef on the remote server. This worked well.

I've also tried step-debugging ExternalDebugLaunchConfigurationBehaviour. On line 66:
Map argMap = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, (Map)null);
The Argument Map is gotten from the configuration. Replacing the value in-place for the key 'hostname' to the IP of the remote system causes debugging to work just as expected, insinuating that a fix should be quite simple.
Comment 1 Anders Olsson CLA 2009-03-24 06:15:14 EDT
Created attachment 129685 [details]
Very basic patch that fixes the problem for me
Comment 2 Gorkem Ercan CLA 2009-03-28 17:27:32 EDT
I have fixed it on the HEAD. Will release it builds shortly
Comment 3 Gorkem Ercan CLA 2009-03-29 14:39:35 EDT
Fix is released to builds. I have not used the patch. 
Comment 4 Anders Olsson CLA 2009-03-30 04:08:13 EDT
(In reply to comment #3)
> Fix is released to builds. I have not used the patch. 
> 

Having backported the changes made to ExternalServerBehaviour and ExternalLaunchConfigurationDelegate from HEAD to 3.0.4, I can confirm that it works as expected.

The changes are of course a more proper way to do it, compared to my simple patch.

Many thanks for the quick fix!
Comment 5 Anders Olsson CLA 2009-09-01 08:18:05 EDT
Confirmed working in WTP 3.1 on Eclipse 3.5
Comment 6 Eclipse Genie CLA 2017-10-11 16:27:49 EDT
New Gerrit change created: https://git.eclipse.org/r/108757