Bug 255931 - Error on project rebuild "The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files"
Summary: Error on project rebuild "The type java.lang.Object cannot be resolved. It is...
Status: VERIFIED DUPLICATE of bug 232478
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4.2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-20 04:28 EST by JohnMcParland CLA
Modified: 2017-06-21 10:02 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JohnMcParland CLA 2008-11-20 04:28:14 EST
Hi,

a bit of searching on the web reveals this is a common problem but alas the usual fix (adding a JRE to the build path) do not work.

I'm using Eclipse 3.4 with a number of related projects in my workspace.  Each of these projects has on its build path the JRE System Library jdk1.5.0_11.  Occasionally on a rebuild I will get the following error;

"The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files"

plus other similar errors (can't find class x where x should be in the JRE System Library).  

A refresh / clean / rebuild more often that not fixes the problem but this is a time consuming process and one I'd rather not repeat often.

Regards,

John
Comment 1 Kent Johnson CLA 2008-11-21 15:28:00 EST
Sorry but we're going to need a lot more information.

When your project's buildpath is incomplete, this is the error that's reported.

Has your project ever built successfully? If so, what's changed since then? New/changed jars?
Comment 2 JohnMcParland CLA 2008-11-22 05:24:36 EST
(In reply to comment #1)
> Sorry but we're going to need a lot more information.
> 
> When your project's buildpath is incomplete, this is the error that's reported.
> 
> Has your project ever built successfully? If so, what's changed since then?
> New/changed jars?
> 

The projects in the workspace have always built successfully.  This bug rears it's head every now and then sometimes upon startup of eclipse (with Build automatically checked) and sometimes when we ask eclipse to build the workspace.

The build path has changed on occasion but each time we've changed it we've got it to build.
Comment 3 Kent Johnson CLA 2008-11-24 13:40:50 EST
Is it always Object that you cannot find ? Would mean we cannot find rt.jar


"The build path has changed on occasion but each time we've changed it we've got
it to build."

What do you do to get it to build ? Does a simple restart work ?


How many people on your team experience similar problems ?


We'll need to know which steps cause the workspace to work again AND which steps do NOT appear to make a difference.

Basically without anyway to reproduce this, we'll need everyone on your team to help find what may be causing the random failures. To track this down, people cannot ignore it or do X/Y/Z to get around it.
Comment 4 Elfi Heck CLA 2008-11-27 09:29:26 EST
I have the same problem. Here's how it manifests itself for me (please pick relevant information):
- Seems to happen randomly on startup
- Seen it on Windows, Linux and OS X
- To get around the error I have to trick Eclipse into believing the ".classpath" file has changed for every affected project in the workspace (I do that usually by entering some character, deleting it again, and then saving).
- Cleaning the projects does not help
- I have quite a quite a number of projects in my workspace
- I have multiple windows open
- My Eclipse is from the Eclipse Classic download with XML editors installed via "Software Updates"
- I don't remember having seen this in Eclipse 3.x
Comment 5 oliver CLA 2008-11-30 04:10:35 EST
Hi all

I'm also struggling with this problem on a daily basis.
When starting up Eclipse I get thousands of compiler errors because java.lang.Object and java.lang.Enum are reported to be inexistent.

These are the setups where I (and my team members) encountered this behavior:
- Windows 2000 and Windows Vista SP1
- Eclipse 3.4 and 3.4.1
- JRE/JDK 1.6.0_07 and 1.6.0._10
- Workspace containing 40+ Maven2-generated Eclipse projects (most of the projects have the compiler compliance level set to "1.5". A few of them are set to "1.4" or "1.6")
- Eclipse plugin for IBM ClearCase version control integration

Refreshing and cleaning the workspace are to no avail.

Up to now I only figured out one workaround that works reliably:

- In Eclipse go to "Windows" -> "Preferences" -> "Java" -> "Installed JREs".
- Select the currently active JRE/JDK and press the "Edit" button.
- Select the "rt.jar" and change its position in the list of "JRE system libraries" (e.g. press the "Up" button once).
- Confirm all changes, clean and rebuild the workspace.

Then the next time I would face the problem I would reposition the rt.jar again (or reset the order by pressing the "Restore Default" button).

Greets, Oliver
Comment 6 Philipe Mulet CLA 2008-12-01 04:56:02 EST
This feels reminiscent of timing issues we had during our classpath computation (see bug 232478). We will need steps to reproduce.
There are also traces to activate to find out what occurred.

Jerome - could you pls engage here ?
Comment 7 Philipe Mulet CLA 2008-12-01 04:59:59 EST
Talking to Jerome, this really feels the same as bug 232478.
I think we should backport the fix attempt to 3.4.2 since others are seeing the problem as well (not just me and Dani).
Comment 8 Philipe Mulet CLA 2008-12-01 05:03:47 EST
John, Elfi & Oliver - if we did provide you with a patch to try on top of 3.4.1, would you able to test it ? (assuming this is the same issue as for bug 232478)
Comment 9 Elfi Heck CLA 2008-12-01 05:06:01 EST
Sure. Just tell me what to do.
Comment 10 oliver CLA 2008-12-01 06:08:37 EST
@Philippe: Yes, I will gladly test the patch.
Comment 11 JohnMcParland CLA 2008-12-01 06:20:48 EST
(In reply to comment #8)
> John, Elfi & Oliver - if we did provide you with a patch to try on top of
> 3.4.1, would you able to test it ? (assuming this is the same issue as for bug
> 232478)
> 

Yes I'll test this if you provide patch and instructions on how to install.

Thanks,

John
Comment 12 Jerome Lanneluc CLA 2008-12-01 11:04:27 EST
A patch for 3.4.1 is available at http://www.eclipse.org/jdt/core/patches/org.eclipse.jdt.core_fix255931.jar.

To install:
1. Shut down Eclipse
2. Rename eclipse/plugins/org.eclipse.jdt.core_3.4.2.v_883_R34x.jar 
   to eclipse/plugins/org.eclipse.jdt.core_3.4.2.v_883_R34x.jar.disabled
3. Download org.eclipse.jdt.core_fix255931.jar (from link above) to
   eclipse/plugins
4. Rename eclipse/plugins/org.eclipse.jdt.core_fix255931.jar
   to eclipse/plugins/org.eclipse.jdt.core_3.4.2.v_883_R34x.jar
5. Restart Eclipse

Please let us know if this fixes your problem.
 
Comment 13 oliver CLA 2008-12-02 02:00:37 EST
Thank you very much for your support.

The patch really seems to do the trick: I've applied it today and not a single compilation error showed up after restarting Eclipse.

I'm giving out the patch to some of my colleagues now hoping it will fix their problems as well. I'll report back how it worked out.

Greets, Oliver
Comment 14 JohnMcParland CLA 2008-12-02 12:57:47 EST
(In reply to comment #12)
> A patch for 3.4.1 is available at
> http://www.eclipse.org/jdt/core/patches/org.eclipse.jdt.core_fix255931.jar.
> 
> To install:
> 1. Shut down Eclipse
> 2. Rename eclipse/plugins/org.eclipse.jdt.core_3.4.2.v_883_R34x.jar 
>    to eclipse/plugins/org.eclipse.jdt.core_3.4.2.v_883_R34x.jar.disabled
> 3. Download org.eclipse.jdt.core_fix255931.jar (from link above) to
>    eclipse/plugins
> 4. Rename eclipse/plugins/org.eclipse.jdt.core_fix255931.jar
>    to eclipse/plugins/org.eclipse.jdt.core_3.4.2.v_883_R34x.jar
> 5. Restart Eclipse
> 
> Please let us know if this fixes your problem.
> 
> 

I've given the patch a run today and I haven't had any issues.  I tried restarting eclipse, doing a refresh, clean, rebuild cycle, running the various configurations for my projects.  Also did the normal job of editing code and seeing how it compiled etc.

One problem I have had is running eclipse with -clean.  This seems to remove the Java preferences and the Java and Java Browsing perspective.  If I do this then I need to store the old org.eclipse.jdt.core_3.4.2.v_883_R34x.jar before going back to the patch (it works in both directions I've noticed).

I'd say it is too early to say the issue is resolved but a week without any issue would be enough.  I've sent the instructions out to my team to see if it helps any of them who've had this problem.
Comment 15 Jerome Lanneluc CLA 2008-12-03 05:04:18 EST
Thanks for the feedback so far. I'll wait a week before declaring success.

John, for the -clean problem, I believe that is expected. Replacing org.eclipse.jdt.core_3.4.2.v_883_R34x.jar with another version is not really supported by the install code. But this is the only way we can provide a patch in 3.4.x. So I would suggest to not use -clean. (BTW -clean is believed to be magic and cure any diseases, but this is not true :-) )
Comment 16 JohnMcParland CLA 2008-12-03 05:15:17 EST
(In reply to comment #15)
> Thanks for the feedback so far. I'll wait a week before declaring success.
> 
> John, for the -clean problem, I believe that is expected. Replacing
> org.eclipse.jdt.core_3.4.2.v_883_R34x.jar with another version is not really
> supported by the install code. But this is the only way we can provide a patch
> in 3.4.x. So I would suggest to not use -clean. (BTW -clean is believed to be
> magic and cure any diseases, but this is not true :-) )
> 

(In reply to comment #15)
> Thanks for the feedback so far. I'll wait a week before declaring success.
> 
> John, for the -clean problem, I believe that is expected. Replacing
> org.eclipse.jdt.core_3.4.2.v_883_R34x.jar with another version is not really
> supported by the install code. But this is the only way we can provide a patch
> in 3.4.x. So I would suggest to not use -clean. (BTW -clean is believed to be
> magic and cure any diseases, but this is not true :-) )
> 

Re: the -clean problem.  I thought that might be the case but best to check.  I'll continue testing the patch in the normal manner.
Comment 17 Elfi Heck CLA 2008-12-03 07:19:03 EST
I admit I haven't been as diligent in testing as John, but I haven't seen that kind of build path problems either since installing the patch.
Comment 18 Jerome Lanneluc CLA 2008-12-12 10:08:05 EST
Can I assume that this silence means that the patch fixed the problem for everyone?
Comment 19 JohnMcParland CLA 2008-12-12 10:53:16 EST
(In reply to comment #18)
> Can I assume that this silence means that the patch fixed the problem for
> everyone?
> 

Yes I'm happy the issue is resolved.  When can I expect to see it wrapped in a formal patch?  What will the build number be?
Comment 20 Philipe Mulet CLA 2008-12-12 11:13:30 EST
The patch is released for inclusion in 3.4.2, and already in 3.5 stream (e.g. if you grab 3.5M4, you are all set).
Comment 21 JohnMcParland CLA 2008-12-12 11:16:00 EST
(In reply to comment #20)
> The patch is released for inclusion in 3.4.2, and already in 3.5 stream (e.g.
> if you grab 3.5M4, you are all set).
> 

Thanks
Comment 22 oliver CLA 2008-12-15 01:54:10 EST
(In reply to comment #18)
> Can I assume that this silence means that the patch fixed the problem for
> everyone?
> 

Yes, Eclipse works like a charm now.
Comment 23 Jerome Lanneluc CLA 2008-12-15 05:03:26 EST
Thanks. Closing as a dup of bug 232478 then (since the patch was the fix for bug 232478).

*** This bug has been marked as a duplicate of bug 232478 ***
Comment 24 Frederic Fusier CLA 2009-02-03 12:01:24 EST
Verified by users for 3.4.2
Comment 25 Frederic Fusier CLA 2009-03-04 11:56:27 EST
*** Bug 267045 has been marked as a duplicate of this bug. ***
Comment 26 Soumya Pattanayak CLA 2017-06-21 09:49:45 EDT
I am unable to get the patch from below link.it shows me "404 File not found" error on screen.

http://www.eclipse.org/jdt/core/patches/org.eclipse.jdt.core_fix255931.jar.

Please help me how to get above patch or any eclipse version which has the above patch .

Any help would be highly appreciated.
Comment 27 Soumya Pattanayak CLA 2017-06-21 09:55:03 EDT
I am using Eclipse Luna with JDK1.8 and my source code compiler level is 1.8.
Comment 28 Soumya Pattanayak CLA 2017-06-21 10:02:30 EDT
facing below issue while i  am using Eclipse Luna with JDK1.8 and my source code compiler level is 1.8.

Generated servlet error:
The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files