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

Bug 341975

Summary: internal error occurred during "Initializing Java Tooling" when restarting eclipse
Product: [Eclipse Project] JDT Reporter: Kentaroh Noji <kennoji>
Component: DebugAssignee: Michael Rennie <Michael_Rennie>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: camle, curtis.windatt.public, daniel_megert, jarthana, kennoji, kitlo, Michael_Rennie, Olivier_Thomann, pwebster
Version: 3.7Flags: curtis.windatt.public: review+
Target Milestone: 3.7 M7   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Error log
none
Screen capture of this problem
none
fix none

Description Kentaroh Noji CLA 2011-04-05 23:02:28 EDT
Build Identifier: I20110329-0800

OS: All 
JRE version: IBM JRE 1.6.0 (SR9 FP1) 

When restarting Eclipse, error dialog of internal error occurred during "Initializing Java Tooling" appears. This problem occurs in build id:I20110329-0800, but does not occur in M6. This problem occurs in 3.7 and 4.1. 
This problem occurs when restarting eclipse first time, third time, fifth time, but does not occur in second time, fourth time. 

Once this problem occurs, I can not create Java class successfully. 

The screen capture and error log are added as attachments. 


Reproducible: Always

Steps to Reproduce:
1.Start eclipse.
2.Create a java project. Do not create any java class in the project.  
3.Exit the eclipse.
4.Start eclipse again.
5.An error dialog window of internal error occurred appears.
6.Exit and restart the eclipse, but the error does not occur.
7.Exit and restart the eclipse, then the error occurs again.
Comment 1 Kentaroh Noji CLA 2011-04-05 23:11:10 EDT
Created attachment 192607 [details]
Error log

This file is entire error log which was generated during the test operations related to this defect.
Comment 2 Kentaroh Noji CLA 2011-04-05 23:13:44 EDT
Created attachment 192608 [details]
Screen capture of this problem
Comment 3 Jay Arthanareeswaran CLA 2011-04-06 00:12:33 EDT
I am unable to reproduce the error with the same build - I used a different VM, though. Were there any other projects in the workspace that you used? Does the error occur even when you use a new workspace?
Comment 4 Kentaroh Noji CLA 2011-04-06 00:57:25 EDT
> Were there any other projects in the workspace that you used? 

No. There are a Java project only in the workspace. Note that there are no java class in the Java project.  

> Does the error occur even when you use a new workspace?

No. When I restart the eclipse with new workspace, there is no problem.
Comment 5 Kentaroh Noji CLA 2011-04-06 03:46:37 EDT
Hi,  

> I am unable to reproduce the error with the same build - I used a different VM,
> though. 

Please let me know the version of your VM. I will test this test scenario with the same VM you are using.
Comment 6 Jay Arthanareeswaran CLA 2011-04-06 04:09:12 EDT
(In reply to comment #5)
> Please let me know the version of your VM. I will test this test scenario with
> the same VM you are using.

I used IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3), but looking at the exception trace, I don't think the VM has anything to do with it.

I see that you have some EJB projects as well in the workspace. Can you make sure you close all other projects (except the one you are creating) and try again?
Comment 7 Olivier Thomann CLA 2011-04-06 08:35:31 EDT
The problem seems to be in JDT launching.
Moving to JDT/Debug for investigation.

Caused by: java.lang.NullPointerException
	at org.eclipse.jdt.internal.launching.LaunchingPlugin.writeInstallInfo(LaunchingPlugin.java:1038)
	at org.eclipse.jdt.internal.launching.LaunchingPlugin.timeStampChanged(LaunchingPlugin.java:962)
	at org.eclipse.jdt.internal.launching.VMDefinitionsContainer.populateVMForType(VMDefinitionsContainer.java:555)
	at org.eclipse.jdt.internal.launching.VMDefinitionsContainer.populateVMTypes(VMDefinitionsContainer.java:490)
	at org.eclipse.jdt.internal.launching.VMDefinitionsContainer.parseXMLIntoContainer(VMDefinitionsContainer.java:469)
	at org.eclipse.jdt.launching.JavaRuntime.addPersistedVMs(JavaRuntime.java:1467)
	at org.eclipse.jdt.launching.JavaRuntime.initializeVMs(JavaRuntime.java:2632)
	at org.eclipse.jdt.launching.JavaRuntime.getVMInstallTypes(JavaRuntime.java:523)
	at org.eclipse.jdt.internal.launching.environments.EnvironmentsManager.initializeCompatibilities(EnvironmentsManager.java:235)
	at org.eclipse.jdt.internal.launching.environments.ExecutionEnvironment.init(ExecutionEnvironment.java:178)
	at org.eclipse.jdt.internal.launching.environments.ExecutionEnvironment.getDefaultVM(ExecutionEnvironment.java:215)
	at org.eclipse.jdt.internal.launching.JREContainerInitializer.resolveVM(JREContainerInitializer.java:171)
	at org.eclipse.jdt.internal.launching.JREContainerInitializer.resolveVM(JREContainerInitializer.java:138)
	at org.eclipse.jdt.internal.launching.JREContainerInitializer.initialize(JREContainerInitializer.java:57)
	at org.eclipse.jdt.internal.core.JavaModelManager.initializeContainer(JavaModelManager.java:2810)
	at org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:1872)
Comment 8 Michael Rennie CLA 2011-04-06 09:33:24 EDT
I also cannot reproduce the problem using that I-build (or the latest one).

The NPE is reported as happening on this line: fgLibraryInfoMap.containsKey(key)

but we guard against the map being null a few lines up and passing in null to containsKey will not throw an NPE.

Kentaroh, can you attach the file <path_to_your_workspace>/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml?
Comment 9 Michael Rennie CLA 2011-04-06 09:45:47 EDT
The critical missing step is that you must edit the default JRE install location before you restart:

1. start new workspace
2. add project - no classes
3. close eclipse
4. edit the default JRE location - add a file or something
5. restart Eclipse

The steps above yield the same stacktrace.
Comment 10 Dani Megert CLA 2011-04-06 09:46:31 EDT
>Caused by: java.lang.NullPointerException
>    at
>org.eclipse.jdt.internal.launching.LaunchingPlugin.writeInstallInfo(LaunchingPl>ugin.java:1038)
IIRC I also saw that once when I launched a very old workspace with 3.7.
Comment 11 Michael Rennie CLA 2011-04-06 10:28:01 EDT
The problem comes from the last fix for bug 266651 when we added support for detecting on-disk changes so we could reset certain values of the JRE install.

See VMDefinitionsContainer#populateVMForType for more infos.
Comment 12 Michael Rennie CLA 2011-04-06 12:53:49 EDT
Created attachment 192661 [details]
fix

checks if the library map is null - which it can be during the restore info pass - and adds a check in when setting lib info to be null to remove a time stamp entry for the same location.
Comment 13 Michael Rennie CLA 2011-04-06 13:16:51 EDT
Applied patch to HEAD, please verify Curtis et. al.
Comment 14 Kentaroh Noji CLA 2011-05-02 00:30:15 EDT
(In reply to comment #13)
> Applied patch to HEAD, please verify Curtis et. al.

Verified the problem was fixed with I20110421-1800.
Comment 15 Curtis Windatt CLA 2011-05-04 16:47:37 EDT
Verified.