Eclipse error: Resource '/project-name' does not exist - java

There's a single project in one of my working sets that completely broke my Eclipse. I can't refresh it, I can't close it, I can't delete it. Usually, the way I fix other projects is by deleting them in Eclipse and reimporting them. I can't do that for this one. Because of that, I can't use this working set, there's walls of error everytime there's a SVN status cache refresh.
I don't know where the resource should be, where Eclipse is looking for it. The project-name folder does exist in \workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\. Where else should I look?
In the error log, there are tons of Resource '/project-name' does not exist. errors. Same message, different stack trace depending on the call. An example:
org.eclipse.core.internal.resources.ResourceException(/project-name)[368]: java.lang.Exception: Resource '/project-name' does not exist.
at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:39)
at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:35)
at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:327)
at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:201)
at org.eclipse.core.internal.resources.Project.checkAccessible(Project.java:142)
at org.eclipse.core.internal.resources.Project.getDescription(Project.java:394)
at org.eclipse.wst.validation.internal.ValidationRegistryReader.getValidatorMetaData(ValidationRegistryReader.java:817)
at org.eclipse.wst.validation.internal.ValidationRegistryReader.getValidatorMetaData(ValidationRegistryReader.java:795)
at org.eclipse.wst.validation.internal.ValidationRegistryReader.isConfiguredOnProject(ValidationRegistryReader.java:1053)
at org.eclipse.wst.validation.internal.ProjectConfiguration.extractProjectValidators(ProjectConfiguration.java:259)
at org.eclipse.wst.validation.internal.ProjectConfiguration.getValidators(ProjectConfiguration.java:145)
at org.eclipse.wst.validation.internal.EventManager.closing(EventManager.java:96)
at org.eclipse.wst.validation.internal.EventManager.resourceChanged(EventManager.java:248)
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:297)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:287)
at org.eclipse.core.internal.events.NotificationManager.handleEvent(NotificationManager.java:251)
at org.eclipse.core.internal.resources.Workspace.broadcastEvent(Workspace.java:371)
at org.eclipse.core.internal.resources.Project.close(Project.java:190)
at org.eclipse.ui.actions.CloseResourceAction.invokeOperation(CloseResourceAction.java:168)
at org.eclipse.ui.actions.WorkspaceAction.execute(WorkspaceAction.java:156)
at org.eclipse.ui.actions.WorkspaceAction$1.runInWorkspace(WorkspaceAction.java:456)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
When I try to close the project, I get this nullPointerException:
An internal error occurred during: "Close Project".
java.lang.NullPointerException
at org.eclipse.core.internal.resources.Project.internalGetActiveBuildConfig(Project.java:752)
at org.eclipse.core.internal.resources.Project.getActiveBuildConfig(Project.java:349)
at org.eclipse.core.internal.resources.SaveManager.getTreesToSave(SaveManager.java:1879)
at org.eclipse.core.internal.resources.SaveManager.writeTree(SaveManager.java:2030)
at org.eclipse.core.internal.resources.SaveManager.writeTree(SaveManager.java:2075)
at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1216)
at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1145)
at org.eclipse.core.internal.resources.Project.close(Project.java:194)
at org.eclipse.ui.actions.CloseResourceAction.invokeOperation(CloseResourceAction.java:168)
at org.eclipse.ui.actions.WorkspaceAction.execute(WorkspaceAction.java:156)
at org.eclipse.ui.actions.WorkspaceAction$1.runInWorkspace(WorkspaceAction.java:456)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
How can I fix this?
(I use project-name in lieu of the actual project name.)

Hmm, might there be some handles alive? The error seems to indicate eclipse's not able to flush the closing-project change - if possible you could maybe try shutting the jvm instances.
If you didn't already, try to remove project from the working set(configure working sets -> edit) /remove the working set and create again without the plugin.
When importing - do you copy the project to the workspace or leave in the original place? I know you have already imported the project so it's just a thought for future I found myself useful :)

Related

Eclipse: Could not find or load main class classnotfoundexception (with fix)

I have had this problem for years and years now where Eclipse would sometimes, seemingly for no reason, throw this error:
Error: Could not find or load main class [main-class] Caused by: java.lang.ClassNotFoundException: [main-class]
This error fires despite the class being in the file system and having previously worked with no flaws. Project clean does not fix it, and the filepath is completely valid. Consequent Google Searches usually turn up recommending that it's one of those two problems, or that you have to completely delete the project, or create a new workspace - so on.
I'm not sure what the exact cause of this problem is, and I haven't ever really been able to find one neither. However I had found a relatively simple fix for correcting it.
To fix this problem, what I've learned is that for some reason it tends to be Run Configuration itself. What you can do is:
Click "Run" in the toolbar
Click "Debug Configurations"
Create a new Run Configuration (However, don't just copy and paste the old one - for some reason this doesn't always fix the problem for me)
Set it up appropriately for the class, you can however copy the parameters from the old
Save and use that as the new run configuration for your program
This has generally fixed the problem for me most times. Hopefully someday Eclipse will have this properly fixed.
My current Eclipse version is 2021-12 (4.22.0)
I don't know if I did this self-answered question thing correctly, but for those of you who are banging your heads against your keyboard on Google right now trying to fix this, I hope this helps.

Could not add entry ':app:sourceSets' to cache taskArtifacts.bin

Very new to programming and Android Studio.
Getting a problem when trying to run my program, can anybody help?
FAILURE: Build failed with an exception.
What went wrong:
Could not add entry ':app:sourceSets' to cache taskArtifacts.bin (/Users/marcelgarvey/AndroidStudioProjects/SimpleTipCalculator/.gradle/2.4/taskArtifacts/taskArtifacts.bin).
Unable to store task input properties. Property 'config' with value 'com.android.build.gradle.AppExtension_Decorated#a8d1ae3' cannot be serialized.
I know nothing (well I do), but I'm kinda new to Android Studio as well.
Seeing as I just sumpled into the same problem, and google pointed here, I thought I'd add my observations/fix.
What created the problem:
I accidentally double-clicked sourceSets under the Gradle pane. (:app/Tasks/android/sourceSets)
And whenever building the project the same error came up.
What happened/fixed it:
It had changed the build profile (right next to the Run and Debug buttons), to something about that sourceSets.
Changing the build profile back fixed the problem.
Just remove the file: taskArtifacts.bin localised in the .gradle folder, and put a space on gradle file and sync.
I am also having this issue. I think this might be a bug in Gradle. Here is some information I was able to find:
"This exception indicates that Gradle cannot persist the Task execution state when the Task successfully completes, because some element in the Task state is not Serializable." (Source)
It appears that sourceSetsTask has a property called "config" of type AndroidConfig that is not serializable, and that's what is causing the error. (Source)

Eclipse can't find source when debugging java code

I am new to Java and started with Eclipse Kepler Service Release 1. I started a small project that contains two classes, each in its own file:
MIDI_Wrap_Test - a main (program) class
MIDI_Wrap - another class (MIDI_Wrap) which is intended as a MIDI wrapper. -
Both classes are in the same directory with file names being the same as the class name (with .java added of course). Something goes wrong and I want to debug it. However, when control transfers from the main program to the MIDI_Wrap file/class I get the error message 'source not found'.
I found out that this is a quite common error. The question and answer that seem to mirror my problem perfectly is found here. I added the project to the debug source path, noticing that the correct directories were already added but to no avail.
I must be doing something wrong but am not able to find out what. Can someone help me out of this?
I solved by shutting down eclipse and reopened it. This solved me, and code can be debug with source code view.

Publish failed using Ant publisher (Eclipse/datanucleus)

I am being driven mad the following (apparently hard) error from eclipse.
Publish failed using Ant publisher
Resource is out of sync with the file system: '/MyServlet/build/classes/com/inver/hotzones/database/BaseNetworkData.class'.
I have seen comments on similar errors where refreshing eclipses view of the project helps but it is not helping me. Have tried cleaning the project, removing it from the webserver, deleting war files but cant seem to clear it. I have reset my TMPDIR variable so that it uses a directory on the same filesystem as that appeared to be another possible cause.
The error occurs on classes which have been enhanced by datanuculeus. I have auto-enhance on the project. The other references to this problem indicate that it is due to Eclipses view of the project being out of step with the filesystem, and I am guessing that this has something to do with thedata nucleus enhancement.
Any ideas?
Thanks.
I am using Eclipse 3.5.2 with latest datanucleus pluggins.
Stack trace
org.eclipse.core.runtime.CoreException: Resource is out of sync with the file system: '/MyServlet/build/classes/com/inver/hotzones/database/BaseNetworkData.class'.
at org.eclipse.jst.server.generic.core.internal.publishers.AbstractModuleAssembler.copyModule(AbstractModuleAssembler.java:172)
at org.eclipse.jst.server.generic.core.internal.publishers.WarModuleAssembler.assemble(WarModuleAssembler.java:31)
at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.assembleModule(AntPublisher.java:167)
at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.publish(AntPublisher.java:128)
at org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour.publishModule(GenericServerBehaviour.java:82)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:949)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1039)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:872)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:708)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:2731)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:278)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Error: Unable to fnd class R.java No such file or dir

I keep getting this when trying to start a new project
ERROR: Unable to open class file C:\Users\Levi\Desktop\Android\workspace\Droid1\gen\com\androidbook\droid1\R.java: No such file or directory
I tried changing preferences to alter build path to project, but it still wouldnt work,,,
Is subfolder on desktop a bad place to install Eclipse?
Clean works sometimes and should be tried. I also find that blowing away the gen directory and refreshing will cause it be to rebuilt. Try that as well.
However, sometimes even that doesn't work and I've been forced to remove the project from Eclipse and then re-import it. This, unfortunately, works for me every time if the above has not.
Good luck.
Im also getting that error, running a Project->Clean in Eclipse helps for me.
Project->Clean should certainly fix this (unless your resources won't compile for some seperate reason).
I remember that the first time I ran Eclipse (in mid 2009, can't remember if it was Galileo or Ganymede or whatever) on Windows Vista, it presented several problems that were eventually traced to Eclipse itself being in a directory whose path contained a space...
Usually, the above tips (refresh, clean) work for me. But lately I had a very persistant instance of this error, which was caused by something else:
One of the layout .xml files in res/layout contained a reference to a custom view (org.company.project1.MyView). However, I had changed the package path (org.company.project2.MyView), so the reference had become invalid.
Thus, if everything fails try browsing your layout .xml files for invalid custom element definitions.
Cheers
after spending hours trying to ultimatly discover the issue behind the Class Issue not being found, resolved,or directory not there issue....
sometimes yes the issue is due to a bad binary or xml... as sometime a clean will do the trick or a xml edit will solve the day.. when all else fails.... this may do it..
"create a new workspace"
go into the workspace.... and then
Switch to your old workspace... in the newly formed workspace...
this was my silver bullet. so frustrating to not have a solid answer.
using Version: Helios Service Release 2
Build id: 20110218-0911

Categories