I do agree that Felix can be very opaque when restarts occur. We usually end up sprinkling breakpoints around or attaching BTrace to log framework internals. refreshOptionalPackages() is often the cause. Some better logging about the trigger and cause of the refresh would be great. I know that we lose visibility to the root trigger as the events propagate across different threads, but someone ambitious/crafty should be able to handle it.
-Nick Baker ________________________________ From: Charlie Mordant <cmorda...@gmail.com> Sent: Tuesday, January 31, 2017 4:39:32 AM To: user@karaf.apache.org Subject: Bundle restart are hard to tackle Hi users of the world's best application server ever ;-), I'm struggling with feature resolution, and would like to have your POV. This issue is concerning, the JDBC, the Blueprint and the transactional feature. Here's the issue with feature resolution in my pax-exam test: * The jdbc-pool-aries feature starts first (+ the config one and the cfg \o/). * Then the transactional feature * The third feature thats start is the aries jndi one, so the two datasources (the XA and non-XA ones) are exposed (\o/\o/). * But the third that starts is the blueprint one, which starts the xbean-blueprint bundle. That blueprint bundle restarts the 'optional' resolutions of aries transaction manager, which then restarts aries-jdbc modules (optional res again) & config, which stops the datasource and starts another one. Unfortunately, at this point, my 'daos' bundle is already linked with a proxy to the 'old' datasource. A way to fix it is to reference the 'transaction' feature in the 'pool-aries' one, and the 'blueprint' one in the 'transaction' one, but it would then break some modularity. Have you got an idea on how to properly handle it? The actual xml of my features, they're slightly similar to the karaf ones, with bundle versions aligned: [code] <feature name="osgiliath-pax-jdbc-pool-aries" description="Provides JDBC Pooling DataSourceFactory using Aries Transaction JDBC" version="${org.ops4j.pax.jdbc_pax-jdbc-features.version}" resolver="(obr)"> <feature>osgiliath-pax-jdbc-spec</feature> <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/${org.ops4j.pax.jdbc_pax-jdbc-pool-common.version}</bundle> <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-aries/${org.ops4j.pax.jdbc_pax-jdbc-pool-aries.version}</bundle> <conditional> <condition>osgiliath-aries-blueprint</condition> <bundle dependency="true">mvn:org.apache.xbean/xbean-blueprint/${org.apache.xbean_xbean-blueprint.version}</bundle> </conditional> <conditional> <condition>osgiliath-transaction</condition> <bundle dependency="true">mvn:org.apache.aries.transaction/org.apache.aries.transaction.jdbc/${org.apache.aries.transaction_org.apache.aries.transaction.jdbc.version}</bundle> </conditional> </feature> <feature name="osgiliath-transaction" description="OSGi Transaction Manager" version="${org.apache.aries.transaction_org.apache.aries.transaction.manager.version}"> <config name="org.apache.aries.transaction" append="false"> aries.transaction.recoverable = true aries.transaction.timeout = 600 aries.transaction.howl.logFileDir = ${karaf.data}/txlog aries.transaction.howl.maxLogFiles = 2 aries.transaction.howl.maxBlocksPerFile = 512 aries.transaction.howl.bufferSize = 4 </config> <feature version="${transaction-api_feature.version}" prerequisite="false" dependency="false">osgiliath-transaction-api</feature> <bundle dependency="true">mvn:org.apache.aries/org.apache.aries.util/${org.apache.aries_org.apache.aries.util.version}</bundle> <bundle>mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/${org.apache.aries.transaction_org.apache.aries.transaction.manager.version}</bundle> <conditional> <condition>osgiliath-aries-blueprint</condition> <bundle dependency="true">mvn:org.apache.felix/org.apache.felix.coordinator/${org.apache.felix_org.apache.felix.coordinator.version}</bundle> <bundle>mvn:org.apache.aries.transaction/org.apache.aries.transaction.blueprint/${org.apache.aries.transaction_org.apache.aries.transaction.blueprint.version1}</bundle> <bundle>mvn:org.apache.aries.transaction/org.apache.aries.transaction.blueprint/${org.apache.aries.transaction_org.apache.aries.transaction.blueprint.version}</bundle> <bundle dependency="true">mvn:org.apache.xbean/xbean-blueprint/${org.apache.xbean_xbean-blueprint.version}</bundle> </conditional> <conditional> <condition>osgiliath-spring</condition> <feature version="${org.apache.servicemix.bundles.spring.version}" dependency="true">osgiliath-spring-tx</feature> </conditional> </feature> ********************************************************* Additional informations ****************************************** <feature name="osgiliath-transaction-api" version="${transaction-api_feature.version}"> <bundle dependency="true">mvn:javax.interceptor/javax.interceptor-api/${javax.interceptor_javax.interceptor-api.version}</bundle> <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-atinject_1.0_spec/${org.apache.geronimo.specs_geronimo-atinject_1.0_spec.version}</bundle> <bundle dependency="true">mvn:javax.el/javax.el-api/${javax.el_javax.el-api.version}</bundle> <bundle dependency="true">mvn:javax.enterprise/cdi-api/${javax.enterprise_cdi-api.version}</bundle> <bundle>mvn:javax.transaction/javax.transaction-api/${javax.transaction_javax.transaction-api.version}</bundle> </feature> <feature name="osgiliath-persistence-api" description="Persistence API" version="${persistence-api_feature.version}"> <bundle>mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/${org.apache.geronimo.specs_geronimo-jpa_2.0_spec.version}</bundle> <bundle>mvn:org.apache.geronimo.specs/geronimo-osgi-registry/${org.apache.geronimo.specs_geronimo-osgi-registry.version}</bundle> </feature> <feature name="osgiliath-jpa" description="OSGi Persistence Container" version="${org.apache.aries.jpa.version}"> <feature version="${transaction-api_feature.version}" prerequisite="false" dependency="false">osgiliath-transaction-api</feature> <feature version="${persistence-api_feature.version}" prerequisite="false" dependency="false">osgiliath-persistence-api</feature> <bundle dependency="true">mvn:org.apache.felix/org.apache.felix.coordinator/${org.apache.felix_org.apache.felix.coordinator.version}</bundle> <bundle dependency="true">mvn:org.osgi/org.osgi.service.jdbc/${org.osgi_org.osgi.service.jdbc.version}</bundle> <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${org.apache.aries.jpa_org.apache.aries.jpa.api.version}</bundle> <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${org.apache.aries.jpa_org.apache.aries.jpa.container.version}</bundle> <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${org.apache.aries.jpa_org.apache.aries.jpa.support.version}</bundle> <conditional> <condition>osgiliath-aries-blueprint</condition> <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${org.apache.aries.jpa_org.apache.aries.jpa.blueprint.version}</bundle> </conditional> </feature> <feature name="osgiliath-openjpa" description="Apache OpenJPA 2.4.x persistence engine support" version="${org.apache.openjpa.version}"> <feature prerequisite="false" dependency="false">osgiliath-jndi</feature> <feature version="${transaction-api_feature.version}" prerequisite="false" dependency="false">osgiliath-transaction-api</feature> <feature version="${persistence-api_feature.version}" prerequisite="false" dependency="false">osgiliath-persistence-api</feature> <bundle dependency="true">mvn:javax.servlet/javax.servlet-api/${javax.servlet_javax.servlet-api.version}</bundle> <bundle dependency="true">mvn:javax.el/javax.el-api/${javax.el_javax.el-api.version}</bundle> <bundle dependency="true">mvn:commons-lang/commons-lang/${commons-lang_commons-lang.version}</bundle> <bundle dependency="true">mvn:commons-collections/commons-collections/${commons-collections_commons-collections.version}</bundle> <bundle dependency="true">mvn:commons-pool/commons-pool/${commons-pool_commons-pool.version}</bundle> <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/${org.apache.servicemix.bundles_org.apache.servicemix.bundles.commons-dbcp.version}</bundle> <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ant/${org.apache.servicemix.bundles_org.apache.servicemix.bundles.ant.version}</bundle> <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.serp/${org.apache.servicemix.bundles_org.apache.servicemix.bundles.serp.version}</bundle> <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/${org.apache.geronimo.specs_geronimo-jms_1.1_spec.version}</bundle> <bundle dependency="true">mvn:org.apache.xbean/xbean-asm5-shaded/${org.apache.xbean_xbean-asm5-shaded.version}</bundle> <bundle>mvn:org.apache.openjpa/openjpa/${org.apache.openjpa_openjpa.version}</bundle> </feature> <feature name="osgiliath-connector" version="${org.apache.geronimo.components_geronimo-connector.version}" description="OSGi Support for JCA Connector 1.6" resolver="(obr)"> <feature version="${org.apache.aries.transaction_org.apache.aries.transaction.manager.version}">osgiliath-transaction</feature> <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.6_spec/${org.apache.geronimo.specs_geronimo-j2ee-connector_1.6_spec.version}</bundle> <bundle dependency="true">mvn:javax.validation/validation-api/${javax.validation_validation-api.version}</bundle> <bundle>mvn:org.apache.geronimo.components/geronimo-connector/${org.apache.geronimo.components_geronimo-connector.version}</bundle> </feature> <feature name="osgiliath-jpa" description="OSGi Persistence Container" version="${org.apache.aries.jpa.version}"> <feature version="${transaction-api_feature.version}" prerequisite="false" dependency="false">osgiliath-transaction-api</feature> <feature version="${persistence-api_feature.version}" prerequisite="false" dependency="false">osgiliath-persistence-api</feature> <bundle dependency="true">mvn:org.apache.felix/org.apache.felix.coordinator/${org.apache.felix_org.apache.felix.coordinator.version}</bundle> <bundle dependency="true">mvn:org.osgi/org.osgi.service.jdbc/${org.osgi_org.osgi.service.jdbc.version}</bundle> <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${org.apache.aries.jpa_org.apache.aries.jpa.api.version}</bundle> <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${org.apache.aries.jpa_org.apache.aries.jpa.container.version}</bundle> <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${org.apache.aries.jpa_org.apache.aries.jpa.support.version}</bundle> <conditional> <condition>osgiliath-aries-blueprint</condition> <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${org.apache.aries.jpa_org.apache.aries.jpa.blueprint.version}</bundle> </conditional> </feature> <feature name="osgiliath-openjpa" description="Apache OpenJPA 2.4.x persistence engine support" version="${org.apache.openjpa.version}"> <details>Enable Apache OpenJPA as persistence engine.</details> <feature prerequisite="false" dependency="false">osgiliath-jndi</feature> <feature version="${transaction-api_feature.version}" prerequisite="false" dependency="false">osgiliath-transaction-api</feature> <feature version="${persistence-api_feature.version}" prerequisite="false" dependency="false">osgiliath-persistence-api</feature> <bundle dependency="true">mvn:javax.servlet/javax.servlet-api/${javax.servlet_javax.servlet-api.version}</bundle> <bundle dependency="true">mvn:javax.el/javax.el-api/${javax.el_javax.el-api.version}</bundle> <bundle dependency="true">mvn:commons-lang/commons-lang/${commons-lang_commons-lang.version}</bundle> <bundle dependency="true">mvn:commons-collections/commons-collections/${commons-collections_commons-collections.version}</bundle> <bundle dependency="true">mvn:commons-pool/commons-pool/${commons-pool_commons-pool.version}</bundle> <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/${org.apache.servicemix.bundles_org.apache.servicemix.bundles.commons-dbcp.version}</bundle> <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ant/${org.apache.servicemix.bundles_org.apache.servicemix.bundles.ant.version}</bundle> <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.serp/${org.apache.servicemix.bundles_org.apache.servicemix.bundles.serp.version}</bundle> <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/${org.apache.geronimo.specs_geronimo-jms_1.1_spec.version}</bundle> <bundle dependency="true">mvn:org.apache.xbean/xbean-asm5-shaded/${org.apache.xbean_xbean-asm5-shaded.version}</bundle> <bundle>mvn:org.apache.openjpa/openjpa/${org.apache.openjpa_openjpa.version}</bundle> </feature> <feature name='osgiliath-persistence' version='${project.version}' resolver="(obr)" start-level="41" description="Java persistence API stack" > <bundle dependency='true'>mvn:javax.servlet/javax.servlet-api/${javax.servlet_javax.servlet-api.version}</bundle> <feature version="${project.version}">osgiliath-jdbc</feature> <feature version="${org.apache.geronimo.components_geronimo-connector.version}">osgiliath-connector</feature> <feature version="${org.apache.aries.jpa.version}">osgiliath-jpa</feature> <bundle dependency='true'>mvn:org.osgi/org.osgi.service.jpa/${org.osgi_org.osgi.service.jpa.version}</bundle> <feature version="${org.apache.openjpa.version}">osgiliath-openjpa</feature> <feature version="${org.apache.karaf.features_standard.version}">osgiliath-aries-blueprint</feature> <bundle>mvn:org.apache.xbean/xbean-reflect/${org.apache.xbean_xbean-reflect.version}</bundle> <feature version="${project.version}">osgiliath-spring-data-jpa</feature> <conditional> <condition>osgiliath-rest-management</condition> <bundle start-level="35" dependency="true">mvn:io.swagger/swagger-annotations/${io.swagger_swagger-annotations.version}</bundle> </conditional> </feature> [/code] Best regards, and keep up bringing the OSGI dream comes true ;-) -- Charlie Mordant Full OSGI/EE stack made with Karaf: https://github.com/OsgiliathEnterprise/net.osgiliath.parent ________________________________ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed to. If you are not the named addressee you should not disseminate, distribute, copy or alter this email. Please notify the sender immediately by e-mail if you have received this email by mistake and delete this email from your systems. If you are not the intended addressee, please note that disclosing, copying, distributing or taking any action in reliance on the contents of such an email is strictly prohibited. Any views or opinions presented in this email are solely those of the author and might not represent those of Pentaho Corporation and its affiliates. Please be aware that emails are not a secure mode of communication and may be intercepted by third parties. WARNING: Computer viruses and other malicious codes can be transmitted by email and its attachments. You or your organization are advised to scan this email and its attachments for the presence of any computer viruses and malicious codes. Although Pentaho Corporation has taken reasonable precautions to ensure no viruses and other malicious codes are present in this email, Pentaho Corporation cannot accept responsibility for any loss or damage arising from the use of this email or its attachments. Pentaho Corporation is a company incorporated in the State of Delaware in the USA and its principal place of business is at Suite 460, 5950 Hazeltine National Drive, Orlando, FL32822, USA.