我正在构建一个E4应用程序,并希望将H2数据库用作持久性存储。我记得,我必须在插件中放置一个外部库,以便能够从另一个pluigin或rcp应用程序访问它。 所以,我从H2网站下载了jar,并按照此处所述的步骤进行操作:http://www.vogella.com/tutorials/EclipseJarToPlugin/article.html 我做了检查,一切都很好,我在原始插件中包含了新的插件。之后,这个原始插件的MANIFEST.MF看起来像这样:
> Bundle-SymbolicName: mhFinPim;singleton=true Bundle-Version:
> 1.0.0.qualifier Bundle-Name: mhFinPim Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle:
> org.eclipse.core.runtime;bundle-version="3.13.0",
> org.eclipse.swt;bundle-version="3.106.0",
> org.eclipse.e4.core.di;bundle-version="1.6.100",
> org.eclipse.e4.ui.di;bundle-version="1.2.100",
> org.eclipse.e4.core.di.extensions;bundle-version="0.15.0",
> org.eclipse.e4.ui.workbench;bundle-version="1.5.0",
> DatabaseH2;bundle-version="1.0.0"
H2数据库的新插件的MANIFEST.MF是这样的:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DatabaseH2
Bundle-SymbolicName: DatabaseH2
Bundle-Version: 1.0.0
Bundle-ClassPath: h2-1.4.196.jar
Export-Package: org.h2,
org.h2.api,
org.h2.bnf,
org.h2.bnf.context,
org.h2.command,
org.h2.command.ddl,
org.h2.command.dml,
org.h2.compress,
org.h2.constraint,
org.h2.engine,
org.h2.expression,
org.h2.fulltext,
org.h2.index,
org.h2.jdbc,
org.h2.jdbcx,
org.h2.jmx,
org.h2.message,
org.h2.mvstore,
org.h2.mvstore.cache,
org.h2.mvstore.db,
org.h2.mvstore.rtree,
org.h2.mvstore.type,
org.h2.result,
org.h2.schema,
org.h2.security,
org.h2.server,
org.h2.server.pg,
org.h2.server.web,
org.h2.store,
org.h2.store.fs,
org.h2.table,
org.h2.tools,
org.h2.upgrade,
org.h2.util,
org.h2.value
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
在完成所有这些步骤之后,我开始使用我的原始插件来查看它是否有效以及该插件是否可以与数据库一起使用。起初我从eclipse和下面的stacktrace收到了这条消息:
!SESSION 2017-08-14 09:18:56.882 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_101
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments: -product mhFinPim.prod -clearPersistedState
Command-line arguments: -product mhFinPim.prod -data C:\Users\te_gza2g3_01\workspace/../runtime-ProdConf.product(1) -dev file:C:/Users/te_gza2g3_01/workspace/.metadata/.plugins/org.eclipse.pde.core/ProdConf.product (1)/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -clearPersistedState
!ENTRY org.eclipse.equinox.app 0 0 2017-08-14 09:18:58.547
!MESSAGE Product mhFinPim.prod could not be found.
!ENTRY mhFinPim 2 0 2017-08-14 09:18:58.663
!MESSAGE Could not resolve module: mhFinPim [5]
Unresolved requirement: Require-Bundle: DatabaseH2; bundle-version="1.0.0"
!ENTRY org.eclipse.osgi 4 0 2017-08-14 09:18:58.665
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
gogo: IllegalStateException: session is closed
java.lang.IllegalStateException: session is closed
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:81)
at org.apache.felix.gogo.shell.Activator.run(Activator.java:75)
at java.lang.Thread.run(Thread.java:745)
在将新插件与数据库一起使用之前,应用程序启动时没有任何问题。如果我删除数据库插件,开始没有问题。所以,我想知道为什么eclipse现在告诉我,没有找到应用程序ID以及无法找到插件的原因?!我是否必须添加任何东西来告诉eclipse,它可以在哪里找到插件?或者我还有其他什么?
顺便说一下,为了提供完整的信息,这里有plugin.xml和产品配置:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="prod"
point="org.eclipse.core.runtime.products">
<product
application="org.eclipse.e4.ui.workbench.swt.E4Application"
name="FinPim">
<property
name="appName"
value="FinPim">
</property>
<property
name="lifeCycleURI"
value="bundleclass://mhFinPim/de.mho.finpim.lifecycle.Manager">
</property>
</product>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="FinPim" uid="ProdConf" id="mhFinPim.prod" application="org.eclipse.e4.ui.workbench.swt.E4Application" useFeatures="true" includeLaunchers="true">
<configIni use="default">
</configIni>
<launcherArgs>
<programArgs>-clearPersistedState
</programArgs>
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
</vmArgsMac>
</launcherArgs>
<launcher>
<win useIco="false">
<bmp/>
</win>
</launcher>
<vm>
</vm>
<plugins>
</plugins>
<features>
<feature id="fpFeature"/>
<feature id="org.eclipse.e4.rcp"/>
<feature id="org.eclipse.emf.ecore"/>
<feature id="org.eclipse.emf.common"/>
</features>
<configurations>
<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.ds" 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>
</product>
答案 0 :(得分:0)
您必须在产品中包含的插件列表中包含DatabaseH2
插件。
由于您使用的是基于功能的产品,因此应将其列在功能fpFeature
中。打开feature.xml
中的fpFeature
并添加DatabaseH2
插件。