java.lang.ClassCastException: org.eclipse.jdt.internal.core.JavaProject cannot be cast to org.eclipse.jdt.core.IPackageFragment

pmd | vorburger | 5 months ago
  1. 0

    [eclipse] ClassCastException at ProjectRecord.addToJavaProject

    pmd | 5 months ago | vorburger
    java.lang.ClassCastException: org.eclipse.jdt.internal.core.JavaProject cannot be cast to org.eclipse.jdt.core.IPackageFragment
  2. 0

    {html}<div><p>I keep seeing error dialogs popping up when working with Java code in a dev instance of Eclipse. Here's the stacktrace:</p> <pre> <code>!ENTRY org.eclipse.ui 4 0 2011-06-06 14:30:25.009 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.ClassCastException: org.eclipse.jdt.internal.core.JavaProject cannot be cast to org.eclipse.core.resources.IResource at com.aptana.deploy.internal.ProjectPropertyTester.test(ProjectPropertyTester.java:33) at org.eclipse.core.internal.expressions.Property.test(Property.java:58) at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:99) at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53) at org.eclipse.core.internal.expressions.IterateExpression.evaluate(IterateExpression.java:150) at org.eclipse.ui.internal.services.EvaluationResultCache.evaluate(EvaluationResultCache.java:74) at org.eclipse.ui.internal.services.ExpressionAuthority.evaluate(ExpressionAuthority.java:165) at org.eclipse.ui.internal.services.EvaluationAuthority.refsWithSameExpression(EvaluationAuthority.java:153) at org.eclipse.ui.internal.services.EvaluationAuthority.sourceChanged(EvaluationAuthority.java:129) at org.eclipse.ui.internal.services.ExpressionAuthority.sourceChanged(ExpressionAuthority.java:311) at org.eclipse.ui.internal.services.ExpressionAuthority.sourceChanged(ExpressionAuthority.java:290) at org.eclipse.ui.AbstractSourceProvider.fireSourceChanged(AbstractSourceProvider.java:99) at org.eclipse.ui.internal.services.WorkbenchSourceProvider.checkActivePart(WorkbenchSourceProvider.java:401) at org.eclipse.ui.internal.ShowInMenu.fillMenu(ShowInMenu.java:175) at org.eclipse.ui.internal.ShowInMenu.fill(ShowInMenu.java:125) at org.eclipse.jface.action.MenuManager.doItemFill(MenuManager.java:741) at org.eclipse.jface.action.MenuManager.update(MenuManager.java:822) at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:474) at org.eclipse.jface.action.MenuManager.access$1(MenuManager.java:469) at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:495) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:247) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4125) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1461) at org.eclipse.swt.widgets.Menu.menuWillOpen(Menu.java:805) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5522) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:4876) at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5223) at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method) at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:94) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3604) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410)</code> </pre></div>{html}

    Appcelerator JIRA | 6 years ago | Chris Williams
    java.lang.ClassCastException: org.eclipse.jdt.internal.core.JavaProject cannot be cast to org.eclipse.core.resources.IResource
  3. 0

    Project properties menu item javascript | closure, selection yields 'the currently displayed page contains invalid values'

    GitHub | 4 years ago | jackphel
    java.lang.ClassCastException: org.eclipse.jdt.internal.core.JavaProject cannot be cast to org.eclipse.core.resources.IProject
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Catch wrong path configuration in test class when executing test file

    GitHub | 3 years ago | joergreichert
    java.lang.ClassCastException: org.eclipse.jdt.internal.core.JavaProject cannot be cast to java.lang.ClassLoader
  6. 0

    JS: ClassCastException if project has the Java Nature

    GitHub | 5 years ago | vtst
    java.lang.ClassCastException: org.eclipse.jdt.internal.core.JavaProject cannot be cast to org.eclipse.core.resources.IResource

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.eclipse.jdt.internal.core.JavaProject cannot be cast to org.eclipse.jdt.core.IPackageFragment

      at net.sourceforge.pmd.eclipse.ui.model.ProjectRecord.addToJavaProject()
    2. net.sourceforge.pmd
      ViolationOverviewContentProvider.resourceChanged
      1. net.sourceforge.pmd.eclipse.ui.model.ProjectRecord.addToJavaProject(ProjectRecord.java:405)
      2. net.sourceforge.pmd.eclipse.ui.model.ProjectRecord.addResource(ProjectRecord.java:286)
      3. net.sourceforge.pmd.eclipse.ui.views.ChangeEvaluator.searchProjectForModifications(ChangeEvaluator.java:182)
      4. net.sourceforge.pmd.eclipse.ui.views.ChangeEvaluator.updateFiles(ChangeEvaluator.java:121)
      5. net.sourceforge.pmd.eclipse.ui.views.ChangeEvaluator.changeRecordFor(ChangeEvaluator.java:81)
      6. net.sourceforge.pmd.eclipse.ui.views.ViolationOverviewContentProvider.resourceChanged(ViolationOverviewContentProvider.java:330)
      6 frames
    3. Core Resource Management
      NotificationManager$1.run
      1. org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:299)
      1 frame
    4. Eclipse Core
      SafeRunner.run
      1. org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      1 frame
    5. Core Resource Management
      Resource.deleteMarkers
      1. org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:289)
      2. org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:152)
      3. org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:374)
      4. org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1469)
      5. org.eclipse.core.internal.resources.Resource.deleteMarkers(Resource.java:828)
      5 frames
    6. net.sourceforge.pmd
      UpdateProjectPropertiesCmd.execute
      1. net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil.deleteMarkersIn(MarkerUtil.java:210)
      2. net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil.deleteAllMarkersIn(MarkerUtil.java:201)
      3. net.sourceforge.pmd.eclipse.runtime.builder.PMDNature.removePMDNature(PMDNature.java:118)
      4. net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.storeProjectProperties(ProjectPropertiesManagerImpl.java:141)
      5. net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesImpl.sync(ProjectPropertiesImpl.java:378)
      6. net.sourceforge.pmd.eclipse.ui.properties.UpdateProjectPropertiesCmd.execute(UpdateProjectPropertiesCmd.java:93)
      6 frames
    7. name.herlin.command
      AbstractProcessableCommand.performExecute
      1. name.herlin.command.DefaultCommandProcessor.processCommand(DefaultCommandProcessor.java:47)
      2. name.herlin.command.AbstractProcessableCommand.performExecute(AbstractProcessableCommand.java:62)
      2 frames
    8. net.sourceforge.pmd
      PMDProjectPropertyPage.performOk
      1. net.sourceforge.pmd.eclipse.ui.properties.PMDPropertyPageController.performOk(PMDPropertyPageController.java:161)
      2. net.sourceforge.pmd.eclipse.ui.properties.PMDProjectPropertyPage.performOk(PMDProjectPropertyPage.java:549)
      2 frames
    9. JFace
      PreferenceDialog$8.run
      1. org.eclipse.jface.preference.PreferenceDialog$8.run(PreferenceDialog.java:905)
      1 frame
    10. Eclipse Core
      SafeRunner.run
      1. org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      1 frame
    11. Eclipse UI
      JFaceUtil$1.run
      1. org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
      1 frame
    12. JFace
      PreferenceDialog.okPressed
      1. org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
      2. org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:889)
      2 frames
    13. Workbench
      FilteredPreferenceDialog.okPressed
      1. org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:409)
      1 frame
    14. JFace
      Dialog$2.widgetSelected
      1. org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:230)
      2. org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618)
      2 frames
    15. RWT
      Display.readAndDispatch
      1. org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
      2. org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      3. org.eclipse.swt.widgets.Display.sendEvent(Display.java:5219)
      4. org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
      5. org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4553)
      6. org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4143)
      6 frames
    16. JFace
      Window.open
      1. org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
      2. org.eclipse.jface.window.Window.open(Window.java:794)
      2 frames
    17. Eclipse UI
      PropertyDialogAction.run
      1. org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:157)
      1 frame
    18. JFace
      ActionContributionItem.lambda$4
      1. org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
      2. org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
      3. org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
      3 frames
    19. RWT
      Display.readAndDispatch
      1. org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      2. org.eclipse.swt.widgets.Display.sendEvent(Display.java:5219)
      3. org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
      4. org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4553)
      5. org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4143)
      5 frames
    20. Eclipse Workbench SWT
      PartRenderingEngine$4.run
      1. org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
      1 frame
    21. Databinding
      Realm.runWithDefault
      1. org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
      1 frame
    22. Eclipse Workbench SWT
      PartRenderingEngine.run
      1. org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
      1 frame
    23. Eclipse Workbench
      E4Workbench.createAndRunUI
      1. org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
      1 frame
    24. Eclipse UI
      Workbench$5.run
      1. org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
      1 frame
    25. Databinding
      Realm.runWithDefault
      1. org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
      1 frame
    26. Eclipse UI
      Workbench.createAndRunWorkbench
      1. org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
      1 frame
    27. Eclipse UI
      PlatformUI.createAndRunWorkbench
      1. org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
      1 frame
    28. Eclipse IDE
      IDEApplication.start
      1. org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
      1 frame
    29. Equinox Container
      EclipseAppHandle.run
      1. org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
      1 frame
    30. Eclipse OSGi
      EclipseStarter.run
      1. org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
      2. org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
      3. org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
      4. org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
      4 frames
    31. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    32. Equinox
      Main.main
      1. org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
      2. org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
      3. org.eclipse.equinox.launcher.Main.run(Main.java:1519)
      4. org.eclipse.equinox.launcher.Main.main(Main.java:1492)
      4 frames