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

Bug 332237

Summary: NPE in the Tomcat50ServerTestcase.java
Product: [WebTools] WTP ServerTools Reporter: Angel Vera <arvera>
Component: jst.serverAssignee: Larry Isaacs <larryisaacs>
Status: RESOLVED FIXED QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3 CC: arvera, david_williams
Version: 3.2Flags: arvera: review+
Target Milestone: 3.2.3   
Hardware: PC   
OS: Windows XP   
See Also: https://git.eclipse.org/r/109016
Whiteboard:
Attachments:
Description Flags
Patch to TomcatServer to allow asynchronous calls to it's configurationChanged() method none

Description Angel Vera CLA 2010-12-09 14:09:15 EST
java.lang.NullPointerException
at org.eclipse.jst.server.tomcat.core.tests.Tomcat50ServerTestCase.verifyPublishedModule(Tomcat50ServerTestCase.java:44)
at org.eclipse.jst.server.tomcat.core.tests.AbstractTomcatServerTestCase.verifyLegacyAddPublish(AbstractTomcatServerTestCase.java:289)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:416)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:249)
at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java:36)
at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:32)
at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Comment 1 Larry Isaacs CLA 2010-12-09 15:46:10 EST
My analysis is that this is a spurious failure caused by how the test is written.  This particular test, and probably others, execute a sequence of steps as fast as code will allow, resulting in the potential for race conditions.  For this particular test, the server configuration is being modified, a module added, and then the server published.  The configuration change appears to have caused a cached configuration to get discarded out from under the publish operation leading to the NPE.

I'm still digging into the exact scenario that results in this NPE, but I suspect one or more of these steps should probably be performed in a Job so workspace notifications can be processed before moving on to the next step.  Also, I see how I can make a small change so this NPE would be less likely regardless of any testing changes, so I'll see about including that in WTP 3.2.3 and 3.3.  In any event, I don't believe this failure represents any new issue in WTP and I would not expect it happen in the next build.
Comment 2 Larry Isaacs CLA 2011-01-03 13:37:46 EST
Created attachment 185967 [details]
Patch to TomcatServer to allow asynchronous calls to it's configurationChanged() method

These are the changes I plan to commit to address the NPE.  It uses version counting to trigger reloading of Tomcat's configuration instead of nulling the configuration. It avoids the NPE which can occur if configurationChanged() is called while the configuration is being loaded.
Comment 3 Larry Isaacs CLA 2011-01-03 13:46:35 EST
Angel, Please review for inclusion in WTP 3.2.3.  To be included are version bumps for tomcat.core, server_adapters.ext.feature, and server_adapters.ext.sdk.feature.  Thanks.
Comment 4 Angel Vera CLA 2011-01-10 17:07:39 EST
Look good
Comment 5 Larry Isaacs CLA 2011-01-12 12:46:12 EST
Fix released to HEAD and 3.2 maintenance and appear in current WTP 3.3 and 3.2.3 builds.
Comment 6 Eclipse Genie CLA 2017-10-11 16:35:36 EDT
New Gerrit change created: https://git.eclipse.org/r/109016