问题
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.
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>
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>
there is plugin in pom file
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
</plugin>
</plugins>
</build>
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.
回答1:
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} -consoleLog
in my product file.
removing -os ${target.os} -ws ${target.ws} -arch ${target.arch} let the application run.
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>
来源:https://stackoverflow.com/questions/65971888/eclipce-rcp-is-crashed-when-starting