我通过在/ etc目录中放置datasource-x.cfg文件,以推荐的方式创建了数据源。这一切都可以正常工作,当karaf ist启动时,我可以通过karaf控制台查询该数据库。但是,如果我从另一个蓝图骆驼项目中引用此数据源,则该数据源的解析始终会失败,因为它似乎比该数据源更早初始化了该蓝图,从而导致以下错误:
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=fe1b16a5-c2a6-42aa-9bcd-a7404ff26c7c; type=karaf.feature; version="[0,0.0.0]"; filter:="(&(osgi.identity=fe1b16a5-c2a6-42aa-9bcd-a7404ff26c7c)(type=karaf.feature)(version>=0.0.0)(version<=0.0.0))" [caused by: Unable to resolve fe1b16a5-c2a6-42aa-9bcd-a7404ff26c7c/0.0.0: missing requirement [fe1b16a5-c2a6-42aa-9bcd-a7404ff26c7c/0.0.0] osgi.identity; osgi.identity=com.xyz.xyz.service; type=osgi.bundle; version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve com.xyz.xyz.service/0.0.1.SNAPSHOT: missing requirement [com.xyz.xyz.service/0.0.1.SNAPSHOT] osgi.service; effective:=active; filter:="(&(objectClass=javax.sql.DataSource)(dataSourceName=xyzDs))"]]
我的蓝图参考:
<reference id="xyzDs" availability="optional" interface="javax.sql.DataSource" filter="(dataSourceName=xyzDs)" />
我使用maven-karaf汇编程序,并具有以下配置:
<startupFeatures>
<feature>jdbc</feature>
<feature>pax-jdbc-mssql</feature>
<feature>pax-jdbc-config</feature>
</startupFeatures>
...
<bootBundles>
<bootBundle>
mvn:com.xyz/my-project/1.0.0
</bootBundle>
</bootBundle>
有人知道如何在解决另一个项目的蓝图之前初始化数据源吗?
很多指针!