Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions artemis-console-cache-key-provider/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-console-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>

<groupId>org.apache.activemq</groupId>
<artifactId>artemis-console-cache-key-provider</artifactId>
<packaging>jar</packaging>


<name>ActiveMQ Artemis Console Cache Key Provider</name>

<properties>
<activemq.basedir>${project.parent.basedir}</activemq.basedir>
</properties>

<dependencies>
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-service-jmx</artifactId>
<version>${jolokia.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<version>${activemq.artemis.version}</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.jolokia;

import javax.management.ObjectInstance;

import org.jolokia.service.jmx.api.CacheKeyProvider;

public class ArtemisCacheKeyProvider extends CacheKeyProvider {

public ArtemisCacheKeyProvider(int pOrderId) {
super(pOrderId);
}

@Override
public String determineKey(ObjectInstance objectInstance) {
try {
if (Class.forName("org.apache.activemq.artemis.core.management.impl.AbstractControl").isAssignableFrom(Class.forName(objectInstance.getClassName()))) {
return objectInstance.getClassName();
}
} catch (Exception e) {
// ignore
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

org.apache.activemq.artemis.jolokia.ArtemisCacheKeyProvider,100
1 change: 1 addition & 0 deletions artemis-console-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<!-- Path to the Hawtio TypeScript plugin -->
<extension.path>artemis-extension</extension.path>
<extension.install.dir>artemis-extension</extension.install.dir>
<activemq.basedir>${project.parent.basedir}</activemq.basedir>
</properties>
<build>
<finalName>${project.artifactId}</finalName>
Expand Down
9 changes: 9 additions & 0 deletions artemis-console-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@

<name>ActiveMQ Artemis Console War</name>

<properties>
<activemq.basedir>${project.parent.basedir}</activemq.basedir>
</properties>

<dependencies>
<dependency>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it need to go in the war? if it is picked up from the /lib dir, it will also work for jolokia deployed as an agent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried putting it into the broker's lib directory, but Jetty chokes on this:

 WARN  [org.eclipse.jetty.ee9.webapp.WebAppContext] Failed startup of context oeje9w.WebAppContext@3719360c{Artemis Console,/console,file:///path/to/artemis-instance/tmp/webapps/console.war/webapp/,false,@Connector-0}{/path/to/artemis-home/web/console.war}
java.lang.NoClassDefFoundError: org/jolokia/service/jmx/api/CacheKeyProvider
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
        at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        at org.eclipse.jetty.ee9.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:474)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:467)
        at org.jolokia.server.core.util.ClassUtil.classForName(ClassUtil.java:66)
        at org.jolokia.server.core.util.ClassUtil.classForName(ClassUtil.java:44)
        at org.jolokia.server.core.util.LocalServiceFactory.createOrRemoveService(LocalServiceFactory.java:171)
        at org.jolokia.server.core.util.LocalServiceFactory.readServiceDefinitionFromUrl(LocalServiceFactory.java:134)
        at org.jolokia.server.core.util.LocalServiceFactory.readServiceDefinitions(LocalServiceFactory.java:118)
        at org.jolokia.server.core.util.LocalServiceFactory.createServices(LocalServiceFactory.java:79)
        at org.jolokia.server.core.service.impl.ClasspathServiceCreator.getServices(ClasspathServiceCreator.java:36)
        at org.jolokia.server.core.service.impl.JolokiaServiceManagerImpl.addServices(JolokiaServiceManagerImpl.java:189)
        at org.jolokia.server.core.http.AgentServlet.initServices(AgentServlet.java:156)
        at org.jolokia.server.core.http.AgentServlet.init(AgentServlet.java:128)
        at io.hawt.web.servlets.JolokiaConfiguredAgentServlet.init(JolokiaConfiguredAgentServlet.java:58)
        at org.eclipse.jetty.ee9.servlet.ServletHolder$Wrapper.init(ServletHolder.java:1307)
        at org.eclipse.jetty.ee9.servlet.ServletHolder.initServlet(ServletHolder.java:634)
        at org.eclipse.jetty.ee9.servlet.ServletHolder.initialize(ServletHolder.java:416)
        at org.eclipse.jetty.ee9.servlet.ServletHandler.lambda$initialize$2(ServletHandler.java:727)
        at org.eclipse.jetty.util.ExceptionUtil.call(ExceptionUtil.java:339)
        at org.eclipse.jetty.util.ExceptionUtil$MultiException.callAndCatch(ExceptionUtil.java:277)
        at org.eclipse.jetty.ee9.servlet.ServletHandler.lambda$initialize$3(ServletHandler.java:724)
        at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
        at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
        at org.eclipse.jetty.ee9.servlet.ServletHandler.initialize(ServletHandler.java:752)
        at org.eclipse.jetty.ee9.servlet.ServletContextHandler.startContext(ServletContextHandler.java:364)
        at org.eclipse.jetty.ee9.webapp.WebAppContext.startWebapp(WebAppContext.java:1360)
        at org.eclipse.jetty.ee9.webapp.WebAppContext.startContext(WebAppContext.java:1321)
        at org.eclipse.jetty.ee9.nested.ContextHandler.doStartInContext(ContextHandler.java:698)
        at org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.call(ContextHandler.java:1457)
        at org.eclipse.jetty.ee9.nested.ContextHandler.doStart(ContextHandler.java:682)
        at org.eclipse.jetty.ee9.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
        at org.eclipse.jetty.ee9.webapp.WebAppContext.doStart(WebAppContext.java:529)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
        at org.eclipse.jetty.server.Handler$Abstract.doStart(Handler.java:491)
        at org.eclipse.jetty.server.handler.ContextHandler.lambda$doStart$0(ContextHandler.java:762)
        at org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.call(ContextHandler.java:1463)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:762)
        at org.eclipse.jetty.ee9.nested.ContextHandler$CoreContextHandler.doStart(ContextHandler.java:2836)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:120)
        at org.eclipse.jetty.server.Handler$Abstract.doStart(Handler.java:491)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.server.Server.start(Server.java:643)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:120)
        at org.eclipse.jetty.server.Handler$Abstract.doStart(Handler.java:491)
        at org.eclipse.jetty.server.Server.doStart(Server.java:584)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
        at org.apache.activemq.artemis.component.WebServerComponent.start(WebServerComponent.java:246)
        at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.addExternalComponent(ActiveMQServerImpl.java:1025)
        at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:146)
        at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:222)
        at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:170)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:149)
        at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:61)
Caused by: java.lang.ClassNotFoundException: org.jolokia.service.jmx.api.CacheKeyProvider
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
        ... 77 more

I didn't want to move a bunch of related jars out of the console and into the broker.

<groupId>org.apache.activemq</groupId>
<artifactId>artemis-console-cache-key-provider</artifactId>
<version>${project.version}</version>
</dependency>
<!-- we need to depend on this for the build output -->
<dependency>
<groupId>org.apache.activemq</groupId>
Expand Down
130 changes: 130 additions & 0 deletions etc/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?xml version="1.0"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<!-- See http://checkstyle.sourceforge.net/checks.html for documentation on available checks -->
<module name="Checker">
<!-- Checks to see if a file contains a tab character. -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>

<!-- Checks for trailing whitespace. -->
<module name="RegexpSingleline">
<!-- \s matches whitespace character, $ matches end of line. -->
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>

<module name="TreeWalker">
<module name="AtclauseOrder"/>
<module name="NonEmptyAtclauseDescription"/>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="InvalidJavadocPosition"/>
<module name="JavadocBlockTagLocation"/>
<module name="JavadocContentLocation"/>
<module name="JavadocLeadingAsteriskAlign" />
<module name="JavadocMissingLeadingAsterisk"/>
<module name="JavadocMissingWhitespaceAfterAsterisk"/>

<!-- Checks for imports -->
<module name="AvoidStarImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>

<!-- Modifier Checks -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>

<!-- Checks for common coding problems -->
<module name="EmptyStatement"/>
<!-- Checks that classes that override equals() also override hashCode(). -->
<module name="EqualsHashCode"/>
<!-- Checks for illegal instantiations where a factory method is preferred. -->
<module name="IllegalInstantiation"/>

<!-- Checks that long constants are defined with an upper ell. -->
<module name="UpperEll"/>
<!-- This check makes sure that all package annotations are in the package-info.java file. -->
<module name="PackageAnnotation"/>
<!-- Checks that if a class defines a covariant method equals, then it defines method equals(java.lang.Object). -->
<module name="CovariantEquals"/>
<!-- Checks the style of array type definitions. -->
<module name="ArrayTypeStyle"/>
<!-- Make sure left curly braces are on the same line. -->
<module name="LeftCurly"/>

<module name="RightCurly"/>
<module name="RightCurly">
<property name="option" value="alone"/>
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
</module>
<!-- Checks that there is no whitespace after certain tokens; e.g. "." and "!". -->
<module name="NoWhitespaceAfter"/>
<!-- Checks that there is no whitespace before certain tokens; e.g. "++" and ";". -->
<module name="NoWhitespaceBefore"/>
<!-- Checks that most tokens are surrounded by whitespace. RCURLY is omitted so we can do stuff like "new Thread(){...}.start()". -->
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
</module>
<module name="WhitespaceAfter">
<property name="tokens" value="COMMA"/>
</module>
<module name="ParenPad">
<property name="option" value="nospace"/>
</module>
<!-- Ensure there is no space between the identifier of a method definition, constructor definition, method call, or constructor invocation and the left parenthesis of the parameter list. -->
<module name="MethodParamPad"/>
<!-- Ensure proper indentation. -->
<module name="Indentation">
<property name="basicOffset" value="3"/>
<property name="caseIndent" value="3"/>
<property name="throwsIndent" value="3"/>
<property name="arrayInitIndent" value="3"/>
<property name="lineWrappingIndentation" value="3"/>
</module>

<module name="IllegalImport">
<property name="illegalPkgs" value="junit.framework"/>
</module>

<module name="WriteTag">
<property name="tag" value="@author"/>
<property name="tagSeverity" value="error"/>
<property name="severity" value="ignore"/>
</module>

<module name="UnnecessarySemicolonInTryWithResources"/>

<!-- begin Sevntu checks, http://sevntu-checkstyle.github.io/sevntu.checkstyle/ -->
<module name="DiamondOperatorForVariableDefinition"/>
<module name="RequiredParameterForAnnotation">
<property name="annotationName" value="Parameterized.Parameters"/>
<property name="requiredParameters" value="name"/>
</module>
<!-- end Sevntu checks -->
</module>
</module>
29 changes: 29 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@
<module>artemis-console-extension</module>
<module>artemis-console-war</module>
<module>artemis-console-distribution</module>
<module>artemis-console-cache-key-provider</module>
</modules>

<name>ActiveMQ Artemis Console Project</name>
<url>https://activemq.apache.org/components/artemis/</url>

<properties>
<activemq.basedir>${project.basedir}</activemq.basedir>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<activemq.artemis.version>2.41.0</activemq.artemis.version>
<jolokia.version>2.2.9</jolokia.version>
<hawtio.version>4.4.1</hawtio.version>
<jakarta.servlet-api.version>5.0.0</jakarta.servlet-api.version>
<slf4j.version>2.0.17</slf4j.version>
Expand All @@ -53,6 +57,8 @@
<yarn-version>v1.22.22</yarn-version>
<frontend-maven-plugin-version>1.15.1</frontend-maven-plugin-version>
<project.build.outputTimestamp>2025-06-25T05:17:39Z</project.build.outputTimestamp>
<sevntu.checks.version>1.44.1</sevntu.checks.version>
<checkstyle.version>10.26.1</checkstyle.version>
</properties>

<scm>
Expand Down Expand Up @@ -228,6 +234,29 @@
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.github.sevntu-checkstyle</groupId>
<artifactId>sevntu-checks</artifactId>
<version>${sevntu.checks.version}</version>
</dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<configuration>
<configLocation>${activemq.basedir}/etc/checkstyle.xml</configLocation>
<failsOnError>false</failsOnError>
<failOnViolation>true</failOnViolation>
<consoleOutput>true</consoleOutput>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down