Repository: quarkusio/quarkus
Issue: Narayana STM failing to build in Native

**Describe the bug**
When building a Quarkus application with the Narayana STM and also using any other extension that also brings the narayana JTA extension (hibernate orm, agroal, etc), the build fails in Native with:

```
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /home/jcarvaja/Downloads/tmp/code-with-quarkus/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --user 1000:1000 --rm quay.io/quarkus/ubi-quarkus-native-image:21.0.0-java11 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Duser.language=es -J-Duser.country=ES -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -J-Xmx4g -H:-AddAllCharsets -H:EnableURLProtocols=http --no-server -H:-UseServiceLoaderFeature -H:+StackTrace code-with-quarkus-1.0.0-SNAPSHOT-runner
[code-with-quarkus-1.0.0-SNAPSHOT-runner:24]    classlist:   4.198,77 ms,  1,19 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:24]        (cap):     815,95 ms,  1,19 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:24]        setup:   2.879,19 ms,  1,19 GB
15:13:59,636 INFO  [org.jbo.threads] JBoss Threads version 3.2.0.Final
To see how the classes got initialized, use --trace-class-initialization=com.arjuna.ats.internal.arjuna.utils.SocketProcessId
[code-with-quarkus-1.0.0-SNAPSHOT-runner:24]     analysis:  37.311,65 ms,  1,87 GB
Error: Classes that should be initialized at run time got initialized during image building:
 com.arjuna.ats.internal.arjuna.utils.SocketProcessId the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why com.arjuna.ats.internal.arjuna.utils.SocketProcessId got initialized use --trace-class-initialization=com.arjuna.ats.internal.arjuna.utils.SocketProcessId

com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
 com.arjuna.ats.internal.arjuna.utils.SocketProcessId the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why com.arjuna.ats.internal.arjuna.utils.SocketProcessId got initialized use --trace-class-initialization=com.arjuna.ats.internal.arjuna.utils.SocketProcessId

	at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
	at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:539)
	at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:226)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$8(NativeImageGenerator.java:740)
	at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:740)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:563)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:476)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Error: Image build request failed with exit status 1
```

**Expected behavior**
It should work as in JVM.

**Actual behavior**
It fails when building, see exception above.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to code.quarkus.io
2. Select Narayana STM extension and Agroal (or directly Narayana JTA)
3. Download the ZIP and try to build the application using:

```
 mvn clean install -Dnative -Dquarkus.native.container-build=true 
```

**Environment (please complete the following information):**
 - Quarkus version or git rev: 1.12.0.Final and 999-SNAPSHOT

Changed files:
extensions/narayana-stm/deployment/src/main/java/io/quarkus/narayana/stm/deployment/NarayanaSTMProcessor.java

diff --git a/extensions/narayana-stm/deployment/src/main/java/io/quarkus/narayana/stm/deployment/NarayanaSTMProcessor.java b/extensions/narayana-stm/deployment/src/main/java/io/quarkus/narayana/stm/deployment/NarayanaSTMProcessor.java
index b23e3d0b602..bb2082d8e3b 100644
--- a/extensions/narayana-stm/deployment/src/main/java/io/quarkus/narayana/stm/deployment/NarayanaSTMProcessor.java
+++ b/extensions/narayana-stm/deployment/src/main/java/io/quarkus/narayana/stm/deployment/NarayanaSTMProcessor.java
@@ -18,6 +18,7 @@
 
 import com.arjuna.ats.internal.arjuna.coordinator.CheckedActionFactoryImple;
 import com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore;
+import com.arjuna.ats.internal.arjuna.utils.SocketProcessId;
 import com.arjuna.ats.txoj.Lock;
 
 import io.quarkus.deployment.Feature;
@@ -30,6 +31,7 @@
 import io.quarkus.deployment.builditem.nativeimage.NativeImageSystemPropertyBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
 import io.quarkus.narayana.stm.runtime.NarayanaSTMRecorder;
 
 class NarayanaSTMProcessor {
@@ -60,8 +62,11 @@ public NativeImageSystemPropertyBuildItem substrateSystemPropertyBuildItem() {
     // so disable it at runtime
     @BuildStep()
     @Record(RUNTIME_INIT)
-    public void configureRuntimeProperties(NarayanaSTMRecorder recorder) {
+    public void configureRuntimeProperties(NarayanaSTMRecorder recorder,
+            BuildProducer<RuntimeInitializedClassBuildItem> runtimeInit) {
         recorder.disableTransactionStatusManager();
+        runtimeInit.produce(new RuntimeInitializedClassBuildItem(SocketProcessId.class.getName()));
+        runtimeInit.produce(new RuntimeInitializedClassBuildItem(Lock.class.getName()));
     }
 
     // register STM dynamic proxies