4. 常见的启动错误

来源:互联网 发布:java输出五角星 编辑:程序博客网 时间:2024/04/25 21:53

1. 常见的启动错误列表

通过run configuration 启动eclipse application 出现错误是家常便饭。那么在本文中将会对这些常见的错误进行总结,作为一个参考,一旦发生类似的错误我们可以立即锁定到某一个位置。

Problem Investigate “Could not resolve module” message during start up. Check that all required plug-ins are included in your product configuration. Make sure that your product defines dependencies to all required plug-ins or features. See Section 8.2, “Finding missing plug-in dependencies during a product launch ” Bundles may also require a certain version of the Java virtual machine, e.g., a bundle may require Java 1.6 and will therefore not load in a Java 1.5 VM. Check the MANIFEST.MF file on theOverview tab in the Execution Environments section which Java version is required. “”java.lang.RuntimeException: No application id has been found.” message during start up. See “Could not resolve module” message during start up error. In most cases also triggered by a missing plug-in dependency. Strange behavior but no error message. Check if your run configuration includes the-consoleLog parameter. This option allows you to see errors from Eclipse based applications in the Console view of the Eclipse IDE. Runtime configuration is frequently missing required plug-ins Make sure that your product or your feature(s) includes all required dependencies. A change in the product Dependencies tab is not reflected in the run configuration (e.g., a new plug-in is added but is not included in the run configuration) A product updates an existing run configuration if you start the product directly from the product definition file. If you select the run configuration directly, it will not be updated. Application model changes are not reflected in the Eclipse 4 application. Eclipse 4 persists user changes in the application in a delta file which is restored at startup. During development this might lead to situations where model changes are not correctly applied to the runtime model, e.g., you define a new menu entry and this entry is not displayed in your application.Either set the Clear flag on the Main tab in your run configuration or add theclearPersistedState parameter for your product configuration file or run configuration. Services, e.g., key bindings or the selection service, are not working in an Eclipse 4 application. In Eclipse releases before 4.3 every part needed to implement a @Focus method which places the focus on an SWT control. This error does not occur anymore with Eclipse 4.3 or a higher release. Menu entries are disabled in the Eclipse application. Ensure that the HandlerProcessingAddonclass in the packageorg.eclipse.e4.ui.internal.workbench.addons is registered as model add-on. The bundle symbolic name isorg.eclipse.e4.ui.workbench. Application “org.eclipse.ant.core.antRunner” could not be found in the registry or Application could not be found in the registry. Ensure that you have pressed the New…button in the product configuration file and selected the E4Application as application to start. You can check the current setting in your plugin.xml file on the Extensions tab and in the details of theorg.eclipse.core.runtime.products extension.

2. 确保plug-in依赖关系

最常见的错误就是我们的plug-in 丢失了一些依赖的文件,如果我们在产品的配置中使用的是feature,我们就要保证我们plug-in 所使用的所有的依赖都被添加到了我们的MENIFEST.MF文件中。这些错误会在console展示出来。
这类错误会展示如下的一些信息:
org.osgi.framework.BundleException:
Could not resolve module: com.example.e4.rcp.todo.services [9]
Unresolved requirement:
Require-Bundle: com.example.e4.rcp.todo.events;
bundle-version=”1.0.0”

在确认我们遗失的plug-in后, 若是基于plug-in的配置信息,那么将遗失的plug-in文件添加到我们的product文件中。如下图所示:
这里写图片描述

product 的配置信息是用来到处我们的产品,因此在product的依赖中的一个小的错误都可能会导致application 不能正常启动。所以,在开发过程中,对我们来说要总是保证product 文件中的配置信息是完全正确的。

3. 启动方式区别

程序启动的主要的配置信息保存在product的配置文件中。启动的配置信息在我们通过product启动程序的时候创建或者更新。我们可以使用run configuration 直接启动application . 那么在这种情况下product 的配置信息是不被考虑的。因此,为了保证我们使用的是我们product的最新配置信息,那么我们就要通过product的配置文件来启动我们的application .一般修改Product配置文件后,最好通过Product文件进行启动Application。
0 1