Hello Maurice.

I attach a description of our features stack, starting with low level
resource management, then framework and common features, and finally
an application feature example.

The transaction feature is pulled by a common "foo-base", and used in
some of our application bundles that need both JMS and JDBC commits.
The blueprint code is something like that :

    <reference
        id="barJMS"
        interface="javax.jms.ConnectionFactory"
        filter="(osgi.jndi.service.name=jms/bar)" />
    <reference
        id="barDS"
        interface="javax.sql.DataSource"
        filter="(osgi.jndi.service.name=jdbc/bar)" />

    <reference
        id="transactionManager"
        interface="org.springframework.transaction.PlatformTransactionManager"
/>

    <bean class="org.apache.camel.spring.spi.SpringTransactionPolicy">
        <argument ref="transactionManager" />
    </bean>

Any comment is welcome ;) !

Thanks.

Regards.

Le mar. 11 avr. 2023 à 20:03, Maurice Betzel
<[email protected]> a écrit :
>
> Hi, I do remember having a similar issue years back and I feel your pain but 
> I cannot remember what I did to cure the issue.
> What do your custom features look like so I can compare them.
>
> -----Oorspronkelijk bericht-----
> Van: Ephemeris Lappis <[email protected]>
> Verzonden: dinsdag 11 april 2023 13:06
> Aan: [email protected]
> Onderwerp: Karaf 4.4.3 / Unstable transaction features/services installation
>
>  CAUTION: This email originated from outside of Gaston Schul. Do not click 
> links or open attachments unless you recognize the sender and know the 
> content is safe.
>
>
> Hello.
>
> I've already posted some similar questions some weeks ago about some issues 
> we had with our features deployment, but I didn't get any explanation or 
> solution. I will try again before creating a ticket for an issue that perhaps 
> is not a bug...
>
> Our "low level" karaf features install commons services like :
> - pax-jms (with ActiveMQ client and a configuration file)
> - pax-jdbc (with PostgreSQL driver and a configuration file)
> - transaction
>
> Then we install common Camel features and our applications features.
>
> If I'm not wrong, the feature transaction has the following dependencies :
>     -> feature transaction-manager-geronimo
>         -> feature pax-transx-tm-geronimo
>             -> starts bundle
> mvn:org.ops4j.pax.transx/pax-transx-tm-geronimo/0.5.3
>
> This bundle exposes the service "PlatformTransactionmanager" that we need to 
> create transaction policies in some of our application's bundles.
>
> When we install all the features on a clean Karaf, all the services are 
> started, and the dependency on the PlatformTransactionManager
> (PTM) is resolved as expected.
>
> in list of services we have :
>
> pax-transx-tm-geronimo (126) provides:
> --------------------------------------
> [org.osgi.service.cm.ManagedService]
> [javax.transaction.TransactionManager,
> javax.transaction.TransactionSynchronizationRegistry,
> javax.transaction.UserTransaction,
> org.apache.geronimo.transaction.manager.RecoverableTransactionManager,
> org.springframework.transaction.PlatformTransactionManager]
> [org.ops4j.pax.transx.tm.TransactionManager]
>
> But if we stop the Karaf, and start it again, the PTM doesn't start, and the 
> dependent bundles fail. The services list doesn't include the PTM anymore :
>
> pax-transx-tm-geronimo (126) provides:
>
> --------------------------------------
>
>   [org.osgi.service.cm.ManagedService]
>
> [javax.transaction.TransactionManager,
> javax.transaction.TransactionSynchronizationRegistry,
> javax.transaction.UserTransaction,
> org.apache.geronimo.transaction.manager.RecoverableTransactionManager]
> [org.ops4j.pax.transx.tm.TransactionManager]
>
> I discovered that using "feature:refresh" does something that restarts the 
> missing service. Then stopping and starting Karaf seems to have no impact.
>
> I don't understand why the Karaf feature installation works the first time, 
> but doesn't let the system in a stable state, and what the refresh does to 
> get it working again, since no change has been applied...
>
> Thanks in advance for any ideas.
>
> Regards.
> Al onze verrichtingen geschieden op basis van de Algemene voorwaarden der 
> Expediteurs van België, gepubliceerd in de bijlage tot het Belgisch 
> Staatsblad dd. 24 juni 2005 onder nr. 0090237. De tekst van deze voorwaarden 
> wordt op uw verzoek gratis toegezonden.
> All our transactions are subject to the General Conditions of the Belgian 
> Forwarders Association which have been published under nr. 0090237 in the 
> "Bijlage tot het Belgisch Staatsblad" dated June 24th, 2005, and is available 
> free of charge upon request.
> Toutes nos opérations se font sur base des Conditions Générales des 
> Expéditeurs de Belgique. Le texte en a été publié dans l' Annexe au Moniteur 
> Belge du 24 juin 2005 sous le n° 0090237. Ce texte sera vous envoyé 
> gratuitment sur demande.
> Email confidentiality notice:
> This email and any files transmitted with it are confidential and intended 
> only for the use of the recipient. If you have received this email in error 
> please notify its sender.
>
---------------------------------------------
Low level features : JDBC and JMS using pax-*
---------------------------------------------

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-system-jdbc">
    <feature name="foo-system-jdbc" description="Foo::System::JDBC" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: System :: JDBC data source for Bar database</details>
        <feature prerequisite="true">transaction</feature>
        <feature prerequisite="true">pax-jdbc-config</feature>
        <feature prerequisite="true">pax-jdbc-pool-dbcp2</feature>
        <bundle>mvn:org.postgresql/postgresql/42.6.0</bundle>
    </feature>
</features>

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-system-jms">
    
<repository>mvn:org.apache.activemq/activemq-karaf/5.18.0/xml/features</repository>
    <feature name="foo-system-jms" description="Foo::System::JMS" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: System :: JMS connection factory</details>
        <feature version="5.18.0" prerequisite="true">activemq-client</feature>
        <feature prerequisite="true">pax-jms-activemq</feature>
        <feature prerequisite="true">pax-jms-pool-pooledjms</feature>
        <feature prerequisite="true">pax-jms-config</feature>
    </feature>
</features>

-------------------------
Camel and common features
-------------------------

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; name="foo-base">
    
<repository>mvn:org.apache.camel.karaf/apache-camel/3.20.3/xml/features</repository>
    <feature name="foo-base" description="Foo::Base" version="0.0.1.SNAPSHOT">
        <details>Foo :: Base feature</details>
        <feature prerequisite="true">aries-blueprint</feature>
        <feature prerequisite="true">transaction</feature>
        <feature prerequisite="true">foo-system-jdbc</feature>
        <feature prerequisite="true">foo-system-jms</feature>
        <feature prerequisite="true">camel-core</feature>
        <feature prerequisite="true">camel-blueprint</feature>
        <feature prerequisite="true">camel-master</feature>
        <feature prerequisite="true">camel-jackson</feature>
        <feature prerequisite="true">camel-jetty</feature>
        <bundle>mvn:commons-io/commons-io/2.11.0</bundle>
    </feature>
</features>

--------------------------------------------------------
Framework features, with API and services implementation
--------------------------------------------------------

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-cache-api">
    <feature name="foo-cache-api" description="Foo::Cache::API" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: Cache:: API of the cache system</details>
        <feature prerequisite="true">foo-base</feature>
        <bundle>mvn:com.company.foo/foo-cache-api/0.0.1-SNAPSHOT</bundle>
    </feature>
</features>

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-cache-service">
    <feature name="foo-cache-service" description="Foo::Cache::Service" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: Cache :: Implementation of the cache system</details>
        <feature prerequisite="true">foo-cache-api</feature>
        <feature prerequisite="true" dependency="false">wrap</feature>
        <bundle>mvn:com.company.foo/foo-cache-service/0.0.1-SNAPSHOT</bundle>
        <bundle>mvn:com.github.ben-manes.caffeine/caffeine/3.1.2</bundle>
        <bundle>mvn:org.checkerframework/checker-qual/3.27.0</bundle>
        
<bundle>wrap:mvn:com.google.errorprone/error_prone_annotations/2.16</bundle>
        
<capability>osgi.service;objectClass=com.company.foo.cache.CacheSystem;effective:=active</capability>
    </feature>
</features>

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-data-api">
    <feature name="foo-data-api" description="Foo::Data::API" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: Data :: API of exchanges data management</details>
        <feature prerequisite="true">foo-base</feature>
        <bundle>mvn:com.company.foo/foo-data-api/0.0.1-SNAPSHOT</bundle>
    </feature>
</features>

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-data-service">
    <feature name="foo-data-service" description="Foo::Data::Service" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: Data :: Implementation service of the exchanges data 
management service</details>
        <feature prerequisite="true">foo-data-api</feature>
        <feature prerequisite="true">foo-cache-api</feature>
        <feature prerequisite="true">spring-jdbc</feature>
        <bundle>mvn:com.company.foo/foo-data-service/0.0.1-SNAPSHOT</bundle>
        
<capability>osgi.service;objectClass=com.company.foo.data.ExchangeDataManager;effective:=active</capability>
        
<capability>osgi.service;objectClass=com.company.foo.data.TranscodingDataManager;effective:=active</capability>
    </feature>
</features>

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-camel-api">
    <feature name="foo-camel-api" description="Foo::Camel::API" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: Camel :: API of various Camel's add-on 
features</details>
        <feature prerequisite="true">foo-base</feature>
        <bundle>mvn:com.company.foo/foo-camel-api/0.0.1-SNAPSHOT</bundle>
    </feature>
</features>

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-camel-service">
    <feature name="foo-camel-service" description="Foo::Camel::Service" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: Camel :: Implementation of various Camel's add-on 
features</details>
        <feature prerequisite="true">foo-camel-api</feature>
        <bundle>mvn:com.company.foo/foo-camel-service/0.0.1-SNAPSHOT</bundle>
        <bundle>mvn:org.beanio/beanio/2.1.0</bundle>
        
<capability>osgi.service;objectClass=com.company.foo.camel.beanio.BeanioProcessorFactory;effective:=active</capability>
    </feature>
</features>

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-helper-api">
    <feature name="foo-helper-api" description="Foo::Helper::API" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: Helper :: API of the helper of all Bar's exchange 
projects</details>
        <feature prerequisite="true">foo-base</feature>
        <bundle>mvn:com.company.foo/foo-helper-api/0.0.1-SNAPSHOT</bundle>
    </feature>
</features>

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-helper-service">
    <feature name="foo-helper-service" description="Foo::Helper::Service" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: Helper :: Implementation service of the helper of all 
Bar's exchange projects</details>
        <feature prerequisite="true">foo-helper-api</feature>
        <feature prerequisite="true">foo-data-api</feature>
        <bundle>mvn:com.company.foo/foo-helper-service/0.0.1-SNAPSHOT</bundle>
        
<capability>osgi.service;objectClass=com.company.foo.helper.ExchangeHelper;effective:=active</capability>
        
<capability>osgi.service;objectClass=com.company.foo.helper.FooMDCUnitOfWorkFactory;effective:=active</capability>
    </feature>
</features>

--------------------------------------------------------------------------
Framework support feature : all applications features rely on this feature
--------------------------------------------------------------------------

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="foo-support">
    <feature name="foo-support" description="Foo::Support" 
version="0.0.1.SNAPSHOT">
        <details>Foo :: Support features for all Bar's exchanges</details>
        <feature prerequisite="true">foo-base</feature>
        <feature prerequisite="true">foo-camel-api</feature>
        <feature prerequisite="true">foo-helper-api</feature>
        <feature prerequisite="true">camel-jms</feature>
        <feature prerequisite="true">camel-sql</feature>
        <feature prerequisite="true">camel-jaxb</feature>
        <feature prerequisite="true">camel-spring</feature>
        <feature prerequisite="true">camel-groovy</feature>
        <feature prerequisite="true">camel-bindy</feature>
        <feature prerequisite="true">camel-csv</feature>
        <feature prerequisite="true" dependency="false">wrap</feature>
        <bundle>mvn:org.apache.commons/commons-lang3/3.12.0</bundle>
        <bundle>mvn:org.apache.commons/commons-collections4/4.4</bundle>
        <bundle>wrap:mvn:org.apache.poi/poi/5.2.3</bundle>
        <bundle>mvn:commons-codec/commons-codec/1.15</bundle>
        <bundle>mvn:org.apache.commons/commons-math3/3.6.1</bundle>
        <bundle>wrap:mvn:com.zaxxer/SparseBitSet/1.2</bundle>
    </feature>
</features>

---------------------------------------------------
An example of application feature (among about 100)
---------------------------------------------------

<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
name="bbbmmm999-f901-esb">
    <feature name="bbbmmm999-f901-esb" 
description="Bar::ESB::bbbmmm999-f901-esb" version="1.0.0.SNAPSHOT">
        <details>Bar :: ESB :: Flux bbbmmm999-f901-esb (An example of incoming 
exchange)</details>
        <feature prerequisite="true">foo-support</feature>
        
<bundle>mvn:com.company.foo-testing/bbbmmm999-f901-esb/1.0.0-SNAPSHOT</bundle>
    </feature>
</features>

Reply via email to