[
https://issues.apache.org/jira/browse/ARTEMIS-5947?focusedWorklogId=1009089&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1009089
]
ASF GitHub Bot logged work on ARTEMIS-5947:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 11/Mar/26 13:15
Start Date: 11/Mar/26 13:15
Worklog Time Spent: 10m
Work Description: clebertsuconic merged PR #6286:
URL: https://github.com/apache/artemis/pull/6286
Issue Time Tracking
-------------------
Worklog Id: (was: 1009089)
Time Spent: 50m (was: 40m)
> ActiveMQServers.newActiveMQServer(String, MBeanServer, SecurityManager)
> hardcodes enablePersistence=true, ignoring XML configuration
> ------------------------------------------------------------------------------------------------------------------------------------
>
> Key: ARTEMIS-5947
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5947
> Project: Artemis
> Issue Type: Bug
> Affects Versions: 2.44.0
> Reporter: Guillaume Nodet
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> h3. Summary
> {{ActiveMQServers.newActiveMQServer(String configURL, MBeanServer,
> ActiveMQSecurityManager)}} hardcodes {{enablePersistence=true}},
> silently ignoring the XML configuration's
> {{<persistence-enabled>false</persistence-enabled>}}.
> h3. Details
> The 3-arg method parses an XML configuration file but then calls the 3-arg
> {{newActiveMQServer(Configuration, MBeanServer,
> ActiveMQSecurityManager)}} which delegates to the 4-arg version with
> {{enablePersistence=true}} hardcoded:
> {code:java}
> public static ActiveMQServer newActiveMQServer(final String configURL,
> final MBeanServer
> mbeanServer,
> final
> ActiveMQSecurityManager securityManager) throws Exception {
> FileConfiguration config = new FileConfiguration();
> LegacyJMSConfiguration legacyJMSConfiguration = new
> LegacyJMSConfiguration(config);
> new FileDeploymentManager(configURL)
>
> .addDeployable(config).addDeployable(legacyJMSConfiguration).readConfiguration();
> // This calls the 3-arg version which hardcodes enablePersistence=true:
> ActiveMQServer server = ActiveMQServers.newActiveMQServer(config,
> mbeanServer, securityManager);
> return server;
> }
> public static ActiveMQServer newActiveMQServer(final Configuration config,
> final MBeanServer
> mbeanServer,
> final
> ActiveMQSecurityManager securityManager) {
> // Hardcodes enablePersistence=true, overriding the XML's
> <persistence-enabled>false</persistence-enabled>
> ActiveMQServer server = ActiveMQServers.newActiveMQServer(config,
> mbeanServer, securityManager, true);
> return server;
> }
> {code}
> The 4-arg method does {{config.setPersistenceEnabled(enablePersistence)}},
> overriding whatever was parsed from XML.
> h3. Impact
> On JDK 25 (macOS), enabling persistence causes the embedded broker to get
> stuck in {{STARTING}} state during journal initialization,
> likely due to JDK 25's tighter native access restrictions
> ({{System::loadLibrary}} warnings from {{activemq-artemis-native}}) affecting
> the AIO to NIO journal fallback path. The broker never transitions to
> {{STARTED}}, and {{waitForActivation()}} times out.
> h3. Suggested fix
> The {{newActiveMQServer(String, MBeanServer, SecurityManager)}} method
> should honor the parsed XML configuration's persistence setting:
> {code:java}
> public static ActiveMQServer newActiveMQServer(final String configURL,
> final MBeanServer
> mbeanServer,
> final
> ActiveMQSecurityManager securityManager) throws Exception {
> FileConfiguration config = new FileConfiguration();
> LegacyJMSConfiguration legacyJMSConfiguration = new
> LegacyJMSConfiguration(config);
> new FileDeploymentManager(configURL)
>
> .addDeployable(config).addDeployable(legacyJMSConfiguration).readConfiguration();
> // Use config.isPersistenceEnabled() instead of hardcoding true
> ActiveMQServer server = ActiveMQServers.newActiveMQServer(
> config, mbeanServer, securityManager,
> config.isPersistenceEnabled());
> return server;
> }
> {code}
> h3. Workaround
> Parse the XML manually and call the 4-arg version directly:
> {code:java}
> FileConfiguration config = new FileConfiguration();
> LegacyJMSConfiguration legacyJMSConfiguration = new
> LegacyJMSConfiguration(config);
> new FileDeploymentManager(configURL)
>
> .addDeployable(config).addDeployable(legacyJMSConfiguration).readConfiguration();
> activeMQServer = ActiveMQServers.newActiveMQServer(config, null,
> securityManager, false);
> {code}
> h3. Environment
> * Artemis 2.44.0
> * JDK 25 (Temurin 25.0.2+10)
> * macOS (Darwin)
> Discovered via Apache Camel {{JmsToJmsTransactedSecurityIT}} test failure.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]