Bug 289639 - Problems opening perspective JavaPerspective, NPE on JavaModelManager.containersReset()
Summary: Problems opening perspective JavaPerspective, NPE on JavaModelManager.contain...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-16 13:43 EDT by Shawn Clark CLA
Modified: 2009-10-27 07:29 EDT (History)
2 users (show)

See Also:


Attachments
Eclipse Error Logs (31.80 KB, application/zip)
2009-09-16 13:44 EDT, Shawn Clark CLA
no flags Details
Initial error when loading Eclipse (114.47 KB, image/jpeg)
2009-09-21 12:39 EDT, Shawn Clark CLA
no flags Details
Error Log to compliment the screenshot (118.56 KB, application/octet-stream)
2009-09-21 12:40 EDT, Shawn Clark CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shawn Clark CLA 2009-09-16 13:43:22 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Build Identifier: 20090621-0832

Ran into an issue this morning when starting up Eclipse. When it first loaded on the Java perspective all views had errors in them stating that they couldn't load because of errors with the JDT. I was able to get Eclipse to the point where I closed all my perspectives and did an "eclipse -clean" but still having an issue. If I load perspectives that do not rely on JDT (e.g. CVS, SVN) then they load fine and show their views. I did notice that if I load the Resource perspective it does show some of the views. It shows the Project Explorer view with my projects listed but does run into an error related to JDT.

I will be attaching the log files for both loading the Java perspective and the Resource Perspective.

Reproducible: Always

Steps to Reproduce:
1. Load Eclipse with no perspectives loaded.
2. Try to open the Java perspective.
3. Error occurs
Comment 1 Shawn Clark CLA 2009-09-16 13:44:32 EDT
Created attachment 147345 [details]
Eclipse Error Logs
Comment 2 Shawn Clark CLA 2009-09-16 13:48:27 EDT
After doing some troubleshooting I was able to get my Eclipse back to a stable state. What I had to do is load up the Resource perspective so that I could see the projects within my workspace. I closed all the projects and then closed the perspective. Restarted Eclipse and then opened the Java perspective. The perspective loaded without errors and all the views were reset to their default. The Package Explorer showed all my projects as closed. I then tried to open each one individually hoping that the problem was within one of the projects but they all were able to open without error. With all projects opened I closed the Java perspective and restarted Eclipse. Opened the Java perspective and there were no errors.

I believe this must have been an issue with the perspectives and their interaction with the JDT core. Hopefully the log files will provide enough insight into the problem for a fix.

If you want more information or to try something if it occurs again please add a comment here and I will try to reproduce.
Comment 3 Olivier Thomann CLA 2009-09-16 14:00:21 EDT
I'll try to reproduce using latest I-build.
Comment 4 Olivier Thomann CLA 2009-09-16 14:22:01 EDT
I cannot get Eclipse to open without any perspective opened.
Looking at the source code, I can see from where the NPE is coming from, but I'd like to reproduce to make sure this is fixed.
Comment 5 Shawn Clark CLA 2009-09-16 16:41:03 EDT
I noticed this as well once my Eclipse was running fine that it would load up the "Default" perspective if none were loaded. When I was having the problems though I would be able to load up Eclipse and no perspective would show but no errors would be displayed until I tried to open a perspective.
Comment 6 Olivier Thomann CLA 2009-09-17 11:11:24 EDT
I'll fix the obvious problem in the code and you can tell me if you can reproduce with the fix.
Comment 7 Olivier Thomann CLA 2009-09-17 11:15:23 EDT
Released the code change to put containerPath.segment(0) that can return null on the right side of the equals.
A code verification is required to verify this fix.
Comment 8 Shawn Clark CLA 2009-09-21 12:39:10 EDT
How would I be able to test this fix? I am currently only on Eclipse 3.5 release. The problem occurred again this morning when I opened up Eclipse. I was able to get a screenshot of the error as well as the log of what the problem was at that load. It looks like my problem might be related to bug 280668 but the provided jar file for that bug did not fix this issue. If you could provide a jar file to replace in my Eclipse environment that would be great. I am going to zip up my workspace / project folders so that I can keep the state to test with this time.
Comment 9 Shawn Clark CLA 2009-09-21 12:39:43 EDT
Created attachment 147713 [details]
Initial error when loading Eclipse
Comment 10 Shawn Clark CLA 2009-09-21 12:40:20 EDT
Created attachment 147714 [details]
Error Log to compliment the screenshot
Comment 11 Shawn Clark CLA 2009-09-21 13:26:12 EDT
While getting my workspace back this time I noticed that my problem is almost exactly like Bug 280668. On Friday (2009-09-18) I was working on a Hibernate project so I added a Connectivity Driver Definition to my build path of my project for HSQLDB. When trying to fix my workspace this morning I noticed that the only projects open were that project and a sample project on Guice. I closed the projects using the Resource perspective and closed Eclipse. Loaded Eclipse back up and went back to the Java perspective which was now not showing any errors. Opened the project up and the perspective was fine without error.

I am able to continue to use Eclipse without errors and able to close / open it with out additional errors.
Comment 12 Shawn Clark CLA 2009-09-21 14:11:21 EDT
Additional troubleshooting...

Modifying the build libraries by re-adding the HSQLDB driver causes the error to occur again.

Steps to reproduce:

- Create a java project and add the HSQLDB driver.
- Close Eclipse
- Open Eclipse and errors occur.
- Open Resource Perspective to be able to close project.
- Close project and close Eclipse.
- Startup Eclipse go back to the Java perpsective
- Open up the project
- Re-add the HSQLDB driver to the project

Every time you add the driver (guessing any driver using the Connectivity driver option) causes the problem as that was what originally caused the problem the previous week with a MYSQL driver. Odd thing is that once it has been added and the project re-opened the error doesn't occur until you modify the connectivity driver.
Comment 13 Olivier Thomann CLA 2009-09-22 10:45:57 EDT
Where do I get the HSQLDB driver from ?
Also specify what version you are using.

Reopening to track it down and try to see if the reproducable steps are fixed with the released patch.
Comment 14 Shawn Clark CLA 2009-09-22 12:34:07 EDT
The HSQLDB driver is available from http://hsqldb.org/. Of note, the error was occuring with MYSQLDB driver as well.
Comment 15 Olivier Thomann CLA 2009-09-23 14:32:50 EDT
(In reply to comment #12)
> - Create a java project and add the HSQLDB driver.
How do you add the HSQLDB driver ?

I don't reproduce this error.
Comment 16 Shawn Clark CLA 2009-09-23 16:50:11 EDT
Steps to add the HSQLDB driver to the project. Firstly you need to setup the Driver Definition for the HSQLDB driver.

- Open Eclipse Properties to the Data Management -> Connectivity -> Driver Definitions
- Click "Add"
- Select the "HSQLDB JDBC Driver" within the driver template listing.
- Warning will show up asking for the location of the jar file.
- Select the "Jar List" tab and add the jar for the HSQLDB driver from what was downloaded from the web site.
- Once the JAR is added you should be able to select "OK" to close the dialog and the new driver will be listed in the "Driver Definitions" properties.

Now that the driver is available open up a Java project.

- Within the Project Properties go to the Java Build Path and select "Libraries" tab.
- Click "Add Library" and select "Connectivity Driver Definition"
- Expand the pulldown for "Available Driver Definitions" and select the newly created HSQLDB definition.
- Click "Finish" to close the dialog.
- Within the Libraries listing there should be a new HSQLDB JDBC Driver library added.
- Click "OK" to close the preferences dialog

At this point the problem will show itself if you were to close Eclipse and try to load it back up. It is the act of adding the connectivity driver to the project that causes things to error.
Comment 17 Olivier Thomann CLA 2009-10-02 09:05:07 EDT
Could you please provide your configuration?
What bundles are installed on top of Eclipse?
Thanks.
Comment 18 Olivier Thomann CLA 2009-10-06 20:13:08 EDT
Closing again as FIXED.
Shawn, could you please verify latest I-build and see if you can reproduce?
Comment 19 Jay Arthanareeswaran CLA 2009-10-27 05:10:21 EDT
Verified for 3.6 M3 by code inspection.