启动时出现Eclipse错误:通知首选项更改侦听器时出错

时间:2011-11-30 13:36:37

标签: java eclipse nullpointerexception

每天启动Eclipse时都会出现以下错误:

Error notifying a preference change listener.

  

发生了错误。有关详细信息,请参阅错误日志。

     

通知偏好更改侦听器时出错。查看日志以获取详细信息。

     

通知偏好更改侦听器时出错。检查日志以获取详细信息。   显示java.lang.NullPointerException

知道造成这种情况的原因是什么?

当我重新启动Eclipse时,我不再收到错误,但每当我收到此错误时,我都必须重新编译我的代码库。它可能连接也可能不连接。看起来像,但我还不知道。

编辑1:

以下是\workspace\.metadata\.log的错误日志的两个小节:

日志的开头:

!SESSION 2011-11-30 10:22:09.734 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.7.0
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

!ENTRY org.eclipse.osgi 2 0 2011-11-30 10:24:59.186
!MESSAGE While loading class "org.eclipse.m2e.jdt.internal.MavenClasspathVariableInitializer", thread "Thread[main,6,main]" timed out waiting (5007ms) for thread "Thread[org.eclipse.jdt.internal.ui.text.JavaReconciler,1,main]" to finish starting bundle "org.eclipse.m2e.jdt_1.0.100.20110804-1717 [491]". To avoid deadlock, thread "Thread[main,6,main]" is proceeding but "org.eclipse.m2e.jdt.internal.MavenClasspathVariableInitializer" may not be fully initialized.
!STACK 0
org.osgi.framework.BundleException: State change in progress for bundle "reference:file:plugins/org.eclipse.m2e.jdt_1.0.100.20110804-1717.jar" by thread "org.eclipse.jdt.internal.ui.text.JavaReconciler".
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1087)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:297)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
    at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:462)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.jdt.core.JavaCore.getClasspathVariableInitializer(JavaCore.java:3034)
    at org.eclipse.jdt.core.JavaCore.getClasspathVariable(JavaCore.java:2897)
    at org.eclipse.jdt.internal.core.JavaModelManager.getResolvedVariablePath(JavaModelManager.java:2549)
    at org.eclipse.jdt.internal.core.JavaModelManager.resolveVariableEntry(JavaModelManager.java:2469)
    at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2645)
    at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2838)
    at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1943)
    at org.eclipse.jdt.internal.core.JavaProject.buildStructure(JavaProject.java:461)
    at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:258)
    at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
    at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
    at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:518)
    at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:255)
    at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:241)
    at org.eclipse.jdt.internal.core.PackageFragmentRoot.getKind(PackageFragmentRoot.java:477)
    at org.eclipse.jdt.internal.core.PackageFragment.getKind(PackageFragment.java:290)
    at org.eclipse.jdt.internal.core.PackageFragment.validateExistence(PackageFragment.java:506)
    at org.eclipse.jdt.internal.core.Openable.exists(Openable.java:206)
    at org.eclipse.jdt.internal.core.PackageFragment.exists(PackageFragment.java:174)
    at org.eclipse.jdt.ui.StandardJavaElementContentProvider.exists(StandardJavaElementContentProvider.java:451)
    at org.eclipse.jdt.ui.StandardJavaElementContentProvider.getParent(StandardJavaElementContentProvider.java:249)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditorBreadcrumb$JavaEditorBreadcrumbContentProvider.getParent(JavaEditorBreadcrumb.java:333)
    at org.eclipse.jdt.internal.ui.javaeditor.breadcrumb.BreadcrumbViewer.buildItemChain(BreadcrumbViewer.java:608)
    at org.eclipse.jdt.internal.ui.javaeditor.breadcrumb.BreadcrumbViewer.buildItemChain(BreadcrumbViewer.java:610)
    at org.eclipse.jdt.internal.ui.javaeditor.breadcrumb.BreadcrumbViewer.inputChanged(BreadcrumbViewer.java:306)
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:280)
    at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1690)
    at org.eclipse.jdt.internal.ui.javaeditor.breadcrumb.EditorBreadcrumb.setInput(EditorBreadcrumb.java:169)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditorBreadcrumb.setInput(JavaEditorBreadcrumb.java:788)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setBreadcrumbInput(JavaEditor.java:2007)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.showBreadcrumb(JavaEditor.java:1981)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.handlePreferenceStoreChanged(JavaEditor.java:2883)
    at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.handlePreferenceStoreChanged(CompilationUnitEditor.java:1620)
    at org.eclipse.ui.texteditor.AbstractTextEditor$PropertyChangeListener.propertyChange(AbstractTextEditor.java:710)
    at org.eclipse.ui.texteditor.ChainedPreferenceStore.firePropertyChangeEvent(ChainedPreferenceStore.java:164)
    at org.eclipse.ui.texteditor.ChainedPreferenceStore.handlePropertyChangeEvent(ChainedPreferenceStore.java:431)
    at org.eclipse.ui.texteditor.ChainedPreferenceStore.access$0(ChainedPreferenceStore.java:408)
    at org.eclipse.ui.texteditor.ChainedPreferenceStore$PropertyChangeListener.propertyChange(ChainedPreferenceStore.java:69)
    at org.eclipse.ui.preferences.ScopedPreferenceStore$3.run(ScopedPreferenceStore.java:375)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.preferences.ScopedPreferenceStore.firePropertyChangeEvent(ScopedPreferenceStore.java:372)
    at org.eclipse.jdt.internal.ui.javaeditor.ToggleBreadcrumbAction.perspectiveActivated(ToggleBreadcrumbAction.java:135)
    at org.eclipse.ui.internal.PerspectiveListenerList$1.run(PerspectiveListenerList.java:74)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.runtime.Platform.run(Platform.java:888)
    at org.eclipse.ui.internal.PerspectiveListenerList.fireEvent(PerspectiveListenerList.java:58)
    at org.eclipse.ui.internal.PerspectiveListenerList.firePerspectiveActivated(PerspectiveListenerList.java:72)
    at org.eclipse.ui.internal.WorkbenchWindow.firePerspectiveActivated(WorkbenchWindow.java:1450)
    at org.eclipse.ui.internal.WorkbenchPage$18.runWithException(WorkbenchPage.java:3350)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
    at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
    at org.eclipse.ui.internal.Workbench$33.runWithException(Workbench.java:1595)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException
    ... 101 more

编辑3:

日志的java.lang.NullPointerException部分:

!ENTRY org.eclipse.ui.workbench 4 2 2011-11-30 11:24:25.757
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".
!STACK 0
java.lang.NullPointerException
    at org.eclipse.m2e.jdt.internal.MavenClasspathVariableInitializer.initialize(MavenClasspathVariableInitializer.java:30)
    at org.eclipse.jdt.core.JavaCore.getClasspathVariable(JavaCore.java:2908)
    at org.eclipse.jdt.internal.core.JavaModelManager.getResolvedVariablePath(JavaModelManager.java:2549)
    at org.eclipse.jdt.internal.core.JavaModelManager.resolveVariableEntry(JavaModelManager.java:2469)
    at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2645)
    at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2838)
    at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1943)
    at org.eclipse.jdt.internal.core.JavaProject.buildStructure(JavaProject.java:461)
    at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:258)
    at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
    at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
    at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:518)
    at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:255)
    at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:241)
    at org.eclipse.jdt.internal.core.PackageFragmentRoot.getKind(PackageFragmentRoot.java:477)
    at org.eclipse.jdt.internal.core.PackageFragment.getKind(PackageFragment.java:290)
    at org.eclipse.jdt.internal.core.PackageFragment.validateExistence(PackageFragment.java:506)
    at org.eclipse.jdt.internal.core.Openable.exists(Openable.java:206)
    at org.eclipse.jdt.internal.core.PackageFragment.exists(PackageFragment.java:174)
    at org.eclipse.jdt.ui.StandardJavaElementContentProvider.exists(StandardJavaElementContentProvider.java:451)
    at org.eclipse.jdt.ui.StandardJavaElementContentProvider.getParent(StandardJavaElementContentProvider.java:249)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditorBreadcrumb$JavaEditorBreadcrumbContentProvider.getParent(JavaEditorBreadcrumb.java:333)
    at org.eclipse.jdt.internal.ui.javaeditor.breadcrumb.BreadcrumbViewer.buildItemChain(BreadcrumbViewer.java:608)
    at org.eclipse.jdt.internal.ui.javaeditor.breadcrumb.BreadcrumbViewer.buildItemChain(BreadcrumbViewer.java:610)
    at org.eclipse.jdt.internal.ui.javaeditor.breadcrumb.BreadcrumbViewer.inputChanged(BreadcrumbViewer.java:306)
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:280)
    at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1690)
    at org.eclipse.jdt.internal.ui.javaeditor.breadcrumb.EditorBreadcrumb.setInput(EditorBreadcrumb.java:169)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditorBreadcrumb.setInput(JavaEditorBreadcrumb.java:788)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setBreadcrumbInput(JavaEditor.java:2007)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.showBreadcrumb(JavaEditor.java:1981)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.handlePreferenceStoreChanged(JavaEditor.java:2883)
    at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.handlePreferenceStoreChanged(CompilationUnitEditor.java:1620)
    at org.eclipse.ui.texteditor.AbstractTextEditor$PropertyChangeListener.propertyChange(AbstractTextEditor.java:710)
    at org.eclipse.ui.texteditor.ChainedPreferenceStore.firePropertyChangeEvent(ChainedPreferenceStore.java:164)
    at org.eclipse.ui.texteditor.ChainedPreferenceStore.handlePropertyChangeEvent(ChainedPreferenceStore.java:431)
    at org.eclipse.ui.texteditor.ChainedPreferenceStore.access$0(ChainedPreferenceStore.java:408)
    at org.eclipse.ui.texteditor.ChainedPreferenceStore$PropertyChangeListener.propertyChange(ChainedPreferenceStore.java:69)
    at org.eclipse.ui.preferences.ScopedPreferenceStore$3.run(ScopedPreferenceStore.java:375)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.preferences.ScopedPreferenceStore.firePropertyChangeEvent(ScopedPreferenceStore.java:372)
    at org.eclipse.jdt.internal.ui.javaeditor.ToggleBreadcrumbAction.perspectiveActivated(ToggleBreadcrumbAction.java:135)
    at org.eclipse.ui.internal.PerspectiveListenerList$1.run(PerspectiveListenerList.java:74)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.runtime.Platform.run(Platform.java:888)
    at org.eclipse.ui.internal.PerspectiveListenerList.fireEvent(PerspectiveListenerList.java:58)
    at org.eclipse.ui.internal.PerspectiveListenerList.firePerspectiveActivated(PerspectiveListenerList.java:72)
    at org.eclipse.ui.internal.WorkbenchWindow.firePerspectiveActivated(WorkbenchWindow.java:1450)
    at org.eclipse.ui.internal.WorkbenchPage$18.runWithException(WorkbenchPage.java:3350)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
    at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
    at org.eclipse.ui.internal.Workbench$33.runWithException(Workbench.java:1595)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

编辑2:

我已经验证此错误仅在重新启动时弹出。当我重新启动Eclipse时,它不会弹出。或者,如果我在重新启动后使用非常干净的工作区(没有主要项目)启动Eclipse,这不会导致错误,然后打开我的主项目错误不会弹出。但是,日志中仍会出现错误。

编辑4:

软件版本:

  • Eclipse版本:Indigo Release Build id:20110615-0604
  • Maven版本:3.0.3

编辑5:

我以为我会分享我的黑客解决方案来解决这个问题, 发生此错误时,唯一让我的项目工作的东西, 这是清理Eclipse中的所有项目并让它自动重新编译。 我还要和Maven一起process-resources。它使我的项目再次运作。

编辑6:

我注意到,如果我关闭Eclipse并使用不同的(更简单的)工作空间(我用于测试Java代码)加载Eclipse,它不会产生此错误。然后,如果我关闭该Eclipse实例并使用我的主项目再次加载Eclipse,则错误消失。我将继续对此做笔记,试图弄清楚它是否与我的主项目相关联。

1 个答案:

答案 0 :(得分:2)

我会考虑将最新版本的eclipse部署到您的计算机上并重新创建您的首选项。不会花那么长时间,你也会摆脱你不需要的插件。通常,插件是启动时随机错误的罪魁祸首。

对我来说有用的是有不同版本的eclipse:一个用于php,一个用于scala,一个用于java,一个用于android,一个用于ruby等等...这样我的设置每个都不会搞砸另一个实例的设置。几乎没有时间设置一个新的eclipse实例......所以也许这个方法对你有用!