java - 无法解析标准 java 导入

标签 java eclipse osgi

我是一个 Java 新手,对 Eclipse/OSGi 等还很陌生。

我正在尝试运行 OSGi 包。我已经安装了OSGi中的所有依赖jar。 但是在 OSGi 控制台中启动 bundle 时,我收到以下错误:

org.osgi.framework.BundleException: The bundle could not be resolved.  
Reason:Missing Constraint:Require-Bundle:org.eclipse.xtext;bundle-version="0.0.0"  

标准导入尚未解决。我该如何解决这个问题?
让我知道我是否应该发布更多信息。

osgi> diag 24
file:///C:\Users\<user>\Desktop\RuleEngineDependency  
\org.eclipse.core.runtime_3.8.0.v20120912-155025.jar [24]
**Missing required bundle org.eclipse.osgi_[3.7.0,4.0.0).**
Missing required bundle org.eclipse.equinox.common_[3.6.100,4.0.0).
Missing required bundle org.eclipse.core.jobs_[3.2.0,4.0.0).
Missing required bundle org.eclipse.equinox.registry_[3.4.0,4.0.0).
Missing required bundle org.eclipse.equinox.preferences_[3.4.0,4.0.0).
Missing required bundle org.eclipse.core.contenttype_[3.3.0,4.0.0).
Missing optionally required bundle org.eclipse.core.runtime.compatibility.auth_[3.2.0,4.0.0).
Missing required bundle org.eclipse.equinox.app_1.0.0.
Missing imported package org.eclipse.core.internal.runtime.auth_0.0.0.

osgi> install file:///C:\Users\<user>\Desktop\RuleEngineDependency   \org.eclipse.osgi_3.8.2.v20130124-134944.jar
Bundle id is 25

osgi> diag 25
file:///C:\Users\<user>\Desktop\RuleEngineDependency\org.eclipse.osgi_3.8.2.v20130124-134944.jar [25]
No unresolved constraints.

osgi> diag 24
file:///C:\Users\<user>\Desktop\RuleEngineDependency\org.eclipse.core.runtime_3.8.0.v20120912-155025.jar [24]
**Missing required bundle org.eclipse.osgi_[3.7.0,4.0.0).**
Missing required bundle org.eclipse.equinox.common_[3.6.100,4.0.0).
Missing required bundle org.eclipse.core.jobs_[3.2.0,4.0.0).
Missing required bundle org.eclipse.equinox.registry_[3.4.0,4.0.0).
Missing required bundle org.eclipse.equinox.preferences_[3.4.0,4.0.0).
Missing required bundle org.eclipse.core.contenttype_[3.3.0,4.0.0).
Missing optionally required bundle org.eclipse.core.runtime.compatibility.auth_[3.2.0,4.0.0).
Missing required bundle org.eclipse.equinox.app_1.0.0.
Missing imported package org.eclipse.core.internal.runtime.auth_0.0.0.  

即使添加了 org.eclipse.osgi 包之后,它仍然会被列为缺少依赖项。

最佳答案

您的包没有缺少标准 java 导入。 bundle list 包含 Require-Bundle 指令,因此只有在部署 org.eclipse.xtext bundle 后, bundle 才会重新解析。由于该指令不会自动添加,您必须手动添加它或从另一个 list 复制。

您的 bundle 真的需要 xtext 吗?如果是,那么您必须将 extext 包部署到 OSGi 环境中。如果没有,则删除 Require-Bundle header ,它应该可以工作。

关于java - 无法解析标准 java 导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24339611/

相关文章:

java - 将数据存储在 servlet 的 DTO 中...?

java - 为什么按 Id 对对象列表进行分组仅在该函数中第一次调用时有效?

java - 其他布局中的项目不响应用户事件

java - 在 Eclipse 中安装 EGIT 时出错

java - 如何从 java 应用程序使用 OSGi

junit - 我需要在Eclipse RCP Tycho项目中使用Mockito和JUnit哪些依赖项

java - Spring jdbc 不适用于 h2 查询递归

java - 在 Eclipse 中插入代码模板时出现空行

java - 如何创建可由多个 Android 项目重复使用的类的 jar 文件?

java - OSGI - 从另一个组件类中选择要激活的包