Issue
How do I connect the Web Console to an Spring Boot embedded Artemis Server ?
I have mostly followed this Answer.
- tomcat 9.0.58
activemq-web-console-5.16.3.war
inwebapps
folder- added
jakarta.servlet.jsp.jstl-1.2.6.jar
&jakarta.servlet.jsp.jstl-api-1.2.7.jar
intowebapps/activemq-web-console-5.16.3/WEB-INF/lib
, otherwise the console would not start - added the line
set "JAVA_OPTS=%JAVA_OPTS% -Dwebconsole.type=properties -Dwebconsole.jms.url=tcp://localhost:61616 -Dwebconsole.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
incatalina.bat
But now when I access the webconsole - ERROR:
- I get
Exception occurred while processing this request, check the log for more information!
- and the logs say:
IllegalStateException: No broker is found at any of the 1 configured urls
My Artemis Server is running in a minimalistic Spring Boot App:
- started with VMOptions:
-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.rmi.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
- spring boot parent:
spring-boot-starter-parent:2.6.2
- active mq:
artemis-jms-server:2.19.0
spring-boot-starter-web:2.6.2
- and the following configuration class:
@Configuration
public class ArtemisConfig implements ArtemisConfigurationCustomizer {
@Autowired
private ArtemisProperties artemisProperties;
@Override
public void customize(org.apache.activemq.artemis.core.config.Configuration configuration) {
try{
configuration.setJMXManagementEnabled(true);
configuration.setSecurityEnabled(false);
configuration.addAcceptorConfiguration("netty", "tcp://localhost:" + artemisProperties.getPort());
} catch (Exception e) {
throw new RuntimeException("queue did not start");
}
}
}
Solution
The only real problem the answer you cited is that it was written for ActiveMQ "Classic" rather than ActiveMQ Artemis. ActiveMQ Artemis doesn't use activemq-web-console-5.16.3.war
. It uses a web console based on Hawtio 2 which is split up across 3 different war files:
Deploy these to your embedded servlet container (e.g. Tomcat, Jetty, etc.). I don't think you'll need to set any system properties, but during the release process we actually strip out any SLF4J and Log4j jar files so you may need to add those back in if your environment doesn't already provide them. We remove those jars because we actually ship SLF4J in the main lib
directory of the standalone broker, and we don't actually need Log4j (since ActiveMQ Artemis uses JBoss Logging) so it's safer to remove it (especially in the wake of all the recent Log4j CVEs). See ARTEMIS-3612 for more details on that.
The web console application running in the browser communicates with the broker via Jolokia which is an HTTP-JMX bridge. Jolokia is part of the Hawtio 2 infrastructure and is included in the aforementioned war files. If the war files are being hosted in the same JVM as your Spring Boot application with ActiveMQ Artemis embedded then you should just need to point the web console app to the same server & port you're using for the console itself. If the web console is hosted separately from the Spring Boot app then you should install Jolokia and then point the web console to it.
Answered By - Justin Bertram
Answer Checked By - Senaida (JavaFixing Volunteer)