【问题标题】:Unresolved requirement: Require-Bundle: org.eclipse.core.databinding.beans; bundle-version="1.2.200"未解决的需求:Require-Bundle: org.eclipse.core.databinding.beans;捆绑版本="1.2.200"
【发布时间】:2015-11-11 16:33:01
【问题描述】:

我正在尝试创建一个 RCP 应用程序,我想在其中绑定一个 bean 中的变量以查看。 bean 的代码#

public class SaveFileBean implements PropertyChangeListener {
private String text;
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
        this);

@Override
public void propertyChange(PropertyChangeEvent arg0) {
    propertyChangeSupport.firePropertyChange("text", null, text);
}

public void addPropertyChangeListener(String propertyName,
        PropertyChangeListener listener) {
    propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
}

public void removePropertyChangeListener(PropertyChangeListener listener) {
    propertyChangeSupport.removePropertyChangeListener(listener);
}

public String getText() {
    return text;
}

}

VIew 的代码

public class NewView extends ViewPart {
private DataBindingContext m_bindingContext;
public static final String ID = "com.app.Editor.newView";
SaveFileBean bean = new SaveFileBean();
private StyledText text;

public NewView() {
}

@Override
public void createPartControl(Composite parent) {

    text = new StyledText(parent, SWT.BORDER);
    bindValues();

}

private void bindValues() {
}

@Override
public void setFocus() {
    // create new Context
    DataBindingContext ctx = new DataBindingContext();

    // define the IObservables
    IObservableValue target = WidgetProperties.text(SWT.Modify).
      observe(text);
    IObservableValue model= BeanProperties.
      value(SaveFileBean.class,"text").observe(text);

    // connect them
    ctx.bindValue(target, model);
}
}

我在 manifest.mf 中添加了以下依赖项这是我的 MANIFEST.MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Editor
Bundle-SymbolicName: com.app.Editor;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.app.editor.Activator
Bundle-Vendor: APP
Require-Bundle: org.eclipse.ui,
   com.ibm.icu,
   org.eclipse.core.runtime,
   org.eclipse.core.databinding;bundle-version="1.4.2",
   org.eclipse.jface.databinding;bundle-version="1.6.200",
   org.eclipse.core.databinding.property,
   org.eclipse.core.databinding.beans;bundle-version="1.2.200"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy. Here is 
Export-Package: com.app.editor,
      com.app.editor.actions,
      com.app.editor.beans,
      com.app.editor.commands,
       com.app.editor.functionalities,
       com.app.editor.perspectives,
        com.app.editor.views

运行代码时出现错误 -

org.osgi.framework.BundleException: Could not resolve module: com.app.Editor    [81]
Unresolved requirement: Require-Bundle: org.eclipse.core.databinding.beans; bundle-version="1.2.200"

但是,我在 MANIFEST 中添加了这个依赖项,我可以在项目中看到这个 jar。 有什么想法吗?

谢谢!

编辑:完整的日志文件是:

!SESSION 2015-08-19 08:53:21.748 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_45
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -application com.app.Editor.application
Command-line arguments:  -application com.app.Editor.application -data C:\Srijani\Personal Workspace\RCP/../runtime-com.app.Editor.application -dev file:C:/Srijani/Personal Workspace/RCP/.metadata/.plugins/org.eclipse.pde.core/com.app.Editor.application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog

!ENTRY com.app.Editor 4 0 2015-08-19 08:53:22.559
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: com.app.Editor [87]
  Unresolved requirement: Require-Bundle: org.eclipse.core.databinding.beans

    at org.eclipse.osgi.container.Module.start(Module.java:434)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY com.app.Editor 2 0 2015-08-19 08:53:22.888
!MESSAGE Could not resolve module: com.app.Editor [87]
  Unresolved requirement: Require-Bundle: org.eclipse.core.databinding.beans


!ENTRY org.eclipse.osgi 4 0 2015-08-19 08:53:22.888
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "com.app.Editor.application" could not be found in the registry. The applications available are: org.eclipse.ant.core.antRunner, org.eclipse.e4.ui.workbench.swt.E4Application, org.eclipse.e4.ui.workbench.swt.GenTopic, org.eclipse.equinox.app.error.
    at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
    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:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

【问题讨论】:

  • 工作空间.metadata 目录中的.log 文件中是否还有更多关于解决问题的消息?
  • 是的,有.... 我正在附加日志文件。谢谢!
  • 如果您使用的是 Eclipse RCP 版本,则有一个名为 Target Platform State 的视图。提到的插件在那里列出吗?您可以过滤名称。如果是这样,请检查 Run Configuation 是否正在加载插件。

标签: java eclipse-plugin eclipse-rcp rcp


【解决方案1】:

我已经解决了这个问题。虽然我不确定为什么会这样。

运行方式 -> 运行配置... -> 插件选项卡 -> 添加所需插件 -> 验证插件 -> 运行

这解决了我的问题!

【讨论】:

  • 在添加一些测试后,对 junit 的要求未解决,所以 +1 - 我想你的意思是 Run Configurations... > Plug-ins tab > Add Required Plug-ins 按钮(至少在火星上) )。
  • 然而,这不会解决您在部署产品时遇到的问题。您仍然必须找到缺少的依赖项并手动将它们添加到您的清单中。
【解决方案2】:

对我来说,删除插件并再次添加它们是可行的...... Preferences > Plug-in Development > Target Platform,尝试删除 Running Platform 目标定义 -> Click Apply,然后恢复默认值或添加您要添加​​的所需插件。

【讨论】:

    猜你喜欢
    • 2016-10-30
    • 2012-04-05
    • 1970-01-01
    • 2020-03-23
    • 2017-09-11
    • 1970-01-01
    • 2018-09-29
    • 2023-03-12
    • 1970-01-01
    相关资源
    最近更新 更多