WTP-bug 137822 Get the execution path

March 25, 2009

Two different execution paths by running the server in two different ways

=========
From previous comments, we know that the program is executed in two different way for step 1 and step 2, so that the arguments for the Program and VM are set in two different ways. The arguments for Program and VM in step 2 are set properly; however The arguments for Program and VM in step 1 are not set at all. As Tim deBoer said that somewhere the program should call the method setupLaunchConfiguration() to set the arguments. In order to get the execute path by looking at the exception stack Trace I do following things:

1. Created an exception (int i = Integer.parseInt(“my exception”);)
2. Add this exception code in the line 226 of  org.eclipse.wst.server.ui.ServerLaunchConfigurationTab.setDefaults(ILaunchConfigurationWorkingCopy) for step 1;
3. Run the server by Click/Run as –> Run Configuration, then check the Error Log and get the Exception Stack Trace:
Bug 137822 exception stack
bug137822_exception
4. Add this exception code in the line 771 of org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour.setupLaunchConfiguration(ILaunchConfigurationWorkingCopy, IProgressMonitor) for step 2
5. Open the server configuration dialog from the server view and click the link “Open launch configuration” , then check the Error Log and get the Exception Stack Trace:
Bug 137822 regular stack
bug137822_regular

By looking at the stack trace, I found some code in org.eclipse.wst.server.ui.ServerLaunchConfigurationTab.setDefaults() such as :
line 217: if (servers != null) {
server = servers.get(serverCombo.getSelectionIndex());
if (server != null)
((Server) server).setupLaunchConfiguration(configuration, null);
However, the server is null and the configuration is null, that’s why it’s impossible to set the LaunchConfiguration stuff.

As we can see, the rest methods in the stack are in a jar file, and I can make any change in the jar file code. Someone knows how to add some code in a jar file?