本文介绍了启动时Eclipce RCP崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我处理旧的旧项目,并尝试将其切换到Java 11.目前,我可以成功编译它,但是启动时它会崩溃.

I work with the old legacy project and trying to switch it to Java 11.At the moment I am able to compile it successfully, but it crashes when starting.

该项目由几个eclipse插件模块和最终的eclipse-repository模块组成,该模块具有产品文件(还有pom文件可编译所有模块并在eclipse-repository模块的目标文件夹中创建可执行文件)

The project consists of several eclipse plugins modules and final eclipse-repository module which has product file (there is also pom file compiles all modules and creates executable file in target folder of the eclipse-repository module)

经过精炼的定义文件也可以成功解析,看起来像

Targed definition file is resolved succesfully too and looks like

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="phoenixldm-artifactory-p2" sequenceNumber="259">
  <locations>

    <location includeAllPlatforms="true" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
      <repository location="http://download.eclipse.org/releases/2019-09"/>
        <unit id="org.eclipse.birt.feature.group" version="4.7.0.v201706222054"/>
    </location>

    <location includeAllPlatforms="true" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
      <repository location="http://download.eclipse.org/releases/2020-12"/>
        <unit id="org.eclipse.equinox.sdk.feature.group" version="3.21.0.v20201128-0731"/>
        <unit id="org.eclipse.sdk.feature.group" version="4.18.0.v20201202-1800"/>
        <unit id="org.eclipse.jst.enterprise_ui.feature.feature.group" version="3.20.0.v202011230434"/>
        <unit id="org.eclipse.jst.web_ui.feature.feature.group" version="3.20.0.v202011230434"/>
        <unit id="org.eclipse.pde.feature.group" version="3.14.600.v20201202-1800"/>
        <unit id="org.eclipse.wst.web_ui.feature.feature.group" version="3.20.0.v202011230431"/>
        <unit id="org.eclipse.wst.xml_ui.feature.feature.group" version="3.20.0.v202011230430"/>
    </location>

 <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <repository location="https://artifactory.in.XXX.com/artifactory/YYY/platform"/>
        <unit id="com.company.orm.platform.feature.feature.group" version="2.1.2"/>
        <unit id="com.company.orm.platform.feature.source.feature.group" version="2.1.2"/>
    </location>

    <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
      <repository location="https://artifactory.in.XXX.com/artifactory/YYY/application"/>
        <unit id="com.company.orm.core.feature.feature.group" version="2.1.2"/>
        <unit id="com.company.orm.core.feature.source.feature.group" version="2.1.2"/>
        <unit id="com.company.update.feature.feature.group" version="2.1.2"/>
        <unit id="com.company.update.feature.source.feature.group" version="2.1.2"/>
    </location>

  </locations>

</target>

我正在使用两个版本的eclipse:最新的2020-12和2019-09,因为这是BIRT的最新版本,该版本已在我们的项目中使用.

I'm using two version of eclipse: the latest 2020-12, and 2019-09 because this is the latest version with BIRT whose is used in our project.

我的产品文件是面向功能的,因此产品文件看起来像

My product file is feature-oriented, so the product file looks like

<product name="Noname" uid="noname" version="1.1.1" useFeatures="true" includeLaunchers="true">

   <configIni use="default">
   </configIni>

   <launcherArgs>
      <programArgsLin>-os ${target.os} -ws ${target.ws} -arch ${target.arch} -consoleLog
      </programArgsLin>
      <programArgsWin>-os ${target.os} -ws ${target.ws} -arch ${target.arch} -consoleLog
      </programArgsWin>
      <vmArgsLin>-Xmx2048m -Xms512m -XX:+UseParallelGC -Xshare:auto -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dlogback.configurationFile=log.xml
      </vmArgsLin>
      <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
      </vmArgsMac>
      <vmArgsWin>-Xmx768m -Xms256m -Xshare:auto -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dlogback.configurationFile=log.xml
      </vmArgsWin>
   </launcherArgs>

   <windowImages/>

   <launcher name="phoenix">
      <win useIco="false">
         <bmp/>
      </win>
   </launcher>

   <vm>
   </vm>

   <plugins>
   </plugins>

   <features>
      <feature id="com.company.comp.feature"/>
      <feature id="com.company.orm.core.feature"/>
      <feature id="com.company.orm.platform.feature"/>
      <feature id="org.eclipse.pde"/> <!-- added because can't find org.eclipse.equinox.simpleconfigurator -->
   </features>

     <configurations>
      <!-- all plug-ins from my features above -->
      <plugin id="org.apache.felix.scr" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
      <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
   </configurations>

   <preferencesInfo>
      <targetfile overwrite="false"/>
   </preferencesInfo>

   <cssInfo>
   </cssInfo>

</product>

pom文件中有插件

<build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-p2-director-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

为产品创建可执行文件.如果我启动可执行文件,我将收到"Segmetation fault"错误.当我将其作为运行配置-Eclipse应用程序"启动时,它将充满日志

which creates executable for the product.If I start the executable I'll get "Segmetation fault"When I start it as Run Configuration - Eclipse Application, then it will craches with log

!ENTRY org.eclipse.equinox.launcher 4 0 2021-01-30 12:46:42.659
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:650)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1434)

毫无疑问,我不确定我所做的一切是否正确.也许有人可以告诉我我错了.

Unforunatelly, I am not sure that I do everything properly. May be someone could tell me where I'm wrong.

推荐答案

在我看来,我找到了问题的根本原因.至少我的应用程序可以运行,而不会崩溃成Segmentation错误.不幸的是,它仍然抱怨未解决的依赖关系,但这是向前迈出的一大步.因此,问题出在<programArgsLin>-os ${target.os} -ws ${target.ws} -arch ${target.arch} -consoleLog在我的产品文件中.

It seems to me that I found the root cause of my problem. At least my application can be running without crashing into a Segmentation fault. Unfortunately, it still complains about unresolved dependencies but it's a big step forward.So, the problem was in<programArgsLin>-os ${target.os} -ws ${target.ws} -arch ${target.arch} -consoleLogin my product file.

删除 -os $ {target.os} -ws $ {target.ws} -arch $ {target.arch} 让应用程序运行.

removing -os ${target.os} -ws ${target.ws} -arch ${target.arch}let the application run.

感谢@ greg-449,您对org.eclipse.pde绝对正确-这不是我需要的功能.

Thanks @greg-449, you're absolutely right about org.eclipse.pde - it is not a feature which I need.

我已经重构了产品,看起来像

I've refactored my product and it looks like

...
<launcherArgs>
      <programArgs>-consoleLog
      </programArgs>
      <vmArgs>-Xshare:auto -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dlogback.configurationFile=log.xml
      </vmArgs>
      <vmArgsLin>
         <argsX86_64>-Xmx2048m -Xms512m -XX:+UseParallelGC</argsX86_64>
      </vmArgsLin>
      <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
      </vmArgsMac>
      <vmArgsWin>-Xmx768m -Xms256m
      </vmArgsWin>
   </launcherArgs>
...
<vm>
      <linux include="true">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11</linux>
      <macos include="true">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11</macos>
   </vm>
...
<features>
      ... list of my features ...
      <feature id="org.eclipse.e4.rcp" installMode="root"/>
      <feature id="org.eclipse.emf.ecore" installMode="root"/>
      <feature id="org.eclipse.emf.common" installMode="root"/>
</features>
<configurations>
      <plugin id="org.apache.felix.scr" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
      <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
   </configurations>

这篇关于启动时Eclipce RCP崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 08:25