我使用osgi
容器 ( virgo
) [我对此不太擅长]。
我添加了一个依赖项到我的pom.xml
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-osgi_2.10</artifactId>
<version>2.2-M3</version>
</dependency>
我把akka-osgi_2.10-2.2-M3.jar
我的 lib/deploy 文件夹放到OSGI
服务器(到myserver/repository/usr
)。
我在我的代码库中添加了虚拟演员:
import akka.actor.UntypedActor;
public class ManagerActor extends UntypedActor {
@Override
public void onReceive(Object o) throws Exception {
// ...
}
}
我构建并启动我的应用程序。
结果,我的日志中有以下异常(它抱怨version="0.0.0"
):
.. failed. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'com.
com.mycompnay.mything-security' at version '1.0.1.BUILD-SNAPSHOT': Cannot resolve: com.mycompany.mything-security
Resolver report:
An Import-Package could not be resolved. Resolver error data <Import-Package: akka.actor; version="0.0.0">. Caused by missing constrai
nt in bundle <com.mycompany.mything-security_1.0.1.BUILD-SNAPSHOT>
constraint: <Import-Package: akka.actor; version="0.0.0">
我转到我的template.mf
文件,该文件用于生成最终MANIFEST.MF
文件。要指定我使用的 AKKA lib 的版本范围。放在那里:
Import-Template:
akka.actor.*;version="[2.2.0.M3, 2.3)"
Import-Package:
akka.actor;version="[2.2.0.M3, 2.3)"
然后重建并启动应用程序。
但在控制台中,它向 akka 版本抱怨(抱怨到version="[2.2.0.M3,2.3.0)"
现在):
An Import-Package could not be resolved. Resolver error data <Import-Package: akka.actor; version="[2.2.0.M3,2.3.0)">. Caused by missi
ng constraint in bundle <com.mycompany.mything-security_1.0.1.BUILD-SNAPSHOT>
constraint: <Import-Package: akka.actor; version="[2.2.0.M3,2.3.0)">
问:怎么了?
我也尝试将此行添加到Import-Bundle
:
Import-Bundle:
...
com.typesafe.akka.osgi;version="[2.2.0.M3, 2.3)"
然后我在日志中有它(现在它抱怨 com.typesafe.akka.osgi 版本):
.. failed. org.eclipse.virgo.kernel.deployer.core.DeploymentException: Unable to satisfy dependencies of bundle 'com.mycompany.mything-security
' at version '1.0.1.BUILD-SNAPSHOT': Import-Bundle with symbolic name 'com.typesafe.akka.osgi' in version range '[2.2.0.M3, oo)' could not be
satisfied