Bug 238681 - NPE while starting Eclipse
Summary: NPE while starting Eclipse
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.4   Edit
Hardware: All Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 4.4 M5   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-06-26 17:32 EDT by Dmitry Stadnik CLA
Modified: 2014-01-10 01:17 EST (History)
6 users (show)

See Also:


Attachments
Removal of Manual creation of Launching Plugin (1.38 KB, patch)
2014-01-10 01:17 EST, Sarika Sinha CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Stadnik CLA 2008-06-26 17:32:59 EDT
Just noticed in error log.

null
Error
Thu Jun 26 23:10:20 CEST 2008
An internal error occurred during: "Initializing Java Tooling".

java.lang.NullPointerException
at org.eclipse.core.runtime.Plugin$1.run(Plugin.java:353)
at org.eclipse.core.runtime.Plugin.getPluginPreferences(Plugin.java:356)
at org.eclipse.jdt.launching.JavaRuntime.getPreferences(JavaRuntime.java:2060)
at org.eclipse.jdt.launching.JavaRuntime.addPersistedVMs(JavaRuntime.java:1408)
at org.eclipse.jdt.launching.JavaRuntime.initializeVMs(JavaRuntime.java:2554)
at org.eclipse.jdt.launching.JavaRuntime.getDefaultVMId(JavaRuntime.java:501)
at org.eclipse.jdt.launching.JavaRuntime.getDefaultVMInstall(JavaRuntime.java:446)
at org.eclipse.jdt.internal.launching.JREContainerInitializer.resolveVM(JREContainerInitializer.java:115)
at org.eclipse.jdt.internal.launching.JREContainerInitializer.initialize(JREContainerInitializer.java:57)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeContainer(JavaModelManager.java:2371)
at org.eclipse.jdt.internal.core.JavaModelManager$13.run(JavaModelManager.java:2301)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeAllContainers(JavaModelManager.java:2317)
at org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:1679)
at org.eclipse.jdt.core.JavaCore.initializeAfterLoad(JavaCore.java:3398)
at org.eclipse.jdt.internal.ui.InitializeAfterLoadJob$RealJob.run(InitializeAfterLoadJob.java:35)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 Martin Aeschlimann CLA 2008-06-27 03:42:47 EDT
That would mean that bundle is null and the Bundle hasn't been started yet. Strange. Do you have it reproducible? More information about your installation?
Comment 2 Dmitry Stadnik CLA 2008-06-27 05:13:50 EDT
1. Unpacked eclipse
2. Went to software update and installed a bunch of features; mainly for GMF development

Can't reproduce (((
Comment 3 John Arthorne CLA 2008-06-27 11:45:57 EDT
I'm not sure if this is the cause, but I noticed the launching plugin has the bad pattern of invoking its own constructor in the getDefault() method:

if(fgLaunchingPlugin == null)
   fgLaunchingPlugin = new LaunchingPlugin();

This could cause a LaunchingPlugin instance to be available that hasn't had start() called on it (which initializes the bundle field).  The plugin constructor must only ever be called by the framework to be sure the instance is properly initialized.  

I don't quite see how this could happen, but perhaps it's a concurrency issue where two threads are calling getDefault() concurrently, or getDefault() is being called again from within the initialization of the bundle.
Comment 4 John Arthorne CLA 2009-09-08 17:01:45 EDT
Without further info, I think all we can do is fix the code that currently instantiates the plugin class manually. Moving to JDT Debug (I believe they own the jdt.launching bundle).
Comment 5 Sarika Sinha CLA 2014-01-03 05:02:23 EST
Fixed the code to instantiate plugin class manually.
Sent for Review.
Comment 6 Michael Rennie CLA 2014-01-03 10:40:48 EST
(In reply to Sarika Sinha from comment #5)
> Fixed the code to instantiate plugin class manually.
> Sent for Review.

The gerrit change: https://git.eclipse.org/r/#/c/20233/
Comment 7 Michael Rennie CLA 2014-01-03 12:22:14 EST
(In reply to Michael Rennie from comment #6)
> (In reply to Sarika Sinha from comment #5)
> > Fixed the code to instantiate plugin class manually.
> > Sent for Review.
> 
> The gerrit change: https://git.eclipse.org/r/#/c/20233/

Merged in master: http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=34cf1bdbcef86349b12798d93b90bfae77c8a52f
Comment 8 Sarika Sinha CLA 2014-01-10 01:17:39 EST
Created attachment 238843 [details]
Removal of Manual creation of Launching Plugin

The defect is not reproduced but a probable cause may be the manual
creation of LaunchingPlugin. Removed the manual creation.