我是一个 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/