admin管理员组

文章数量:1356444

Using ActiveMQ Artemis 2.37 in a container. Seeing same error as this question. I'm running with docker compose locally. Originally the compose file had only one entry for volumes, this:

artemis_data:/var/lib/artemis-instance

I want to override the artemis-instance/etc configuration files. I copied them to disk at config/activemq/etc. I added this mount:

"./config/activemq/etc:/var/lib/artemis-instance/etc-override"

Artemis failed to start. I updated the original volume to only use artemis-instance/data/ folder.

artemis_data:/var/lib/artemis-instance/data

That didn't work, so I changed that line to be a mount instead of a volume.

"./config/activemq/state:/var/lib/artemis-instance"

And that did not work. I see one of two errors. Either the no-such-file exception:

[.apache.activemq.artemis.core.server] AMQ224097: Failed to start server
java.io.IOException: No such file or directory
    at java.base/java.io.UnixFileSystem.createFileExclusively0(Native Method) ~[?:?]
    at java.base/java.io.UnixFileSystem.createFileExclusively(Unknown Source) ~[?:?]
    at java.base/java.io.File.createNewFile(Unknown Source) ~[?:?]
    at .apache.activemq.artemis.core.server.impl.FileBasedNodeManager.setUpServerLockFile(FileBasedNodeManager.java:145

or the lock message:

Lock appears to be valid; triple check by comparing timestamp
Validating lastModified 1743369098346 modified = 1743369098346 on file:/var/lib/artemis-instance/etc/
Validating lastModified 1743369098395 modified = 1743369098395 on file:/var/lib/artemis-instance/./etc//broker.xml

How can I override the Artemis configuration files without erroring out?

UPDATE: Relevant section of compose file

      activemq:
        image: apache/activemq-artemis:${artemis.version}
        container_name: activemq
        restart: always
        environment:
          ARTEMIS_MIN_MEMORY: 512M
          ARTEMIS_MAX_MEMORY: 1024M
          ARTEMIS_USER: ${BROKER_USERNAME}
          ARTEMIS_PASSWORD: ${BROKER_PASSWORD}
        volumes:
          - artemis_data:/var/lib/artemis-instance/data
          - "./config/activemq/etc-override:/var/lib/artemis-instance/etc-override"
        networks:
          - my-network

Using ActiveMQ Artemis 2.37 in a container. Seeing same error as this question. I'm running with docker compose locally. Originally the compose file had only one entry for volumes, this:

artemis_data:/var/lib/artemis-instance

I want to override the artemis-instance/etc configuration files. I copied them to disk at config/activemq/etc. I added this mount:

"./config/activemq/etc:/var/lib/artemis-instance/etc-override"

Artemis failed to start. I updated the original volume to only use artemis-instance/data/ folder.

artemis_data:/var/lib/artemis-instance/data

That didn't work, so I changed that line to be a mount instead of a volume.

"./config/activemq/state:/var/lib/artemis-instance"

And that did not work. I see one of two errors. Either the no-such-file exception:

[.apache.activemq.artemis.core.server] AMQ224097: Failed to start server
java.io.IOException: No such file or directory
    at java.base/java.io.UnixFileSystem.createFileExclusively0(Native Method) ~[?:?]
    at java.base/java.io.UnixFileSystem.createFileExclusively(Unknown Source) ~[?:?]
    at java.base/java.io.File.createNewFile(Unknown Source) ~[?:?]
    at .apache.activemq.artemis.core.server.impl.FileBasedNodeManager.setUpServerLockFile(FileBasedNodeManager.java:145

or the lock message:

Lock appears to be valid; triple check by comparing timestamp
Validating lastModified 1743369098346 modified = 1743369098346 on file:/var/lib/artemis-instance/etc/
Validating lastModified 1743369098395 modified = 1743369098395 on file:/var/lib/artemis-instance/./etc//broker.xml

How can I override the Artemis configuration files without erroring out?

UPDATE: Relevant section of compose file

      activemq:
        image: apache/activemq-artemis:${artemis.version}
        container_name: activemq
        restart: always
        environment:
          ARTEMIS_MIN_MEMORY: 512M
          ARTEMIS_MAX_MEMORY: 1024M
          ARTEMIS_USER: ${BROKER_USERNAME}
          ARTEMIS_PASSWORD: ${BROKER_PASSWORD}
        volumes:
          - artemis_data:/var/lib/artemis-instance/data
          - "./config/activemq/etc-override:/var/lib/artemis-instance/etc-override"
        networks:
          - my-network
Share Improve this question edited Mar 31 at 20:58 Justin Bertram 35.4k6 gold badges26 silver badges49 bronze badges asked Mar 30 at 21:28 ahofferahoffer 6,5584 gold badges42 silver badges70 bronze badges 3
  • @JustinBertram I was probably tired and wrongly assumed they were error messages. My apologies. What is the preferred mapping when you want to keep Aretmis state on a Docker volume, but want to override the etc files? The documentation shows a filemount for all of /var/lib/artemis-instance, but it seems like there would be a conflict is a second file mount added a the etc subdirectory? Just thinking about, this makes the most sense: artemis_data:/var/lib/artemis-instance/data, then adding a file mount for etc-override. – ahoffer Commented Mar 31 at 14:22
  • Added compose file. Artemis container starts without errors. It might be working, but I'm in that part of the application, so it isn't getting any traffic right now. PS: I'm a big fan of your contributions to open source. Thank you! – ahoffer Commented Mar 31 at 17:58
  • I don't understand what you mean by, "It might be working, but I'm in that part of the application..." Do you mean that you're not in that part of the application? Could you confirm that it is, in fact, not actually working before I invest more time into this? – Justin Bertram Commented Mar 31 at 18:29
Add a comment  | 

1 Answer 1

Reset to default 1

I created a simple docker-compose.yml along with a non-default broker.xml at /path/to/etc-override/ and everything worked as expected:

services:
  activemq-artemis:
    image: apache/activemq-artemis:latest
    platform: "linux/amd64"
    container_name: activemq-artemis
    ports:
      - "8161:8161"
      - "61616:61616"
    environment:
      - ARTEMIS_USER=admin
      - ARTEMIS_PASSWORD=admin
    volumes:
      - /path/to/etc-override:/var/lib/artemis-instance/etc-override

Here's the output:

$ docker compose up
[+] Running 1/1
 ✔ Container activemq-artemis  Created                                                                                                                                                                                                                            0.1s 
Attaching to activemq-artemis
artemis  | Creating ActiveMQ Artemis instance at: /var/lib/artemis-instance
artemis  | 
artemis  | Auto tuning journal ...
artemis  | done! Your system can make 125 writes per millisecond, your journal-buffer-timeout will be 8000
artemis  | 
artemis  | You can now start the broker by executing:  
artemis  | 
artemis  |    "/var/lib/artemis-instance/bin/artemis" run
artemis  | 
artemis  | Or you can run the broker in the background using:
artemis  | 
artemis  |    "/var/lib/artemis-instance/bin/artemis-service" start
artemis  | 
artemis  | copying file to etc folder: broker.xml
artemis  |      _        _               _
artemis  |     / \  ____| |_  ___ __  __(_) _____
artemis  |    / _ \|  _ \ __|/ _ \  \/  | |/  __/
artemis  |   / ___ \ | \/ |_/  __/ |\/| | |\___ \
artemis  |  /_/   \_\|   \__\____|_|  |_|_|/___ /
artemis  |  Apache ActiveMQ Artemis 2.40.0
artemis  | 
artemis  | 
artemis  | 2025-03-31 20:03:23,951 WARN  [.apache.activemq.artemis.core.server] AMQ222269: Please use a fixed value for "journal-pool-files". Default changed per https://issues.apache./jira/browse/ARTEMIS-1628
artemis  | 2025-03-31 20:03:24,041 INFO  [.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server version 2.40.0
artemis  | 2025-03-31 20:03:24,092 INFO  [.apache.activemq.artemis.core.server] AMQ221000: Primary message broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
artemis  | 2025-03-31 20:03:24,112 INFO  [.apache.activemq.artemis.core.server] AMQ221012: Using AIO Journal
artemis  | 2025-03-31 20:03:24,147 INFO  [.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 1073741824
artemis  | 2025-03-31 20:03:24,162 INFO  [.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
artemis  | 2025-03-31 20:03:24,163 INFO  [.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
artemis  | 2025-03-31 20:03:24,163 INFO  [.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
artemis  | 2025-03-31 20:03:24,163 INFO  [.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
artemis  | 2025-03-31 20:03:24,163 INFO  [.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
artemis  | 2025-03-31 20:03:24,163 INFO  [.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
artemis  | 2025-03-31 20:03:24,192 INFO  [.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain primary lock
artemis  | 2025-03-31 20:03:24,193 INFO  [.apache.activemq.artemis.core.server] AMQ221035: Primary Server Obtained primary lock
artemis  | 2025-03-31 20:03:24,497 INFO  [.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at localhost:61616 for protocols [CORE,MQTT,AMQP,HORNETQ,STOMP,OPENWIRE]
artemis  | 2025-03-31 20:03:24,503 INFO  [.apache.activemq.artemis.core.server] AMQ221007: Server is now active
artemis  | 2025-03-31 20:03:24,503 INFO  [.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.40.0 [localhost, nodeID=33bdedb1-0e6b-11f0-bc69-62564c08f8c3] 
artemis  | 2025-03-31 20:03:24,508 INFO  [.apache.activemq.artemis] AMQ241003: Starting embedded web server
artemis  | 2025-03-31 20:03:24,727 INFO  [io.hawt.HawtioContextListener] Initialising Hawtio services
artemis  | 2025-03-31 20:03:24,732 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to Hawtio 4.2.0
artemis  | 2025-03-31 20:03:24,737 INFO  [io.hawt.web.auth.AuthenticationConfiguration] Authentication throttling is enabled
artemis  | 2025-03-31 20:03:24,748 INFO  [io.hawt.web.auth.AuthenticationConfiguration] Starting Hawtio authentication filter, JAAS realm: "activemq" authorized role(s): "amq" role principal classes: ".apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
artemis  | 2025-03-31 20:03:24,748 INFO  [io.hawt.web.auth.AuthenticationConfiguration] Looking for OIDC configuration file in: /var/lib/artemis-instance/etc/hawtio-oidc.properties
artemis  | 2025-03-31 20:03:24,765 INFO  [io.hawt.web.auth.ClientRouteRedirectFilter] Hawtio ClientRouteRedirectFilter is using 1800 sec. HttpSession timeout
artemis  | 2025-03-31 20:03:24,781 INFO  [.apache.activemq.artemis] AMQ241001: HTTP Server started at http://0.0.0.0:8161
artemis  | 2025-03-31 20:03:24,781 INFO  [.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://0.0.0.0:8161/console/jolokia
artemis  | 2025-03-31 20:03:24,781 INFO  [.apache.activemq.artemis] AMQ241004: Artemis Console available at http://0.0.0.0:8161/console

The custom broker.xml is copied and used as expected.

To be clear, the log messages regarding "Lock appears to be valid..." and "Validating lastModified..." are debug log messages and don't indicate a problem.

本文标签: ActiveMQ Artemis file lock loop in containerStack Overflow