解决Run As -> Java Application不能运行问题

转自:https://breakshell.iteye.com/blog/467130

点 Run As -> Java Application 不能运行,报的错误如下:

  1. Plug-in org.eclipse.ajdt.ui was unable to load class org.eclipse.ajdt.internal.ui.ajde.CachedRuntimeClasspathEntryResolver.
  2. org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.ajdt.ui (745).
  3. at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:125)
  4. at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
  5. at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
  6. at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)
  7. at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:452)
  8. at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
  9. at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
  10. at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
  11. at java.lang.ClassLoader.loadClass(Unknown Source)
  12. at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:321)
  13. at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
  14. at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
  15. at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
  16. at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
  17. at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
  18. at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
  19. at org.eclipse.jdt.internal.launching.RuntimeClasspathEntryResolver.getResolver(RuntimeClasspathEntryResolver.java:52)
  20. at org.eclipse.jdt.internal.launching.RuntimeClasspathEntryResolver.resolveRuntimeClasspathEntry(RuntimeClasspathEntryResolver.java:44)
  21. at org.eclipse.jdt.launching.JavaRuntime.resolveRuntimeClasspathEntry(JavaRuntime.java:924)
  22. at org.eclipse.jdt.launching.StandardClasspathProvider.resolveClasspath(StandardClasspathProvider.java:75)
  23. at org.eclipse.jdt.launching.JavaRuntime.resolveRuntimeClasspath(JavaRuntime.java:1205)
  24. at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.getClasspath(AbstractJavaLaunchConfigurationDelegate.java:417)
  25. at org.eclipse.jdt.launching.JavaLaunchDelegate.launch(JavaLaunchDelegate.java:71)
  26. at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
  27. at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
  28. at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:866)
  29. at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1069)
  30. at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
  31. Caused by: org.osgi.framework.BundleException: The activator org.eclipse.ajdt.ui.AspectJUIPlugin for bundle org.eclipse.ajdt.ui is invalid
  32. at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:157)
  33. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:750)
  34. at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
  35. at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
  36. at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
  37. at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
  38. ... 27 more
  39. Caused by: java.lang.NoClassDefFoundError: org/eclipse/ajdt/core/ras/FFDC
  40. at java.lang.Class.getDeclaredConstructors0(Native Method)
  41. at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
  42. at java.lang.Class.getConstructor0(Unknown Source)
  43. at java.lang.Class.newInstance0(Unknown Source)
  44. at java.lang.Class.newInstance(Unknown Source)
  45. at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:152)
  46. ... 32 more
  47. Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.ajdt.core (740).
  48. at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:125)
  49. at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
  50. at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
  51. at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)
  52. at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)
  53. at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:440)
  54. at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
  55. at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
  56. at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
  57. at java.lang.ClassLoader.loadClass(Unknown Source)
  58. at java.lang.ClassLoader.loadClassInternal(Unknown Source)
  59. at java.lang.Class.forName0(Native Method)
  60. at java.lang.Class.forName(Unknown Source)
  61. at org.springframework.ide.eclipse.core.java.JdtUtils.isAjdtPresent(JdtUtils.java:383)
  62. at org.springframework.ide.eclipse.core.java.JdtUtils.<clinit>(JdtUtils.java:73)
  63. at org.springframework.ide.eclipse.aop.core.internal.model.AopResourceChangeEvents.isSpringProject(AopResourceChangeEvents.java:33)
  64. at org.springframework.ide.eclipse.core.internal.model.resources.SpringResourceChangeListener$SpringResourceVisitor.resourceChanged(SpringResourceChangeListener.java:216)
  65. at org.springframework.ide.eclipse.core.internal.model.resources.SpringResourceChangeListener$SpringResourceVisitor.visit(SpringResourceChangeListener.java:143)
  66. at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:68)
  67. at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
  68. at org.springframework.ide.eclipse.core.internal.model.resources.SpringResourceChangeListener.resourceChanged(SpringResourceChangeListener.java:75)
  69. at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:291)
  70. at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
  71. at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285)
  72. at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149)
  73. at org.eclipse.core.internal.resources.Workspace.broadcastBuildEvent(Workspace.java:297)
  74. at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:136)
  75. at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
  76. ... 1 more
  77. Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.ajdt.core.AspectJPlugin.start() of bundle org.eclipse.ajdt.core.
  78. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:805)
  79. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:754)
  80. at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
  81. at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
  82. at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
  83. at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
  84. ... 28 more
  85. Caused by: java.lang.NoClassDefFoundError: org/aspectj/ajde/core/ICompilerConfiguration
  86. at org.eclipse.ajdt.core.AspectJPlugin.start(AspectJPlugin.java:131)
  87. at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:782)
  88. at java.security.AccessController.doPrivileged(Native Method)
  89. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:773)
  90. ... 33 more
  91. Caused by: java.lang.ClassNotFoundException: org.aspectj.ajde.core.ICompilerConfiguration
  92. at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
  93. at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
  94. at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
  95. at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
  96. at java.lang.ClassLoader.loadClass(Unknown Source)
  97. at java.lang.ClassLoader.loadClassInternal(Unknown Source)
  98. ... 37 more
  99. eclipse.buildId=I20090611-1540
  100. java.version=1.6.0_16
  101. java.vendor=Sun Microsystems Inc.
  102. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN
  103. Framework arguments:  -product org.eclipse.epp.package.jee.product
  104. Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.jee.product

我的Eclipse3.5版本是:

Eclipse Java EE IDE for Web Developers.

Build id: 20090621-0832

原来是我之前安装Maven插件的时候选择安装了AJDT,只要不安装AJDT插件,程序运行正常。

我想这个应该是AJDT的一个BUG吧。。。

上一篇:命令行运行Python脚本时传入参数的三种方式


下一篇:在C#代码中应用Log4Net(二)典型的使用方式(转)