您好我正在使用FeaturesService和BundleContext在運行時加載一些功能和捆綁。所有這些東西都成功加載。之後,如果我對bundlecontext對象進行操作,我會得到 java.lang.IllegalStateException:無效的BundleContext。Karaf PaxExam獲取java.lang.IllegalStateException:無效的BundleContext
@Inject
FeaturesService service;
@Before
public void init() throws Exception{
service.installFeature("hibernate");
service.installFeature("hibernate-validator");
service.installFeature("transaction");
service.installFeature("jpa");
service.installFeature("hibernate-envers");
service.installFeature("hibernate-envers");
bc.installBundle("wrap:mvn:com.oracle/ojdbc6/11.2.0").start();
service.installFeature("DBHandler");
bc.getBundle(); // Fails
}
經過大量的瀏覽,我明白你需要刷新捆綁。如何以編程方式執行並獲得重新引導的BundContext對象
Jermie我找到了一種方法來刷新和更新它把我的問題 – Charity
的護理的BundleContext如果有人期待使用Jérémie解決方案,請在'FeaturesService.Option'中查找枚舉,而不是簡單地使用'FeaturesService' – buer