You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@artemis.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2026/03/10 20:04:00 UTC

[jira] [Commented] (ARTEMIS-5947) ActiveMQServers.newActiveMQServer(String, MBeanServer, SecurityManager) hardcodes enablePersistence=true, ignoring XML configuration

    [ https://issues.apache.org/jira/browse/ARTEMIS-5947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18064789#comment-18064789 ] 

ASF subversion and git services commented on ARTEMIS-5947:
----------------------------------------------------------

Commit c517bbf4450f2299dcd352952982fb3e5acedbe5 in artemis's branch refs/heads/ARTEMIS-5947-fix-persistence-enabled from Guillaume Nodet
[ https://gitbox.apache.org/repos/asf?p=artemis.git;h=c517bbf445 ]

ARTEMIS-5947: Fix newActiveMQServer(String,...) ignoring XML persistence-enabled setting

The 3-arg newActiveMQServer(String, MBeanServer, ActiveMQSecurityManager) method
was calling the 3-arg newActiveMQServer(Configuration, MBeanServer, SecurityManager)
which hardcodes enablePersistence=true, overriding whatever was parsed from the XML
configuration file. Changed to call the 4-arg version with config.isPersistenceEnabled()
to preserve the XML setting.


> 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
>
> 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: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org