You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Ephemeris Lappis <ep...@gmail.com> on 2023/04/11 11:05:44 UTC

Karaf 4.4.3 / Unstable transaction features/services installation

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.

Re: Karaf 4.4.3 / Unstable transaction features/services installation

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello again !

After reading the code of pax-transx-tm-geronimo I think the issue
perhaps comes from the detected presence of the spring-tx exported
packages when the TM is instantiated : the code seems to protect
itself against missing classes to provide a PTM only when the
spring-tx classes are present.

I've changed the definition of my jdbc feature to add the dependency
to the feature "spring-tx", that loads the spring(tx bundle, with the
hope that the exported packages could be available before the TM is
created... But I have exactly the same behavior.

Nevertheless, when I check the order of bundles and their start level,
I think this should work :

karaf@root()> la | grep tx
122 │ Active      │  30 │ 5.3.23.1           │ Apache ServiceMix ::
Bundles :: spring-tx
karaf@root()> la | grep tm
126 │ Active      │  80 │ 0.5.3              │ pax-transx-tm-api
127 │ Active      │  80 │ 0.5.3              │ pax-transx-tm-geronimo

Now spring-tx is installed first (ID=122), and its start level is 30,
while pax-transx-tm-geronimo (ID=127), is installed after and starts
at 80.

The first install of my features makes it all work, but the stop/start
still breaks the PTM...

I don't understand how the imported packages of the
pax-transx-tm-geronimo work, since the concerned packages are
optional, but exported by the spring-tx :

karaf@root()> headers 127

pax-transx-tm-geronimo (127)
----------------------------
Bnd-LastModified = 1665560954112
Build-Jdk-Spec = 11
Created-By = Apache Maven Bundle Plugin 5.1.4
Manifest-Version = 1.0
Tool = Bnd-6.1.0.202111221555

Bundle-Activator = org.ops4j.pax.transx.tm.impl.geronimo.Activator
Bundle-Description = Maven parent POM for all OPS4J Maven projects.
Bundle-DocURL = http://www.ops4j.org/
Bundle-License = https://www.apache.org/licenses/LICENSE-2.0
Bundle-ManifestVersion = 2
Bundle-Name = pax-transx-tm-geronimo
Bundle-SymbolicName = org.ops4j.pax.transx.pax-transx-tm-geronimo
Bundle-Vendor = OPS4J - Open Participation Software for Java
Bundle-Version = 0.5.3

Provide-Capability =
        osgi.service;objectClass=javax.transaction.TransactionManager,
        osgi.service;objectClass=javax.transaction.TransactionSynchronizationRegistry,
        osgi.service;objectClass=javax.transaction.UserTransaction,
        osgi.service;objectClass=org.ops4j.pax.transx.tm.TransactionManager,
        osgi.service;objectClass=org.springframework.transaction.PlatformTransactionManager
Require-Capability =
        osgi.ee;filter:=(&(osgi.ee=JavaSE)(version=1.8))

Export-Package =
        org.apache.aries.transaction;uses:="javax.resource.spi,javax.transaction,org.apache.geronimo.transaction.manager";version=1.0,
        org.apache.geronimo.transaction;uses:=javax.transaction;version=3.1,
        org.apache.geronimo.transaction.manager;uses:="javax.resource.spi,javax.transaction,javax.transaction.xa,org.slf4j";version=3.1
Import-Package =
        javax.transaction;version="[1.1,2)",
        javax.transaction.xa,
        org.ops4j.pax.transx.tm;version="[0.5,1)",
        org.osgi.framework;version="[1.8,2)",
        org.osgi.service.cm;version="[1.5,2)",
        org.osgi.service.log;version="[1.3,2)",
        org.slf4j,
        org.springframework.transaction;resolution:=optional,
        org.springframework.transaction.jta;resolution:=optional,
        org.springframework.transaction.support;resolution:=optional,
        javax.resource.spi;resolution:=optional;version="[1.6,2)"

karaf@root()> exports | grep org.springframework.transaction
org.springframework.transaction.annotation
           │ 5.3.23            │ 122 │
org.apache.servicemix.bundles.spring-tx
org.springframework.transaction.config
           │ 5.3.23            │ 122 │
org.apache.servicemix.bundles.spring-tx
org.springframework.transaction.event
           │ 5.3.23            │ 122 │
org.apache.servicemix.bundles.spring-tx
org.springframework.transaction.interceptor
           │ 5.3.23            │ 122 │
org.apache.servicemix.bundles.spring-tx
org.springframework.transaction.jta
           │ 5.3.23            │ 122 │
org.apache.servicemix.bundles.spring-tx
org.springframework.transaction.reactive
           │ 5.3.23            │ 122 │
org.apache.servicemix.bundles.spring-tx
org.springframework.transaction.support
           │ 5.3.23            │ 122 │
org.apache.servicemix.bundles.spring-tx
org.springframework.transaction
           │ 5.3.23            │ 122 │
org.apache.servicemix.bundles.spring-tx

Is the start level ignored ?

When I execute the feature:refresh, the Karaf's logs clearly show that
even if "no change" is detected, many components are impacted, among
them the spring-tx bundle that is restarted before the
pax-transx-tm-geronimo, which explains why it works after. Here are
the logs :

14:44:39.715 INFO [features-3-thread-1] No deployment change.
14:44:39.719 INFO [features-3-thread-1] Stopping bundles:
14:44:39.724 INFO [features-3-thread-1]   facfou017-esb/100.2.2.SNAPSHOT
14:44:39.730 INFO [features-3-thread-1] Destroying container for
blueprint bundle facfou017-esb/100.2.2.SNAPSHOT
14:44:39.741 INFO [features-3-thread-1]   foo-data-service/0.0.1.SNAPSHOT
14:44:39.745 INFO [features-3-thread-1] Destroying container for
blueprint bundle foo-data-service/0.0.1.SNAPSHOT
14:44:39.795 INFO [features-3-thread-1]
org.ops4j.pax.jms.pax-jms-pool-pooledjms/1.1.2
14:44:39.800 INFO [features-3-thread-1] TransactionManager service
lost. Shutting down support for XA ConnectionFactoryFactories
14:44:39.807 INFO [features-3-thread-1] Lost service dependency:
(&(objectClass=org.ops4j.pax.jms.service.PooledConnectionFactoryFactory)(pool=pooledjms)(xa=false))
14:44:39.809 INFO [features-3-thread-1] Lost service dependency:
(&(objectClass=org.ops4j.pax.jms.service.ConnectionFactoryFactory)(type=activemq))
14:44:39.814 INFO [features-3-thread-1]
org.ops4j.pax.jms.pax-jms-activemq/1.1.2
14:44:39.817 INFO [features-3-thread-1]   org.messaginghub.pooled.jms/1.2.3
14:44:39.818 INFO [features-3-thread-1]   org.apache.activemq.osgi/5.18.0
14:44:39.819 INFO [features-3-thread-1] Destroying container for
blueprint bundle org.apache.activemq.osgi/5.18.0
14:44:39.831 INFO [features-3-thread-1]
org.ops4j.pax.transx.pax-transx-tm-geronimo/0.5.3
14:44:39.841 INFO [features-3-thread-1] TransactionManager service
lost. Shutting down support for XA DataSourceFactories
14:44:39.885 INFO [features-3-thread-1]   org.apache.camel.camel-sql/3.20.3
14:44:39.896 INFO [features-3-thread-1]
org.apache.camel.camel-spring-xml/3.20.3
14:44:39.901 INFO [features-3-thread-1]   org.apache.camel.camel-spring/3.20.3
14:44:39.918 INFO [features-3-thread-1]   org.apache.camel.camel-jms/3.20.3
14:44:39.927 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-jms/5.3.23.1
14:44:39.929 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-jdbc/5.3.23.1
14:44:39.931 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-tx/5.3.23.1
14:44:39.935 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-context-support/5.3.23.1
14:44:39.961 INFO [features-3-thread-1] Refreshing bundles:
14:44:39.971 INFO [features-3-thread-1]
foo-data-service/0.0.1.SNAPSHOT (Wired to
org.apache.servicemix.bundles.spring-tx/5.3.23.1 which is being
refreshed)
14:44:39.973 INFO [features-3-thread-1]
facfou017-esb/100.2.2.SNAPSHOT (Wired to
org.apache.camel.camel-spring/3.20.3 which is being refreshed)
14:44:39.976 INFO [features-3-thread-1]
org.apache.activemq.osgi/5.18.0 (Wired to
org.ops4j.pax.transx.pax-transx-tm-geronimo/0.5.3 which is being
refreshed)
14:44:39.978 INFO [features-3-thread-1]
org.apache.camel.camel-jms/3.20.3 (Wired to
org.apache.servicemix.bundles.spring-tx/5.3.23.1 which is being
refreshed)
14:44:39.985 INFO [features-3-thread-1]
org.apache.camel.camel-spring/3.20.3 (Wired to
org.apache.servicemix.bundles.spring-tx/5.3.23.1 which is being
refreshed)
14:44:39.990 INFO [features-3-thread-1]
org.apache.camel.camel-spring-xml/3.20.3 (Wired to
org.apache.camel.camel-spring/3.20.3 which is being refreshed)
14:44:39.997 INFO [features-3-thread-1]
org.apache.camel.camel-sql/3.20.3 (Wired to
org.apache.servicemix.bundles.spring-tx/5.3.23.1 which is being
refreshed)
14:44:39.999 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-context-support/5.3.23.1 (Wired
to org.apache.servicemix.bundles.spring-jdbc/5.3.23.1 which is being
refreshed)
14:44:40.008 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-jdbc/5.3.23.1 (Wired to
org.apache.servicemix.bundles.spring-tx/5.3.23.1 which is being
refreshed)
14:44:40.009 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-jms/5.3.23.1 (Wired to
org.apache.servicemix.bundles.spring-tx/5.3.23.1 which is being
refreshed)
14:44:40.014 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-tx/5.3.23.1 (Should be wired to:
javax.transaction-api/1.2.0 (through
[org.apache.servicemix.bundles.spring-tx/5.3.23.1]
osgi.wiring.package; resolution:=optional;
filter:="(&(osgi.wiring.package=javax.transaction)(version>=1.2.0)(!(version>=2.0.0)))"))
14:44:40.015 INFO [features-3-thread-1]
org.messaginghub.pooled.jms/1.2.3 (Should be wired to:
org.ops4j.pax.transx.pax-transx-tm-geronimo/0.5.3 (through
[org.messaginghub.pooled.jms/1.2.3] osgi.wiring.package;
resolution:=optional;
filter:="(&(osgi.wiring.package=org.apache.geronimo.transaction.manager)(version>=3.0.0)(!(version>=4.0.0)))"),
javax.transaction-api/1.2.0 (through
[org.messaginghub.pooled.jms/1.2.3] osgi.wiring.package;
resolution:=optional;
filter:="(&(osgi.wiring.package=javax.transaction)(version>=1.1.0)(!(version>=2.0.0)))"))
14:44:40.022 INFO [features-3-thread-1]
org.ops4j.pax.jms.pax-jms-activemq/1.1.2 (Wired to
org.apache.activemq.osgi/5.18.0 which is being refreshed)
14:44:40.026 INFO [features-3-thread-1]
org.ops4j.pax.jms.pax-jms-pool-pooledjms/1.1.2 (Wired to
org.messaginghub.pooled.jms/1.2.3 which is being refreshed)
14:44:40.027 INFO [features-3-thread-1]
org.ops4j.pax.transx.pax-transx-tm-geronimo/0.5.3 (Wired to
org.apache.servicemix.bundles.spring-tx/5.3.23.1 which is being
refreshed)
14:44:40.186 INFO [features-3-thread-1] Starting bundles:
14:44:40.194 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-tx/5.3.23.1
14:44:40.201 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-jms/5.3.23.1
14:44:40.212 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-jdbc/5.3.23.1
14:44:40.214 INFO [features-3-thread-1]
org.apache.servicemix.bundles.spring-context-support/5.3.23.1
14:44:40.219 INFO [features-3-thread-1]   org.apache.camel.camel-sql/3.20.3
14:44:40.241 INFO [features-3-thread-1]   org.apache.camel.camel-spring/3.20.3
14:44:40.275 INFO [features-3-thread-1]
org.apache.camel.camel-spring-xml/3.20.3
14:44:40.297 INFO [features-3-thread-1]   org.apache.camel.camel-jms/3.20.3
14:44:40.326 INFO [features-3-thread-1]
org.ops4j.pax.transx.pax-transx-tm-geronimo/0.5.3
14:44:40.339 INFO [features-3-thread-1]   org.messaginghub.pooled.jms/1.2.3
14:44:40.340 INFO [features-3-thread-1]
org.ops4j.pax.jms.pax-jms-pool-pooledjms/1.1.2
14:44:40.360 INFO [features-3-thread-1] Obtained service dependency:
(&(objectClass=org.ops4j.pax.jms.service.PooledConnectionFactoryFactory)(pool=pooledjms)(xa=false))
14:44:40.361 INFO [features-3-thread-1] Waiting for service
dependency: (&(objectClass=org.ops4j.pax.jms.service.ConnectionFactoryFactory)(type=activemq))
14:44:40.369 INFO [features-3-thread-1]   foo-data-service/0.0.1.SNAPSHOT
14:44:40.390 INFO [features-3-thread-1] Blueprint bundle
foo-data-service/0.0.1.SNAPSHOT is waiting for dependencies
[(&(osgi.jndi.service.name=jdbc/alice)(objectClass=javax.sql.DataSource))]
14:44:40.403 INFO [features-3-thread-1]   facfou017-esb/100.2.2.SNAPSHOT
14:44:40.420 INFO [features-3-thread-1] Blueprint bundle
facfou017-esb/100.2.2.SNAPSHOT is waiting for dependencies
[(&(osgi.jndi.service.name=jdbc/alice)(objectClass=javax.sql.DataSource)),
(objectClass=com.company.foo.buddy.ExchangeBuddy),
(objectClass=org.springframework.transaction.PlatformTransactionManager),
(&(osgi.jndi.service.name=jms/alice)(objectClass=javax.jms.ConnectionFactory))]
14:44:40.429 INFO [features-3-thread-1]   org.apache.activemq.osgi/5.18.0
14:44:40.444 INFO [paxtransx-config-1-thread-1] TransactionManager
service detected. Providing support for XA DataSourceFactories
14:44:40.447 INFO [paxtransx-config-1-thread-1] Found
DataSourceFactory. Creating DataSource jdbc/alice
14:44:40.452 INFO [Blueprint Extender: 1] Blueprint bundle
facfou017-esb/100.2.2.SNAPSHOT is waiting for dependencies
[(objectClass=com.company.foo.buddy.ExchangeBuddy),
(objectClass=org.springframework.transaction.PlatformTransactionManager),
(&(osgi.jndi.service.name=jms/alice)(objectClass=javax.jms.ConnectionFactory))]
14:44:40.465 INFO [paxtransx-config-1-thread-1] TransactionManager
service detected. Providing support for XA ConnectionFactoryFactories
14:44:40.473 INFO [Blueprint Extender: 1] Blueprint bundle
facfou017-esb/100.2.2.SNAPSHOT is waiting for dependencies
[(objectClass=com.company.foo.buddy.ExchangeBuddy),
(&(osgi.jndi.service.name=jms/alice)(objectClass=javax.jms.ConnectionFactory))]
14:44:40.498 INFO [Blueprint Extender: 2] Suppression du cache
'foo.exchanges' (Trouvé : false)
14:44:40.509 INFO [features-3-thread-1] Blueprint bundle
org.apache.activemq.osgi/5.18.0 has been started
14:44:40.513 INFO [features-3-thread-1]
org.ops4j.pax.jms.pax-jms-activemq/1.1.2
14:44:40.521 INFO [Blueprint Extender: 2] Suppression du cache
'foo.transcoding' (Trouvé : false)
14:44:40.522 INFO [features-3-thread-1] Obtained service dependency:
(&(objectClass=org.ops4j.pax.jms.service.ConnectionFactoryFactory)(type=activemq))
14:44:40.523 INFO [features-3-thread-1] Found
ConnectionFactoryFactory. Creating ConnectionFactory jms/alice
14:44:40.530 INFO [Blueprint Extender: 2] Blueprint bundle
foo-data-service/0.0.1.SNAPSHOT has been started
14:44:40.565 INFO [features-3-thread-1] Provided ConnectionFactory
implementation is JMS 2.0+ capable.
14:44:40.573 INFO [Blueprint Extender: 3] Blueprint bundle
facfou017-esb/100.2.2.SNAPSHOT is waiting for dependencies
[(objectClass=com.company.foo.buddy.ExchangeBuddy)]
14:44:40.590 INFO [features-3-thread-1] Done.
14:44:40.646 INFO [Blueprint Extender: 3] Using custom
UnitOfWorkFactory:
com.company.foo.buddy.service.uow.FooMDCUnitOfWorkFactoryService@7b44d6c2
14:44:40.654 INFO [Blueprint Extender: 3] Using custom EventNotifier
with id: buddyEventNotifier and implementation:
com.company.foo.buddy.service.events.FooEventNotifier@198c35da
14:44:40.657 INFO [Blueprint Extender: 3] Using CamelClusterService
with id: null and implementation:
org.apache.camel.component.file.cluster.FileLockClusterService@610e1456
14:44:40.729 INFO [Blueprint Extender: 3] Blueprint bundle
facfou017-esb/100.2.2.SNAPSHOT has been started
14:44:40.741 INFO [Blueprint Event Dispatcher: 1] Attempting to start
CamelContext: facfou017_context
14:44:40.887 INFO [Blueprint Event Dispatcher: 1] Apache Camel 3.20.3
(facfou017_context) is starting
14:44:40.888 INFO [Blueprint Event Dispatcher: 1] MDC logging is
enabled on CamelContext: facfou017_context
14:44:41.155 INFO [Blueprint Event Dispatcher: 1] Routes startup (started:3)
14:44:41.156 INFO [Blueprint Event Dispatcher: 1]     Started
acq_facfou017 (ref://in)
14:44:41.157 INFO [Blueprint Event Dispatcher: 1]     Started
trf_facfou017 (jms://facfou017.internal.queue)
14:44:41.158 INFO [Blueprint Event Dispatcher: 1]     Started
diff_facfou017 (seda://broadcastJson)
14:44:41.158 INFO [Blueprint Event Dispatcher: 1] Apache Camel 3.20.3
(facfou017_context) started in 417ms (build:4ms init:143ms
start:270ms)


Any help is welcome... Thanks !

Regards.

Le mer. 12 avr. 2023 à 10:14, Maurice Betzel
<m....@gaston-schul.com> a écrit :
>
> Hi Ephemeris,
>
> First thing to notice, are you aiming to use XA transactions with JMS / JDBC? As far as I know only the pax jdbc aries pool and transactionmanager support this.
> The following setup is for Karaf 4.2.6 / ActiveMQ 5.15.9 / Camel 2.24.1 and is proven in years of production.
>
> Basic Karaf runtime:
>
>                <startupFeatures>
>                         <feature>eventadmin</feature>
>                </startupFeatures>
> <bootFeatures>
>                         <feature>wrap</feature>
>                         <feature>shell</feature>
>                         <feature>feature</feature>
>                         <feature>jaas</feature>
>                         <feature>ssh</feature>
>                         <feature>management</feature>
>                         <feature>bundle</feature>
>                         <feature>config</feature>
>                         <feature>deployer</feature>
>                         <feature>diagnostic</feature>
>                         <feature>feature</feature>
>                         <feature>instance</feature>
>                         <feature>kar</feature>
>                         <feature>log</feature>
>                         <feature>package</feature>
>                         <feature>wrapper</feature>
>                         <feature>service</feature>
>                         <feature>system</feature>
>                  </bootFeatures>
>
> This is my ActiveMQ pooling and connection factory setup using activemq-camel and JMS 1.1, I am just now migrating to pax transx and Artemis:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
>            xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.5.0">
>
>     <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
>
>     <cm:property-placeholder persistent-id="eu.abeel.platform.activemq.service" update-strategy="reload">
>         <cm:default-properties>
>             <cm:property name="broker-name" value="amq-broker"/>
>             <cm:property name="maximumRedeliveries" value="0"/>
>             <cm:property name="maximumRedeliveryDelay" value="-1"/>
>             <cm:property name="initialRedeliveryDelay" value="1000"/>
>             <cm:property name="redeliveryDelay" value="1000"/>
>             <cm:property name="useCollisionAvoidance" value="false"/>
>             <cm:property name="useExponentialBackOff" value="false"/>
>             <cm:property name="backOffMultiplier" value="5"/>
>         </cm:default-properties>
>     </cm:property-placeholder>
>
>     <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
>         <property name="brokerURL" value="vm://${broker-name}?create=false&amp;waitForStart=10000"/>
>         <property name="userName" value="$[activemq.jms.user]"/>
>         <property name="password" value="$[activemq.jms.password]"/>
>     </bean>
>
>     <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
>         <property name="maxConnections" value="8"/>
>         <property name="connectionFactory" ref="activemqConnectionFactory"/>
>     </bean>
>
>     <!-- XA -->
>     <bean id="activeMQXAConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
>         <property name="brokerURL" value="vm://${broker-name}?create=false&amp;waitForStart=10000"/>
>         <property name="userName" value="$[activemq.jms.user]"/>
>         <property name="password" value="$[activemq.jms.password]"/>
>         <property name="redeliveryPolicy">
>             <bean class="org.apache.activemq.RedeliveryPolicy">
>                 <property name="maximumRedeliveries" value="${maximumRedeliveries}"/>
>                 <property name="maximumRedeliveryDelay" value="${maximumRedeliveryDelay}"/>
>                 <property name="initialRedeliveryDelay" value="${initialRedeliveryDelay}"/>
>                 <property name="useCollisionAvoidance" value="${useCollisionAvoidance}"/>
>                 <property name="useExponentialBackOff" value="${useExponentialBackOff}"/>
>                 <property name="backOffMultiplier" value="${backOffMultiplier}"/>
>             </bean>
>         </property>
>     </bean>
>
>     <!-- connection factory wrapper to support auto-enlisting of XA resource -->
>     <bean id="jcaPooledConnectionFactory" class="org.apache.activemq.pool.JcaPooledConnectionFactory">
>         <property name="maxConnections" value="8"/>
>         <property name="connectionFactory" ref="activeMQXAConnectionFactory"/>
>         <property name="transactionManager" ref="osgiJtaTransactionManager"/>
>         <property name="name" value="activemq.${broker-name}"/>
>     </bean>
>
>     <!-- ActiveMQ XA Resource Manager -->
>     <bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager" init-method="recoverResource">
>         <property name="transactionManager" ref="osgiJtaTransactionManager"/>
>         <property name="connectionFactory" ref="jcaPooledConnectionFactory"/>
>         <property name="resourceName" value="activemq.${broker-name}"/>
>     </bean>
>
>     <reference id="osgiJtaTransactionManager" interface="javax.transaction.TransactionManager" availability="mandatory"/>
>
>     <!-- Register the javax.jms.ConnectionFactory in the OSGi Service Registry -->
>     <service ref="pooledConnectionFactory" interface="javax.jms.ConnectionFactory">
>         <service-properties>
>             <entry key="name" value="platform-jms-cf"/>
>             <entry key="transacted" value="false"/>
>             <entry key="osgi.jndi.service.name" value="jms/platform-cf"/>
>         </service-properties>
>     </service>
>
>     <!-- Register the javax.jms.ConnectionFactory for the XA PooledConnectionFactory in the OSGi Service Registry -->
>     <service ref="jcaPooledConnectionFactory" interface="javax.jms.ConnectionFactory">
>         <service-properties>
>             <entry key="name" value="platform-jms-cf-xa"/>
>             <entry key="transacted" value="true"/>
>             <entry key="osgi.jndi.service.name" value="jms/platform-cf-xa"/>
>         </service-properties>
>     </service>
>
> </blueprint>
>
> This is the feature installing JMS:
>
> <feature name="platform-jms" description="ActiveMQ messaging" version="${project.version}" start-level="50">
>         <details>MOM implementation provided by Apache ActiveMQ</details>
>         <feature>transaction</feature>
>         <feature>aries-blueprint</feature>
>         <feature>activemq-broker-noweb</feature>
>         <feature>activemq-camel</feature>
>         <bundle>mvn:eu.abeel.platform.activemq/service/${project.version}</bundle>
>         <configfile finalname="/etc/eu.abeel.platform.activemq.service.cfg">
>             mvn:eu.abeel.platform.activemq/service/${project.version}/cfg/activemq-service
>         </configfile>
>     </feature>
>
> This is my feature for MariaDB with pax-jdbc 1.5.0, Hibernate 5.2.18.Final and Aries transactionmanager 1.3.3 with jpa 2.7.2, a JDBC connection pool gets created only if a specified config file is deployed in the /etc folder:
>
>    <feature name="platform-facade-mariadb-persistence" version="${project.version}">
>         <feature>aries-blueprint</feature>
>         <feature>transaction</feature>
>         <feature>jndi</feature>
>         <!-- Pax JDBC -->
>         <bundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc/${pax.jdbc.version}</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-mariadb/${pax.jdbc.version}</bundle>
>         <bundle>mvn:org.apache.karaf.jdbc/org.apache.karaf.jdbc.core/${karaf.version}</bundle>
>         <bundle>mvn:org.apache.aries/org.apache.aries.util/1.1.3</bundle>
>         <bundle>mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/${aries.transaction.manager.version}</bundle>
>         <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
>         <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.6_spec/1.0</bundle>
>         <bundle>mvn:org.apache.geronimo.specs/geronimo-validation_1.0_spec/1.1</bundle>
>         <bundle>mvn:org.apache.geronimo.components/geronimo-connector/3.1.4</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/${pax.jdbc.version}</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-aries/${pax.jdbc.version}</bundle>
>         <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.3_1</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-config/${pax.jdbc.version}</bundle>
>         <!-- AriesJPA -->
>         <bundle>mvn:org.osgi/org.osgi.service.jpa/1.1.0</bundle>
>         <bundle>mvn:javax.interceptor/javax.interceptor-api/${javax.interceptor-api.version}</bundle>
>         <bundle>mvn:javax.persistence/javax.persistence-api/${javax.persistence-api.version}</bundle>
>         <capability>
>             osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider
>         </capability>
>         <bundle dependency="true" start-level="30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa.javax.persistence/javax.persistence_2.1/${aries.jpa.version}</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.version}</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${aries.jpa.version}</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${aries.jpa.version}</bundle>
>         <!-- Hibernate ORM -->
>         <bundle>mvn:org.jboss.logging/jboss-logging/3.4.1.Final</bundle>
>         <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
>         <bundle>mvn:org.javassist/javassist/3.27.0-GA</bundle>
>         <bundle>mvn:net.bytebuddy/byte-buddy/1.10.17</bundle>
>         <bundle>mvn:org.jboss.spec.javax.transaction/jboss-transaction-api_1.2_spec/1.1.1.Final</bundle>
>         <bundle>mvn:org.jboss/jandex/2.1.3.Final</bundle>
>         <bundle>mvn:com.fasterxml/classmate/1.5.1</bundle>
>         <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/2.1.3_1</bundle>
>         <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/5.1.2.Final</bundle>
>         <bundle>mvn:org.hibernate/hibernate-core/${hibernate.orm.version}</bundle>
>         <bundle>mvn:org.hibernate/hibernate-osgi/${hibernate.orm.version}</bundle>
>         <capability>
>             osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
>         </capability>
>     </feature>
>
>
> -----Oorspronkelijk bericht-----
> Van: Ephemeris Lappis <ep...@gmail.com>
> Verzonden: woensdag 12 april 2023 09:33
> Aan: user@karaf.apache.org
> Onderwerp: Re: 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 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 <m....@gaston-schul.com> 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 <ep...@gmail.com>
> > Verzonden: dinsdag 11 april 2023 13:06
> > Aan: user@karaf.apache.org
> > 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.
> >
> 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.
>

Re: Karaf 4.4.3 / Unstable transaction features/services installation

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.

I'm going to check my XA configuration, but our tests seem to confirm
it works : our JMS and JDBC configurations are all based on factories
with pax-XXX-config, with pooling and XA features, and we have no
custom blueprints to set them...

In parallel I've found some interesting evidence in the bundle
pax-transx-tm-geronimo-0.5.3 code : I attach the Java class.

First, at line 141 the bundle try to instantiate a spring TM :

        try {
            try {
                transactionManager = new
SpringTransactionManagerCreator().create(transactionTimeout,
xidFactory, transactionLog);
                useSpring = true;
            } catch (NoClassDefFoundError e) {
                transactionManager = new
GeronimoTransactionManager(transactionTimeout, xidFactory,
transactionLog);
            }
        } catch (XAException e) {
            throw new RuntimeException("An exception occurred during
transaction recovery.", e);
        }

Then, at line159, depending on the result of the first block, the
PlatformTransactionManager is binded to the tm instance :

       if (useSpring) {
            clazzes.add(PLATFORM_TRANSACTION_MANAGER_CLASS);
        }

Does it mean that the classloader changes on :
- the first install of the features
- the stop/start
- the feature:refresh ???

I have no explicit dependency on Spring TM feature/bundle, and
nevertheless, the code that uses the PlatformTransactionManager
finally works.

I don't understand why the first time all is OK, and why the
stop/start and then refresh do changes on spring dependencies...

An idea ?

Thanks.

Regards.

Le mer. 12 avr. 2023 à 10:14, Maurice Betzel
<m....@gaston-schul.com> a écrit :
>
> Hi Ephemeris,
>
> First thing to notice, are you aiming to use XA transactions with JMS / JDBC? As far as I know only the pax jdbc aries pool and transactionmanager support this.
> The following setup is for Karaf 4.2.6 / ActiveMQ 5.15.9 / Camel 2.24.1 and is proven in years of production.
>
> Basic Karaf runtime:
>
>                <startupFeatures>
>                         <feature>eventadmin</feature>
>                </startupFeatures>
> <bootFeatures>
>                         <feature>wrap</feature>
>                         <feature>shell</feature>
>                         <feature>feature</feature>
>                         <feature>jaas</feature>
>                         <feature>ssh</feature>
>                         <feature>management</feature>
>                         <feature>bundle</feature>
>                         <feature>config</feature>
>                         <feature>deployer</feature>
>                         <feature>diagnostic</feature>
>                         <feature>feature</feature>
>                         <feature>instance</feature>
>                         <feature>kar</feature>
>                         <feature>log</feature>
>                         <feature>package</feature>
>                         <feature>wrapper</feature>
>                         <feature>service</feature>
>                         <feature>system</feature>
>                  </bootFeatures>
>
> This is my ActiveMQ pooling and connection factory setup using activemq-camel and JMS 1.1, I am just now migrating to pax transx and Artemis:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
>            xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.5.0">
>
>     <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
>
>     <cm:property-placeholder persistent-id="eu.abeel.platform.activemq.service" update-strategy="reload">
>         <cm:default-properties>
>             <cm:property name="broker-name" value="amq-broker"/>
>             <cm:property name="maximumRedeliveries" value="0"/>
>             <cm:property name="maximumRedeliveryDelay" value="-1"/>
>             <cm:property name="initialRedeliveryDelay" value="1000"/>
>             <cm:property name="redeliveryDelay" value="1000"/>
>             <cm:property name="useCollisionAvoidance" value="false"/>
>             <cm:property name="useExponentialBackOff" value="false"/>
>             <cm:property name="backOffMultiplier" value="5"/>
>         </cm:default-properties>
>     </cm:property-placeholder>
>
>     <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
>         <property name="brokerURL" value="vm://${broker-name}?create=false&amp;waitForStart=10000"/>
>         <property name="userName" value="$[activemq.jms.user]"/>
>         <property name="password" value="$[activemq.jms.password]"/>
>     </bean>
>
>     <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
>         <property name="maxConnections" value="8"/>
>         <property name="connectionFactory" ref="activemqConnectionFactory"/>
>     </bean>
>
>     <!-- XA -->
>     <bean id="activeMQXAConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
>         <property name="brokerURL" value="vm://${broker-name}?create=false&amp;waitForStart=10000"/>
>         <property name="userName" value="$[activemq.jms.user]"/>
>         <property name="password" value="$[activemq.jms.password]"/>
>         <property name="redeliveryPolicy">
>             <bean class="org.apache.activemq.RedeliveryPolicy">
>                 <property name="maximumRedeliveries" value="${maximumRedeliveries}"/>
>                 <property name="maximumRedeliveryDelay" value="${maximumRedeliveryDelay}"/>
>                 <property name="initialRedeliveryDelay" value="${initialRedeliveryDelay}"/>
>                 <property name="useCollisionAvoidance" value="${useCollisionAvoidance}"/>
>                 <property name="useExponentialBackOff" value="${useExponentialBackOff}"/>
>                 <property name="backOffMultiplier" value="${backOffMultiplier}"/>
>             </bean>
>         </property>
>     </bean>
>
>     <!-- connection factory wrapper to support auto-enlisting of XA resource -->
>     <bean id="jcaPooledConnectionFactory" class="org.apache.activemq.pool.JcaPooledConnectionFactory">
>         <property name="maxConnections" value="8"/>
>         <property name="connectionFactory" ref="activeMQXAConnectionFactory"/>
>         <property name="transactionManager" ref="osgiJtaTransactionManager"/>
>         <property name="name" value="activemq.${broker-name}"/>
>     </bean>
>
>     <!-- ActiveMQ XA Resource Manager -->
>     <bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager" init-method="recoverResource">
>         <property name="transactionManager" ref="osgiJtaTransactionManager"/>
>         <property name="connectionFactory" ref="jcaPooledConnectionFactory"/>
>         <property name="resourceName" value="activemq.${broker-name}"/>
>     </bean>
>
>     <reference id="osgiJtaTransactionManager" interface="javax.transaction.TransactionManager" availability="mandatory"/>
>
>     <!-- Register the javax.jms.ConnectionFactory in the OSGi Service Registry -->
>     <service ref="pooledConnectionFactory" interface="javax.jms.ConnectionFactory">
>         <service-properties>
>             <entry key="name" value="platform-jms-cf"/>
>             <entry key="transacted" value="false"/>
>             <entry key="osgi.jndi.service.name" value="jms/platform-cf"/>
>         </service-properties>
>     </service>
>
>     <!-- Register the javax.jms.ConnectionFactory for the XA PooledConnectionFactory in the OSGi Service Registry -->
>     <service ref="jcaPooledConnectionFactory" interface="javax.jms.ConnectionFactory">
>         <service-properties>
>             <entry key="name" value="platform-jms-cf-xa"/>
>             <entry key="transacted" value="true"/>
>             <entry key="osgi.jndi.service.name" value="jms/platform-cf-xa"/>
>         </service-properties>
>     </service>
>
> </blueprint>
>
> This is the feature installing JMS:
>
> <feature name="platform-jms" description="ActiveMQ messaging" version="${project.version}" start-level="50">
>         <details>MOM implementation provided by Apache ActiveMQ</details>
>         <feature>transaction</feature>
>         <feature>aries-blueprint</feature>
>         <feature>activemq-broker-noweb</feature>
>         <feature>activemq-camel</feature>
>         <bundle>mvn:eu.abeel.platform.activemq/service/${project.version}</bundle>
>         <configfile finalname="/etc/eu.abeel.platform.activemq.service.cfg">
>             mvn:eu.abeel.platform.activemq/service/${project.version}/cfg/activemq-service
>         </configfile>
>     </feature>
>
> This is my feature for MariaDB with pax-jdbc 1.5.0, Hibernate 5.2.18.Final and Aries transactionmanager 1.3.3 with jpa 2.7.2, a JDBC connection pool gets created only if a specified config file is deployed in the /etc folder:
>
>    <feature name="platform-facade-mariadb-persistence" version="${project.version}">
>         <feature>aries-blueprint</feature>
>         <feature>transaction</feature>
>         <feature>jndi</feature>
>         <!-- Pax JDBC -->
>         <bundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc/${pax.jdbc.version}</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-mariadb/${pax.jdbc.version}</bundle>
>         <bundle>mvn:org.apache.karaf.jdbc/org.apache.karaf.jdbc.core/${karaf.version}</bundle>
>         <bundle>mvn:org.apache.aries/org.apache.aries.util/1.1.3</bundle>
>         <bundle>mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/${aries.transaction.manager.version}</bundle>
>         <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
>         <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.6_spec/1.0</bundle>
>         <bundle>mvn:org.apache.geronimo.specs/geronimo-validation_1.0_spec/1.1</bundle>
>         <bundle>mvn:org.apache.geronimo.components/geronimo-connector/3.1.4</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/${pax.jdbc.version}</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-aries/${pax.jdbc.version}</bundle>
>         <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.3_1</bundle>
>         <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-config/${pax.jdbc.version}</bundle>
>         <!-- AriesJPA -->
>         <bundle>mvn:org.osgi/org.osgi.service.jpa/1.1.0</bundle>
>         <bundle>mvn:javax.interceptor/javax.interceptor-api/${javax.interceptor-api.version}</bundle>
>         <bundle>mvn:javax.persistence/javax.persistence-api/${javax.persistence-api.version}</bundle>
>         <capability>
>             osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider
>         </capability>
>         <bundle dependency="true" start-level="30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa.javax.persistence/javax.persistence_2.1/${aries.jpa.version}</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.version}</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${aries.jpa.version}</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
>         <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${aries.jpa.version}</bundle>
>         <!-- Hibernate ORM -->
>         <bundle>mvn:org.jboss.logging/jboss-logging/3.4.1.Final</bundle>
>         <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
>         <bundle>mvn:org.javassist/javassist/3.27.0-GA</bundle>
>         <bundle>mvn:net.bytebuddy/byte-buddy/1.10.17</bundle>
>         <bundle>mvn:org.jboss.spec.javax.transaction/jboss-transaction-api_1.2_spec/1.1.1.Final</bundle>
>         <bundle>mvn:org.jboss/jandex/2.1.3.Final</bundle>
>         <bundle>mvn:com.fasterxml/classmate/1.5.1</bundle>
>         <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/2.1.3_1</bundle>
>         <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/5.1.2.Final</bundle>
>         <bundle>mvn:org.hibernate/hibernate-core/${hibernate.orm.version}</bundle>
>         <bundle>mvn:org.hibernate/hibernate-osgi/${hibernate.orm.version}</bundle>
>         <capability>
>             osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
>         </capability>
>     </feature>
>
>
> -----Oorspronkelijk bericht-----
> Van: Ephemeris Lappis <ep...@gmail.com>
> Verzonden: woensdag 12 april 2023 09:33
> Aan: user@karaf.apache.org
> Onderwerp: Re: 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 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 <m....@gaston-schul.com> 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 <ep...@gmail.com>
> > Verzonden: dinsdag 11 april 2023 13:06
> > Aan: user@karaf.apache.org
> > 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.
> >
> 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.
>

RE: Karaf 4.4.3 / Unstable transaction features/services installation

Posted by Maurice Betzel <m....@gaston-schul.com>.
Hi Ephemeris,

First thing to notice, are you aiming to use XA transactions with JMS / JDBC? As far as I know only the pax jdbc aries pool and transactionmanager support this.
The following setup is for Karaf 4.2.6 / ActiveMQ 5.15.9 / Camel 2.24.1 and is proven in years of production.

Basic Karaf runtime:

               <startupFeatures>
                        <feature>eventadmin</feature>
               </startupFeatures>
<bootFeatures>
                        <feature>wrap</feature>
                        <feature>shell</feature>
                        <feature>feature</feature>
                        <feature>jaas</feature>
                        <feature>ssh</feature>
                        <feature>management</feature>
                        <feature>bundle</feature>
                        <feature>config</feature>
                        <feature>deployer</feature>
                        <feature>diagnostic</feature>
                        <feature>feature</feature>
                        <feature>instance</feature>
                        <feature>kar</feature>
                        <feature>log</feature>
                        <feature>package</feature>
                        <feature>wrapper</feature>
                        <feature>service</feature>
                        <feature>system</feature>
                 </bootFeatures>

This is my ActiveMQ pooling and connection factory setup using activemq-camel and JMS 1.1, I am just now migrating to pax transx and Artemis:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.5.0">

    <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>

    <cm:property-placeholder persistent-id="eu.abeel.platform.activemq.service" update-strategy="reload">
        <cm:default-properties>
            <cm:property name="broker-name" value="amq-broker"/>
            <cm:property name="maximumRedeliveries" value="0"/>
            <cm:property name="maximumRedeliveryDelay" value="-1"/>
            <cm:property name="initialRedeliveryDelay" value="1000"/>
            <cm:property name="redeliveryDelay" value="1000"/>
            <cm:property name="useCollisionAvoidance" value="false"/>
            <cm:property name="useExponentialBackOff" value="false"/>
            <cm:property name="backOffMultiplier" value="5"/>
        </cm:default-properties>
    </cm:property-placeholder>

    <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="vm://${broker-name}?create=false&amp;waitForStart=10000"/>
        <property name="userName" value="$[activemq.jms.user]"/>
        <property name="password" value="$[activemq.jms.password]"/>
    </bean>

    <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="maxConnections" value="8"/>
        <property name="connectionFactory" ref="activemqConnectionFactory"/>
    </bean>

    <!-- XA -->
    <bean id="activeMQXAConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
        <property name="brokerURL" value="vm://${broker-name}?create=false&amp;waitForStart=10000"/>
        <property name="userName" value="$[activemq.jms.user]"/>
        <property name="password" value="$[activemq.jms.password]"/>
        <property name="redeliveryPolicy">
            <bean class="org.apache.activemq.RedeliveryPolicy">
                <property name="maximumRedeliveries" value="${maximumRedeliveries}"/>
                <property name="maximumRedeliveryDelay" value="${maximumRedeliveryDelay}"/>
                <property name="initialRedeliveryDelay" value="${initialRedeliveryDelay}"/>
                <property name="useCollisionAvoidance" value="${useCollisionAvoidance}"/>
                <property name="useExponentialBackOff" value="${useExponentialBackOff}"/>
                <property name="backOffMultiplier" value="${backOffMultiplier}"/>
            </bean>
        </property>
    </bean>

    <!-- connection factory wrapper to support auto-enlisting of XA resource -->
    <bean id="jcaPooledConnectionFactory" class="org.apache.activemq.pool.JcaPooledConnectionFactory">
        <property name="maxConnections" value="8"/>
        <property name="connectionFactory" ref="activeMQXAConnectionFactory"/>
        <property name="transactionManager" ref="osgiJtaTransactionManager"/>
        <property name="name" value="activemq.${broker-name}"/>
    </bean>

    <!-- ActiveMQ XA Resource Manager -->
    <bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager" init-method="recoverResource">
        <property name="transactionManager" ref="osgiJtaTransactionManager"/>
        <property name="connectionFactory" ref="jcaPooledConnectionFactory"/>
        <property name="resourceName" value="activemq.${broker-name}"/>
    </bean>

    <reference id="osgiJtaTransactionManager" interface="javax.transaction.TransactionManager" availability="mandatory"/>

    <!-- Register the javax.jms.ConnectionFactory in the OSGi Service Registry -->
    <service ref="pooledConnectionFactory" interface="javax.jms.ConnectionFactory">
        <service-properties>
            <entry key="name" value="platform-jms-cf"/>
            <entry key="transacted" value="false"/>
            <entry key="osgi.jndi.service.name" value="jms/platform-cf"/>
        </service-properties>
    </service>

    <!-- Register the javax.jms.ConnectionFactory for the XA PooledConnectionFactory in the OSGi Service Registry -->
    <service ref="jcaPooledConnectionFactory" interface="javax.jms.ConnectionFactory">
        <service-properties>
            <entry key="name" value="platform-jms-cf-xa"/>
            <entry key="transacted" value="true"/>
            <entry key="osgi.jndi.service.name" value="jms/platform-cf-xa"/>
        </service-properties>
    </service>

</blueprint>

This is the feature installing JMS:

<feature name="platform-jms" description="ActiveMQ messaging" version="${project.version}" start-level="50">
        <details>MOM implementation provided by Apache ActiveMQ</details>
        <feature>transaction</feature>
        <feature>aries-blueprint</feature>
        <feature>activemq-broker-noweb</feature>
        <feature>activemq-camel</feature>
        <bundle>mvn:eu.abeel.platform.activemq/service/${project.version}</bundle>
        <configfile finalname="/etc/eu.abeel.platform.activemq.service.cfg">
            mvn:eu.abeel.platform.activemq/service/${project.version}/cfg/activemq-service
        </configfile>
    </feature>

This is my feature for MariaDB with pax-jdbc 1.5.0, Hibernate 5.2.18.Final and Aries transactionmanager 1.3.3 with jpa 2.7.2, a JDBC connection pool gets created only if a specified config file is deployed in the /etc folder:

   <feature name="platform-facade-mariadb-persistence" version="${project.version}">
        <feature>aries-blueprint</feature>
        <feature>transaction</feature>
        <feature>jndi</feature>
        <!-- Pax JDBC -->
        <bundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
        <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc/${pax.jdbc.version}</bundle>
        <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-mariadb/${pax.jdbc.version}</bundle>
        <bundle>mvn:org.apache.karaf.jdbc/org.apache.karaf.jdbc.core/${karaf.version}</bundle>
        <bundle>mvn:org.apache.aries/org.apache.aries.util/1.1.3</bundle>
        <bundle>mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/${aries.transaction.manager.version}</bundle>
        <bundle>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
        <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.6_spec/1.0</bundle>
        <bundle>mvn:org.apache.geronimo.specs/geronimo-validation_1.0_spec/1.1</bundle>
        <bundle>mvn:org.apache.geronimo.components/geronimo-connector/3.1.4</bundle>
        <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-common/${pax.jdbc.version}</bundle>
        <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-aries/${pax.jdbc.version}</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.3_1</bundle>
        <bundle>mvn:org.ops4j.pax.jdbc/pax-jdbc-config/${pax.jdbc.version}</bundle>
        <!-- AriesJPA -->
        <bundle>mvn:org.osgi/org.osgi.service.jpa/1.1.0</bundle>
        <bundle>mvn:javax.interceptor/javax.interceptor-api/${javax.interceptor-api.version}</bundle>
        <bundle>mvn:javax.persistence/javax.persistence-api/${javax.persistence-api.version}</bundle>
        <capability>
            osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider
        </capability>
        <bundle dependency="true" start-level="30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa.javax.persistence/javax.persistence_2.1/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${aries.jpa.version}</bundle>
        <!-- Hibernate ORM -->
        <bundle>mvn:org.jboss.logging/jboss-logging/3.4.1.Final</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_5</bundle>
        <bundle>mvn:org.javassist/javassist/3.27.0-GA</bundle>
        <bundle>mvn:net.bytebuddy/byte-buddy/1.10.17</bundle>
        <bundle>mvn:org.jboss.spec.javax.transaction/jboss-transaction-api_1.2_spec/1.1.1.Final</bundle>
        <bundle>mvn:org.jboss/jandex/2.1.3.Final</bundle>
        <bundle>mvn:com.fasterxml/classmate/1.5.1</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/2.1.3_1</bundle>
        <bundle>mvn:org.hibernate.common/hibernate-commons-annotations/5.1.2.Final</bundle>
        <bundle>mvn:org.hibernate/hibernate-core/${hibernate.orm.version}</bundle>
        <bundle>mvn:org.hibernate/hibernate-osgi/${hibernate.orm.version}</bundle>
        <capability>
            osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
        </capability>
    </feature>


-----Oorspronkelijk bericht-----
Van: Ephemeris Lappis <ep...@gmail.com>
Verzonden: woensdag 12 april 2023 09:33
Aan: user@karaf.apache.org
Onderwerp: Re: 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 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 <m....@gaston-schul.com> 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 <ep...@gmail.com>
> Verzonden: dinsdag 11 april 2023 13:06
> Aan: user@karaf.apache.org
> 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.
>
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.


Re: Karaf 4.4.3 / Unstable transaction features/services installation

Posted by Ephemeris Lappis <ep...@gmail.com>.
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
<m....@gaston-schul.com> 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 <ep...@gmail.com>
> Verzonden: dinsdag 11 april 2023 13:06
> Aan: user@karaf.apache.org
> 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.
>

RE: Karaf 4.4.3 / Unstable transaction features/services installation

Posted by Maurice Betzel <m....@gaston-schul.com>.
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 <ep...@gmail.com>
Verzonden: dinsdag 11 april 2023 13:06
Aan: user@karaf.apache.org
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.