This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 327251 - NPE when running servlet mapped to jsp file
Summary: NPE when running servlet mapped to jsp file
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.3   Edit
Assignee: Jason Peterson CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-07 11:31 EDT by Jason Peterson CLA
Modified: 2010-12-06 14:25 EST (History)
3 users (show)

See Also:
cbridgha: review+


Attachments
patch (8.19 KB, patch)
2010-12-01 14:47 EST, Jason Peterson CLA
ccc: iplog+
Details | Diff
another_npe_fix (2.43 KB, patch)
2010-12-02 14:25 EST, Jason Peterson CLA
no flags Details | Diff
more_npe_fixes (4.30 KB, patch)
2010-12-02 14:39 EST, Jason Peterson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Peterson CLA 2010-10-07 11:31:00 EDT
A NPE is being thrown whenever I attempt to run a 2.5 or 3.0 servlet that has a jsp-file tag definition.  This is because the current code is expecting a servlet-class tag and is not even designed to handle running a servlet mapped to a jsp file.  The NPE needs to be fixed and support for jsp file needs to be added to WebDeployableArtifactUtil.
Comment 1 Nitin Dahyabhai CLA 2010-10-10 14:26:45 EDT
Jason, have you a stack trace?
Comment 2 Jason Peterson CLA 2010-10-11 10:28:07 EDT
java.lang.NullPointerException
	at org.eclipse.jst.jee.ui.internal.deployables.WebDeployableArtifactUtil.getServletMappings(WebDeployableArtifactUtil.java:376)
	at org.eclipse.jst.jee.ui.internal.deployables.WebDeployableArtifactUtil.getModuleObject(WebDeployableArtifactUtil.java:93)
	at org.eclipse.jst.jee.ui.internal.deployables.WebDeployableArtifactAdapterFactory.getModuleArtifact(WebDeployableArtifactAdapterFactory.java:31)
	at org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate.getModuleArtifacts(ModuleArtifactAdapterDelegate.java:46)
	at org.eclipse.wst.server.core.internal.ModuleArtifactAdapter.getModuleArtifacts(ModuleArtifactAdapter.java:181)
	at org.eclipse.wst.server.core.internal.ServerPlugin.getModuleArtifacts(ServerPlugin.java:1142)
	at org.eclipse.wst.server.ui.internal.actions.RunOnServerActionDelegate.selectionChanged(RunOnServerActionDelegate.java:762)
	at org.eclipse.wst.server.ui.internal.ServerLaunchShortcut.launch(ServerLaunchShortcut.java:40)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension.launch(LaunchShortcutExtension.java:434)
	at org.eclipse.debug.internal.ui.actions.LaunchShortcutAction.run(LaunchShortcutAction.java:73)
	at org.eclipse.debug.internal.ui.actions.LaunchShortcutAction.runWithEvent(LaunchShortcutAction.java:121)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
	at org.eclipse.jface.action.ActionContributionItem$9.handleEvent(ActionContributionItem.java:1284)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 3 Jason Peterson CLA 2010-12-01 14:47:03 EST
Created attachment 184296 [details]
patch
Comment 4 Jason Peterson CLA 2010-12-01 14:52:56 EST
Attached patch adds support for JSPs as Servlets.  This support existed for legacy web projects, but was never added for EE 5 and 6.  Found a bunch of commented out code related to this support.  

I also fixed up two issues I found with the legacy support.  Code was assuming WebContent had to exist under the project folder.  It was also looking for the JSP file under the project folder instead of under the WebContent folder.
Comment 5 Chuck Bridgham CLA 2010-12-01 17:07:38 EST
approved
Comment 6 Carl Anderson CLA 2010-12-01 19:40:28 EST
Committed to R3_2_maintenance and HEAD for WTP 3.2.3 and WTP 3.3
Comment 7 Jason Peterson CLA 2010-12-02 14:18:12 EST
Found another NPE location in the existing code.  I had fixed one of them in the original patch, but just discovered this one as well.
Comment 8 Jason Peterson CLA 2010-12-02 14:25:58 EST
Created attachment 184383 [details]
another_npe_fix
Comment 9 Jason Peterson CLA 2010-12-02 14:39:12 EST
Created attachment 184387 [details]
more_npe_fixes
Comment 10 Jason Sholl CLA 2010-12-06 14:25:07 EST
Updated patch checked into 32M and HEAD for WTP 3.2.3 and 3.3