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
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

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?


More information about the bug 137822

March 16, 2009

With the help from Larry Isaacs in newsgroup, I realize I go in wrong direction. Before I thought first of all, I should find the code which throw the exception. Then I followed the hint and I should be able to find the supposed value for all some variables. Now I knew that I was far away from my way.

Larry Isaacs explained the reason why the server throw the exception in such condition. I reproduced it and displayed the reason here according to Larry Isaacs.

1. When I new a server, and right click and open the configuration window, the program arguments and VM arguemtns in the tab Arguments are empty, that’s why the server can’t load the class and throw the exception.


2.  However,  when we open the server configuration by clicking the tomcat server in the server view and clicking the “open launch configuration” , there are some arguments in the fields of  program arguments and VM arguments in the tab Arguments.


As Larry Isaacs suggested for me, I should try to set the arguments in the fileds when I run the configurations.

Dig the Bug 137822 – Find the code to throw the exception

March 14, 2009

After the debug, I got the code to throw the exception.

As I expected before, The class Server.java is the key class to start the server service. I set a break point on the method setServerState() of the class Server.java. When I debug it, the following picture is what I got the last line of the code without any exception.

The code throw the exception

As we can see, there is aproblem in the publisher function of ServerBehaviorDelegate.java

publishServer(kind, ProgressUtil.getSubMonitorFor(monitor, 1000));

I must investigate which value is supposed to be for the variables “kind” and “monitor”.  Then  I can fingure out when and where to produce such mistakes.

Bug-137822(a little progress)

February 23, 2009

Thanks for the help from Nabeel. I guess that I do something wrong. I guess I run the program from RCP, and I debug some code within WTP. That’s why I didn’t hit the break point. Anyway I post it, as I think both my mistake and my right way may provide some help to somebody else.  Person who read my blog won’t make the same mistake as me.

Even though my professor Jordan explain something about RCP and WTP and I can run my program from RCP which the target platform is WTP, I still don’t know what’s the difference between WTP and RCP. So far what I know is that WTP includes more plugings,  I really don’t know why I must use RCP instead of WTP which I can get the source files by using CVS as well. Anyway I must follow teacher’s way which I am pretty sure that it’s right.

If somebody can explain the reason for me, I will appreciate very much for that.

Bug 137822 – continue(2)

February 22, 2009

I try to debug the source files in the RCP and set the target platform to WTP. I set some break points withinthe org.eclipse.wst.server.core.internal.server.java file  which I felt pretty sure that it will be hit when I start the server,  and I add some code like “System.out.println(“This is the bug 137822″)” in the file as well. But when I debug it, nothing is happened. Does it mean that I didn’t find the right code, or I debug my code by wrong way? I don’t know.

I tried several ways to make the search.

1. The state of the server is keeping in starting. So I use “starting” to make the search in the .properties files. I found something like “jobstarting= starting” in the messages.properties of package org.eclipse.wst.server.core.internal, then I use jobstarting to make the search again. I get some code like

public StartJob(String launchMode) {
   super(NLS.bind(Messages.jobStarting, Server.this.getName()));
   System.out.println(“This is a try”);
   this.launchMode = launchMode;

set some break point over here. nothing is hit.

2. I realize the exception is URLClassLoader$1.run() exception. Then I tried to use search by using “URLClassLoader” again. All that I searched is some classes in other package.


I shoud focus on the server state to debug the code, or I should focus on the excpetion hints to dig the bug, I really don’t know.

Post something to the newsgroup(http://www.eclipse.org/newsportal/thread.php?group=eclipse.webtools&first=1&last=50).  I hope I can get some suggestion about how I can get started.

Bug137822 — continue

February 20, 2009

Try to find at least some hints about this bug. I downloaded two packages which looks like to related to my bugs:

org.eclipse.wst.server.core and org.eclipse.wst.server.ui

I guess that my bug should be in the org.eclipse.wst.server.core , and I guess that I will  get some help from the package org.eclipse.wst.server.ui by looking the related UI.

However, who is what? I still have no idea so far.

It looks so easy for Angel Vera from IBM to find the related code. He knew which way he should use. By searching, it’s true. The search function in eclipse is very powerful. He first searched the word in properties file, then he found the key name whose value is the word. Then he searched again by using the key name. However, how can I do that? I have no idea.

A list classes related to the server.


2. /org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/ServerCore.java

I may set a JUnit and use debug to get this point first.

I have no idea and must take a try first.

Reproduce WTP-Bug 137822

February 7, 2009

After Khanh Vu sent me a message that I picked up the same Bug as his, I realize I do something wrong. I should pick up my bug after I read through the blog of some other students. Anyway, I should change to another Bug which I will work on. I reproduce another bug 137822.

The setp is:

1. Open Eclipse as JavaEE view;

2. Add a new Tomcat server from Server View and a Dynamic Web Project;

3. After this, start the Debug configurations;


4. In the new launch configure under Tomcat type, select new server;

bug137822-step35. Hit the Debug, the VM runner throws exception

bug137822-step4 6. This is the whole steps to reproduce the bug 137822, actually after I finish all the steps, I can’t stop the server. After I click the server stop sign on the righ-buttom, there is a warning message popped up to ask for continuing Stop(OK) or Cancel.


7. I click the OK, then the server will show the stopping status. It can’t stop.