Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 174886 - Within TPTP, trying to profile Tomcat server get a NullPointerException
Summary: Within TPTP, trying to profile Tomcat server get a NullPointerException
Status: CLOSED FIXED
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: wst.server (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Tim deBoer CLA
QA Contact: Tim deBoer CLA
URL:
Whiteboard:
Keywords:
: 174887 (view as bug list)
Depends on:
Blocks: 174887
  Show dependency tree
 
Reported: 2007-02-20 17:34 EST by Matt Mings CLA
Modified: 2017-10-11 16:10 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Mings CLA 2007-02-20 17:34:13 EST
Trying to profile a server using TPTP Build TPTP-4.4.0-200702190100 and either WTP  I200702152002 or I200702080847 throws a NullPointerException.  In the ResourceManager class the method getServers throws the Null pointer, because the servers list is null and has not been initialized.  In the init method the server list is either not built in time because the status is initializing and thus the server list is null when checked in the getServer method.  I see that it is synchronized block of code but for some reason the list is always null.  There is no work around that I aware of.

Stack Trace:
java.lang.NullPointerException
	at org.eclipse.wst.server.core.internal.ResourceManager.getServers(ResourceManager.java:720)
	at org.eclipse.wst.server.core.ServerCore.getServers(ServerCore.java:299)
	at org.eclipse.tptp.platform.profile.server.wst.internal.ApplicationServerListener.startup(ApplicationServerListener.java:42)
	at org.eclipse.wst.server.core.internal.ResourceManager.executeStartups(ResourceManager.java:186)
	at org.eclipse.wst.server.core.internal.ResourceManager.init(ResourceManager.java:212)
	at org.eclipse.wst.server.core.internal.ResourceManager.getServers(ResourceManager.java:718)
	at org.eclipse.wst.server.core.ServerCore.getServers(ServerCore.java:299)
	at org.eclipse.wst.server.ui.internal.InitializeJob.run(InitializeJob.java:35)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Comment 1 Matt Mings CLA 2007-02-20 17:53:23 EST
After more debugging, what is happening is that the init call within ResourceManager makes a call to executeStartups which include a call to the TPTP ApplicationServerListener which implements IStartup.  So the server list will always be null until the init is finished.    
Comment 2 Tim deBoer CLA 2007-02-20 18:24:22 EST
Since TPTP is calling API during the API startup hook, at best this will probably return an empty list. I'll take a deeper look tomorrow.
Comment 3 Matt Mings CLA 2007-02-20 18:34:11 EST
Looking at the init again in ResourceManager, I think if you move
executeStartups() after you do loadServersList() everything would be fine. 
Just my two cents.
Comment 4 Tim deBoer CLA 2007-02-20 23:28:11 EST
No, you're right. The fix made in M4 to avoid deadlock when startups were used incorrectly went a little too far, and we can make this API work. Startups still can't tell whether others servers will be created before or after their call during the initialization, but the API will be consistent.

We're in final lock down for M5 and I don't think this really qualifies as blocking since it will only cause this specific TPTP startup to fail. I will release a fix as soon as M6 opens, likely late this week.
Comment 5 Matt Mings CLA 2007-02-21 10:35:31 EST
moved to critical.
Comment 6 Tim deBoer CLA 2007-02-23 17:55:31 EST
Fix released to WTP 2.0 M6 builds.
Comment 7 Matt Mings CLA 2007-02-26 13:45:09 EST
Profiling now works, verified on build I200702260802.
Comment 8 Matt Mings CLA 2007-02-26 13:46:26 EST
*** Bug 174887 has been marked as a duplicate of this bug. ***
Comment 9 Eclipse Genie CLA 2017-10-11 16:10:26 EDT
New Gerrit change created: https://git.eclipse.org/r/108157