org.eclipse.swt.SWTError: Item not added - eclipse

Does somebody know how to recover a never-starting eclipse when the error "org.eclipse.swt.SWTError: Item not added" is raising againg and again?
I'm using WebSphere Studio Site Developer (Windows) 5.1.0
The only stack trace in the .metadata/log file is:
SESSION ----------------------------------------------------------------------
!ENTRY org.eclipse.core.launcher 4 0 sep 17, 2008 16:39:00.564
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.reflect.InvocationTargetException: java.lang.reflect.InvocationTargetException: org.eclipse.swt.SWTError: Item not added
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at org.eclipse.swt.SWTError.<init>(SWTError.java:82)
at org.eclipse.swt.SWTError.<init>(SWTError.java:71)
at org.eclipse.swt.SWT.error(SWT.java:2358)
at org.eclipse.swt.SWT.error(SWT.java:2262)
at org.eclipse.swt.widgets.Widget.error(Widget.java:385)
at org.eclipse.swt.widgets.Menu.createItem(Menu.java:464)
at org.eclipse.swt.widgets.MenuItem.<init>(MenuItem.java:77)
at org.eclipse.ui.internal.AcceleratorMenu.setAccelerators(AcceleratorMenu.java:177)
at org.eclipse.ui.internal.WWinKeyBindingService.updateAccelerators(WWinKeyBindingService.java:316)
at org.eclipse.ui.internal.WWinKeyBindingService.clear(WWinKeyBindingService.java:175)
at org.eclipse.ui.internal.WWinKeyBindingService.update(WWinKeyBindingService.java:267)
at org.eclipse.ui.internal.WWinKeyBindingService$1.partActivated(WWinKeyBindingService.java:107)
at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:49)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1006)
at org.eclipse.core.runtime.Platform.run(Platform.java:413)
at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:47)
at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:1180)
at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:1833)
at org.eclipse.ui.internal.WorkbenchWindow$7.run(WorkbenchWindow.java:1496)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:1483)
at org.eclipse.ui.internal.WorkbenchWindow.restoreState(WorkbenchWindow.java:1363)
at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1263)
at org.eclipse.ui.internal.Workbench.access$10(Workbench.java:1223)
at org.eclipse.ui.internal.Workbench$12.run(Workbench.java:1141)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1006)
at org.eclipse.core.runtime.Platform.run(Platform.java:413)
at org.eclipse.ui.internal.Workbench.openPreviousWorkbenchState(Workbench.java:1093)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:870)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1373)
at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
at java.lang.reflect.AccessibleObject.invokeL(AccessibleObject.java:207)
at java.lang.reflect.Method.invoke(Method.java:271)
at org.eclipse.core.launcher.Main.basicRun(Main.java:291)
at org.eclipse.core.launcher.Main.run(Main.java:747)
at org.eclipse.core.launcher.Main.main(Main.java:583)

I had exactly the same problem. I did not restart my machine, and just used "eclipse -clean" to start eclipse. It worked. Thanks Jon for the hint.

Does restarting your computer resolve the problem with being able to open the workspace? There is a forum post (http://forums.sun.com/thread.jspa?messageID=3131484#3131484) that describes a similar problem with an identical stack trace as the one shown above. In the post, the author mentions that their machine was low on resources (they did not specify what type of resources were running low).
If restarting your computer does not work, you may want to try starting eclipse with the clean option:
eclipse -clean
The clean option will clean out any caches that Eclipse has created.
If all else fails, you may want to open a bug for this problem at https://bugs.eclipse.org/bugs/. Including a copy of your workspace (if possible), and including the stack trace in the bug would be helpful information for the person trying to diagnose the problem.
Good Luck!

Well, some things you can try are:
Delete workspace .metadata dir. Obviously you will lose your workbench configuration.
Rename your .metadata dir. Start Eclipse, and you will have a new .metadata dir. Close Eclipse, delete the new dir, and rename back the original dir. It sometimes works.

HI,
Check the task manager, whether any java process(java.exe or javaw.exe) running even after the closing of workbench. Kill those processes. You will get this error resolved

For me, I think this has something to do with my dual monitor setup and Actual Multiple Monitors that I have installed. I disabled that and the problem is gone.

This worked when I moved the eclipse.ini from the eclipse install folder (where .exe is present). I ran into this problem when I was trying to increase the heap size in the eclipse.ini file (although I had seen this error earlier)

Related

Eclipse bug on start up, how do I fix it?

When i try to run Eclipse Neon, I get an error message saying "An Error has occurred. See the log file F:\path\to\workspace.metadata.log."
Upon viewing the log, I found this:
!ENTRY org.eclipse.recommenders.models.rcp 1 9 2016-07-08 23:06:53.728
!MESSAGE The model index service was accessed either before it started or after it finished running.
!STACK 0
org.eclipse.recommenders.utils.Logs$LogTraceException
at org.eclipse.recommenders.utils.Logs$LogTraceException.newTrace(Logs.java:381)
....
Any ideas what is causing this, and how I fix it? I tried using good old Google, but all I got was that it is a reported bug that has been fixed, yet I am still getting the problem? Reinstalling eclipse didn't fix the problem either.
This is common issue. There are two fixes:
#1
X:\WhereWS_Is\Workspaces\name_of_workspace\.metadata\.plugins\org.eclipse.core.resources\
Here delete .snap file. Eclipse will start normally then.
If not solved then second fix is a bit Heavy as it deletes all preferences etc.
#2
X:\WhereWS_Is\Workspaces\name_of_workspace\.metadata\.plugins\org.eclipse.e4.workbench\
Here delete(not permanently) workspace file. After starting Eclipse, IDE will re generate this file after all setup, paste that file again to get all your preferences.
Both tried, both worked for me. Hope this helps someone.
Okay, so i reinstalled Eclipse, still the bug.
I reinstalled JDK, still the bug.
I deleted my workspace (backed up my projects first), created a new workspace and copied my projects into that, and the problem seems to have gone for now. I still don't understand what caused it exactly, but it is now fixed.

Eclipse Build Error "A class file was not written. The project may be inconsistent, if so try refreshing this project and building it"

I have been struggling with a very weird issue that has suddenly popped up on the latest version of Eclipse Classic (4.2.2).
Everytime I try creating or refactoring a class or subclass in any of my projects (all Java) in my Eclipse workspace I get an error at the very top of my class that says
A class file was not written. The project may be inconsistent, if so try refreshing this project and building it
Again, this happens when I create new classes. And even when I rename current classes, then undo the renaming, its totally fine, but changing a single character in the name causes this error to happen for that specific class.
I have Auto Build on, and I tried multiple times to clean and refresh every project as well as restart Eclipse entirely.
I have literally no idea how to even start figuring out how to fix this. The solutions i've found through search didn't help, so i'm hoping I might find any clues here.
I had the same problem and here's how I solved it in the end:
It turned out that the disc space on the drive where workspace resides was full.
Silly mistake but worth checking.
In my case, this was caused by the fact that the build output directories were owned by a different user, and Eclipse could not write into them.
I had the same issues, the following worked for me:
Right click eclipse then running "as an Administrator"
Click Project > Clean.
Clean your workspace by starting eclipse from the command line with the -clean argument :
eclipse -clean
See also How to run eclipse in clean mode? and what happens if we do so?
I solved this problem by running Eclipse as root.
I had the same issue on Mac OS X. I had a maven project.
Try running the following command on Terminal. This looks like an access issue.
sudo mvn clean
Provide password for admin user.
Then open Eclipse and refresh your project.
We are using Eclipse here too and have to handle a workspace with more than 200 plug-ins. Every now and then people have similar problems with their workspace and inconsistencies reported in a weird way by Eclipse.
What people here usually do is (next step only in case previous step didn't help):
- trying to ContextMenu->Team->Clean/Refresh the whole workspace
- creating a new workspace and check out all necessary files from the repository
- reinstalling Eclipse to a new directory
From my experience after using the Eclipse IDE on a daily basis for many years, it doesn't make very much sense to waste too much time with these issues, unless they aren't solved by one of the steps above. It takes too much time to struggle with these things, while starting from scratch is done in an hour or less (and usually fixes the issue).
If your Eclipse still behaves strangely it might make sense to go through your installed plug-ins. Not all external plug-ins follow the Eclipse guidelines and can seriously harm the performance and operational consistency of your Eclipse installation (E.g. Sonar Plug-in, Toad Plug-in, ...)
In my case this kind of error caused due to disk space got full and it got resolved by just freeing disk space where eclipse have been installed.
That is c/d/e drivers.
I come up with the same error, and in my case, this is because the permission of the project/bin directory is not recursively 775
I fixed it by:
Remove the project/bin directory: sudo rm -rf project/bin
Switch to Eclipse, rebuild the project: Project->Clean...
Then no errors.
Try to launch Eclipse as Administrator.
In my case such error was caused by a question mark in a quoted method name (I use geb+spock combination for automated testing).
So this method name will throw an error "Do you want something?"()
And this will not "Do you want something"()
It may not be the best response but to fix it, I've just delete the error marker.
Had the same issue. but cleaning the project and restart eclipse didn't help and disk space was not the issue. Solved the issue by copy the code to notepad(just to not lose it) and then delete the class, recreate it and paste the code back in again.
I solved it changed the owner of the project files. I changed from root(old owner) to user my current(user that i use with eclipse).
Just changed and saved java file to recompile the class. Then error disappeared.
I was try run
Project->Clean...
And Rebuild. My problem was resolved
For linux (Debia) and working on Spring boot project (maven):
$ sudo mvn clean
Then open Eclipse and File -> Refresh.
I had same issue, it is something similar but this post didn't help in my case. I have many inner classes which is causing the compiler to create class names with all inner class names together that is creating class name more than 255 character file limit on NTFS! read it in some other blog. I thought it will be helpful to post here.
Ex : classA$InnerClassB$......InncerClassZ.class in target folder it won't generate the class if it exceeds this limit. Try renaming your inner class name shortened. In my case i have to add InnerclassZ as its exceeding its not generating class and Eclipse complaining.
A class file was not written. The project may be inconsistent, if so try refreshing....
I shortened InnerClassZ to IClassZ fixed the issue.
I had the same issue and it got fixed by running eclipse in administrator mode
Eclipse Shortcut-->Right click-->More-->Run as Administrator
I've been throught that error once when I used wsdl2java to extract java classes from a wsdl, it turns out that all classes were created in the same "class", causing end classes with long names (error - File name too long). When I organized and rename some classes the error disappeared.
I had this issue. I did the following, it resolved.
Open Eclipse in Administrator mode; Right click on eclipse.exe "Run as administrator"
Clean all projects.
#Denny's answer put me on the right track, though in my case it was the target directory. I deleted it for some reason and something automatically recreated with owner root. Changing the directory owner was not enough as it contained files that were also owned by root. So make sure to really remove the complete content of the directory and to change the owner.
In my case current user didn't have access to this project dir
Before giving a try to the above solutions. Just cleaned the project and it worked.

Error opening Eclipse

I am unable to open Eclipse IDE. The error displayed is as below
Any idea what could be the reason? And how do I solve this??
Note: I ran CCleaner recently (any registry issue??) and I got error executing my open Eclispe project. On restarting I get this issue. Is re-installation going to help? Am going to do that and update result here. And I would really like to know what caused this for future precautions.
Update: Same error for new installation. But this time got error regarding lauching JVM and missing dlls so going to reinstall Java.
Unable to understand what might be the exact problem , still giving it a shot.
Did you go through this URL http://michaelzanussi.com/?p=468
Appears to be the same issue , resetting JAVA_HOME and PATH solved the issue for him
The authors of Eclipse strongly recommend manually updating the Eclipse.ini file to point directly to the JRE that you want to use rather than relying on Windows environment variables.
Also C:\Windows\System32 is a really strange place to find the Java Runtime Environment files, typically they wind up in C:\Program Files\Java or C:\Program Files (x86)\Java.

Eclipse Indigo is unable to read repository (update sites)

First of all this question has been asked at least twice.
I tried several approaches with no effect.
Here's the problem:
When I try to download/update plugins like EclEmma, Eclipse starts to communicate with the repository and that takes about 5 minutes. After that I get an error:
"An error occured while collecting items to be installed
session context was:(...)
Unable to read repository at http: (...)
Read time out
(... for every *.jar)"
What I was trying to fix the problem was running eclipse as an admin (got vista x86 running) and changing the connection properties from native to direct and back. I also tried deleting saved repositories and adding again. No effect at all.
I have no proxy configured and don't need one.
This is getting kind of personal between me and my IDE :D
So I hope you guys can help me out.
Thanks Zoltán (köszi :D), but i found the error last night.
Resolution
After hours of debugging I figured out that AVG Anti-Virus Software blocks the request. After deactivating it for temporarily, Eclipse installed the new software.
In my case timeout was caused by definition of SOCKS proxy... we have proxy.company.com:80 and I incorrectly provided that proxy to all three (HTTP, HTTPS and SOCKS) connection schemas. Removal of proxy from SOCKS resolved the problem
Try to open the internal web browser of Eclipse (Window menu/Show view/Other...), and navigate to the 1) update site url, and 2) to any webpage.
If the latter one is not working, then Eclipse does not have connection to the internet, and you should try to open a new workspace, and try installing from there (possibly something wrong in the workspace settings).
If the second one works, but the first one does not, that suggests that the update site is not working. In this case report to the developers.
I also had this problem (my system: Win7, jdk7, Eclipse Indigo).
I installed jre6, changed my JAVA_HOME, ran eclipse with the following:
eclipse -debug -consolelog -vm 'c:\Program Files\Java\jre6\bin\java.exe'
Install the plugins/updates, then switch back to using jdk7.
Worked for me!
Temporarily disabling AVG firewall fixed the issue for me.
Eclipse then installed the Android plugin.
In my case, adding these lines to eclipse.ini solved the problem
-vmargs (this one was alreayd there)
-Djava.net.preferIPv4Stack=true

Problems occurred while trying to save the state of the workbench in Eclipse

I have a problem each time I close Eclipse (Helios Release 1 in Windows Vista). This is the error log:
Problems occurred while trying to save the state of the workbench.
Problems occurred during save.
Problems while saving variables and containers
C:\Users...(workspace dir)....metadata.plugins\org.eclipse.jdt.core\variablesAndContainers.dat (Access Denied)
When I started using Eclipse I used to have the workspace in different directory. Then I moved it to a different location. On loading the workspace it works correct.
Any ideas how to fix it?
To fix go to your workspace and delete the .metadata folder. Restart eclipse and point it to where the old workspace was and load projects using File -> New.
You can only load one by one but at least it solved the issues
It seems like the problems is now solved. I managed to do that in an unorthodox (in my opinion) way. It seemed that there was an access problem. Eclipse didn't have access to its own .dat files. Probably because of some windows-eclipse misunderstanding. I tried to delete the files that were making an error and Eclipse created them again. Like that, problem was solved.
Best way is looking into WORKSPACE/.metadata/.log where Eclipse spits out all everything what's wrong. Maybe there is just one small file to kill or unlock. So you don't need to import all former projects from scratch
I fixed it by going into:
workspace\.metadata\.plugins\org.eclipse.jdt.core\.org.eclipse.jdt.core.external.folders
I unhid the .project file and granted permission to the file for system, admins etc.
My problem was solved
I'm not sure if the problem is the same but in my case was the Controlled folder access in the windows defender that was the source of my error.
I turned off in the Virus # Thread protection settings and restarted eclipse and was OK.