ansible-middleware / amq

A collection to manage AMQ brokers
Apache License 2.0
16 stars 11 forks source link

AMQ broker does not start correctly due to a problem with a variable in sysconfiog file. #22

Closed RobertFloor closed 2 years ago

RobertFloor commented 2 years ago
SUMMARY

AMQ broker does not start correctly due to a problem in sysconfiog file. The Java arguments container the variable ARTEMIS_INSTANCE_ETC_URI. This is not defined in the sysconfig file. this leads to a problem starting the service and a 503 error for the webconsole.

ISSUE TYPE
STEPS TO REPRODUCE

1 Start the broker from the main playbook. ansible-playbook -i hosts_vagrant.yml playbooks/activemq.yml -v

❯ cat hosts_vagrant.yml
all:
  children:
    amq:
      children:
        left:
          hosts: 192.168.2.211
        right:
          hosts: 192.168.2.212
EXPECTED RESULTS

Service should start AMQ correctly

ACTUAL RESULTS

Service contains a not interpolated variable:

[root@amq1 log]# systemctl status amq-broker.service | more
● amq-broker.service - amq-broker Apache ActiveMQ Service
   Loaded: loaded (/etc/systemd/system/amq-broker.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-09-02 08:11:07 UTC; 5min ago
  Process: 17291 ExecStop=/opt/amq/amq-broker/bin/artemis-service stop (code=exited, status=0/SUCCESS)
  Process: 17338 ExecStart=/opt/amq/amq-broker/bin/artemis-service start (code=exited, status=0/SUCCESS)
 Main PID: 17346 (java)
    Tasks: 47 (limit: 5953)
   Memory: 179.5M
   CGroup: /system.slice/amq-broker.service
           └─17346 /usr/lib/jvm/java-11-openjdk-11.0.16.0.8-1.el8_6.x86_64/bin/java -Xms512M -Xmx2G -XX:+PrintClassHistogram -XX:+UseG1GC -XX:+UseStringDeduplication -Dhawtio.disableProxy=true -Dhawtio.realm=activemq -Dhawti
o.offline=true -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Djolokia.policyLocation=**${ARTEMIS_INSTANCE_ETC_URI}jolokia-access.xml** -Dhawtio.role=amq -Xbootclasspath/a:/opt/
amq/apache-artemis-2.18.0/lib/jboss-logmanager-2.1.10.Final.jar:/opt/amq/apache-artemis-2.18.0/lib/wildfly-common-1.5.2.Final.jar -Djava.security.auth.login.config=/opt/amq/amq-broker/etc/login.config -classpath /opt/amq/a
pache-artemis-2.18.0/lib/artemis-boot.jar -Dartemis.home=/opt/amq/apache-artemis-2.18.0 -Dartemis.instance=/opt/amq/amq-broker -Djava.library.path=/opt/amq/apache-artemis-2.18.0/bin/lib/linux-x86_64 -Djava.io.tmpdir=/opt/a
mq/amq-broker/tmp -Ddata.dir=/opt/amq/amq-broker/data -Dartemis.instance.etc=/opt/amq/amq-broker/etc -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=file:/opt/amq/amq-broker/etc//logging
.properties org.apache.activemq.artemis.boot.Artemis run

Sep 02 08:11:06 amq1.test.local systemd[1]: amq-broker.service: Succeeded.
Sep 02 08:11:06 amq1.test.local systemd[1]: Stopped amq-broker Apache ActiveMQ Service.
Sep 02 08:11:06 amq1.test.local systemd[1]: Starting amq-broker Apache ActiveMQ Service...
Sep 02 08:11:06 amq1.test.local artemis-service[17338]: Starting artemis-service
Sep 02 08:11:07 amq1.test.local artemis-service[17338]: artemis-service is now running (17346)
Sep 02 08:11:07 amq1.test.local systemd[1]: Started amq-broker Apache ActiveMQ Service.
2022-09-02 08:11:10,228 WARN  [org.eclipse.jetty.webapp.WebAppContext] Failed startup of context o.e.j.w.WebAppContext@cdb2d95{hawtio,/console,file:///opt/amq/amq-broker/tmp/webapps/jetty-0_0_0_0-8161-console_war-_console-any-13591837186429975029/webapp/,UNAVAILABLE}{/opt/amq/apache-artemis-2.18.0/web/console.war}: javax.servlet.ServletException: jolokia-agent==io.hawt.web.servlets.JolokiaConfiguredAgentServlet@c61e72f3{jsp=null,order=1,inst=true,async=false,src=DESCRIPTOR:file:///opt/amq/amq-broker/tmp/webapps/jetty-0_0_0_0-8161-console_war-_console-any-13591837186429975029/webapp/WEB-INF/web.xml,STARTED}
Caused by: java.lang.IllegalArgumentException: Unknown expression ARTEMIS_INSTANCE_ETC_URI in ${ARTEMIS_INSTANCE_ETC_URI}jolokia-access.xml
    at org.jolokia.util.NetworkUtil.replaceExpression(NetworkUtil.java:362)
    at org.jolokia.restrictor.RestrictorFactory.createRestrictor(RestrictorFactory.java:48)
    at org.jolokia.http.AgentServlet.createRestrictor(AgentServlet.java:195)
    at org.jolokia.http.AgentServlet.init(AgentServlet.java:135)
    at io.hawt.web.servlets.JolokiaConfiguredAgentServlet.init(JolokiaConfiguredAgentServlet.java:55)
    at org.eclipse.jetty.servlet.ServletHolder$Wrapper.init(ServletHolder.java:1345) [jetty-all-9.4.43.v20210629-uber.jar:9.4.43.v20210629]
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:632) [jetty-all-9.4.43.v20210629-uber.jar:9.4.43.v20210629]
    ... 38 more
guidograzioli commented 2 years ago

The var should be set by artemis create in etc/artemis.profile; however since we know the value we can statically set it in the java opts