让我在尝试一些之后回答我的问题,以便其他人可以使用相同的:
- 关于第 1 点我不确定。需要咨询 Apache ACE 所有者
- 关于第 2 点:
正如 Marcel 所说,我已经提取了代理 jar "jar xf target.jar jar/org.apache.ace.agent.jar" 并使用命令将其安装在本地 maven repo 中
mvn install:install-file -Dfile=./org.apache.ace.agent.jar -DgroupId=org.apache.ace -DartifactId=org.apache.ace.agent -Dversion=2.0.1 -Dpackaging=jar
在原始 Web 应用程序 maven 代码中提供了这种依赖关系,详情如下:
<dependency>
<groupId>org.apache.ace</groupId>
<artifactId>org.apache.ace.agent</artifactId>
<version>2.0.1</version>
</dependency>
在我们实例化 Felix 的地方添加了额外的配置参数,详情如下:
String localId = UUID.randomUUID().toString();
Map config = new HashMap();
//Here i am adding Apache ACE agent configuration. For now two are ok
config.put(AgentConstants.CONFIG_DISCOVERY_SERVERURLS, "http://localhost:8080");
config.put(AgentConstants.CONFIG_IDENTIFICATION_AGENTID, localId);
List<BundleActivator> activators = new ArrayList<>();
//Here i am attaching Apache ACE activator as system activator
activators.add((BundleActivator) new Activator());
config.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, activators);
Felix felix = new Felix(config);
.... regular felix.start etc goes here.