[
https://issues.apache.org/jira/browse/AMQ-9430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17822962#comment-17822962
]
Jean-Baptiste Onofré commented on AMQ-9430:
-------------------------------------------
I just tried the RuntimeConfigurationPlugin with ActiveMQ 5.18.4-SNAPSHOT and
JDK 21, and it works fine:
{code:java}
INFO: Using java
'/usr/local/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home/bin/java'
INFO: Starting in foreground, this is just for debugging purposes (stop process
by pressing CTRL+C)
INFO: Creating pidfile
/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT//data/activemq.pid
Java Runtime: Homebrew 21.0.2
/usr/local/Cellar/openjdk/21.0.2/libexec/openjdk.jdk/Contents/Home
Heap sizes: current=264192k free=261352k max=4194304k
...
[/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT/lib,/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT/lib/camel,/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT/lib/optional,/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT/lib/web,/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT/lib/extra]
ACTIVEMQ_HOME:
/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT
ACTIVEMQ_BASE:
/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT
ACTIVEMQ_CONF:
/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT/conf
ACTIVEMQ_DATA:
/Users/jbonofre/Workspace/activemq/assembly/target/apache-activemq-5.18.4-SNAPSHOT/data
Loading message broker from: xbean:activemq.xml
...
INFO | Apache ActiveMQ 5.18.4-SNAPSHOT (localhost,
ID:MacBookPro.local-61459-1709483912981-0:1) started
INFO | For help or more information please see: http://activemq.apache.org
{code}
Here's my {{activemq.xml}} configuration:
{code:java}
...
<broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" dataDirectory="${activemq.data}" start="false">
...
<plugins>
<runtimeConfigurationPlugin checkPeriod="1000"/>
</plugins>
...{code}
> ActiveMQ 5.18.3 (Classic) and Java 17: runtimeConfigurationPlugin causes
> ClassNotFoundException
> -----------------------------------------------------------------------------------------------
>
> Key: AMQ-9430
> URL: https://issues.apache.org/jira/browse/AMQ-9430
> Project: ActiveMQ Classic
> Issue Type: Bug
> Components: Broker, JMX, Plugin
> Affects Versions: 5.18.3
> Environment: Linux myhost 6.5.0-14-generic #14~22.04.1-Ubuntu SMP
> PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
>
> java -version
>
>
> openjdk version "17.0.9" 2023-10-17
> OpenJDK Runtime Environment (build 17.0.9+9-Ubuntu-122.04)
> OpenJDK 64-Bit Server VM (build 17.0.9+9-Ubuntu-122.04, mixed mode, sharing)
> Reporter: Mika Räty
> Assignee: Jean-Baptiste Onofré
> Priority: Major
> Fix For: 6.1.0, 5.18.4, 6.0.2
>
>
> We are upgrading from java 8 to java 17 in a project that uses ActiveMQ
> 5.18.3 and we noticed that when we try to use the JMX operation updateNow
> that is available from Bean
>
> org.apache.activemq:type=Broker,brokerName=localhost,service=RuntimeConfiguration,name=Plugin
>
> using java 17 based deployment we get the following error on jconsole screen
>
> Failed to parse: class path resource [activemq.xml],
> javax.xml.bind.JAXBException
> - with linked exception:
> [java.lang.ClassNotFoundException:
> com.sun.xml.internal.bind.v2.ContextFactory];No material change to
> configuration in class path resource [activemq.xml] at: Tue Jan 30 13:09:40
> EET 2024;
>
> On the activemq output we see the following stack trace
>
> INFO | Manual configuration update triggered
> INFO | Failed to parse: class path resource [activemq.xml]
> javax.xml.bind.JAXBException: null
> at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:241)
> ~[jaxb-api-2.2.11.jar:?]
> at javax.xml.bind.ContextFinder.find(ContextFinder.java:477)
> ~[jaxb-api-2.2.11.jar:?]
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:656)
> ~[jaxb-api-2.2.11.jar:?]
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:599)
> ~[jaxb-api-2.2.11.jar:?]
> at
> org.apache.activemq.plugin.RuntimeConfigurationBroker.loadConfiguration(RuntimeConfigurationBroker.java:176)
> ~[activemq-runtime-config-5.18.3.jar:5.18.3]
> at
> org.apache.activemq.plugin.RuntimeConfigurationBroker.applyModifications(RuntimeConfigurationBroker.java:141)
> ~[activemq-runtime-config-5.18.3.jar:5.18.3]
> at
> org.apache.activemq.plugin.RuntimeConfigurationBroker.updateNow(RuntimeConfigurationBroker.java:113)
> ~[activemq-runtime-config-5.18.3.jar:5.18.3]
> at
> org.apache.activemq.plugin.jmx.RuntimeConfigurationView.updateNow(RuntimeConfigurationView.java:53)
> ~[activemq-runtime-config-5.18.3.jar:5.18.3]
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method) ~[?:?]
> at
> jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
> ~[?:?]
> ... [ some frames omitted for brevity ]
>
> Caused by: java.lang.ClassNotFoundException:
> com.sun.xml.internal.bind.v2.ContextFactory
> at
> jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
> ~[?:?]
> at
> jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
> ~[?:?]
> at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
> at javax.xml.bind.ContextFinder.safeLoadClass(ContextFinder.java:594)
> ~[jaxb-api-2.2.11.jar:?]
> at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:239)
> ~[jaxb-api-2.2.11.jar:?]
> ... 43 more
> INFO | No material change to configuration in class path resource
> [activemq.xml] at: Tue Jan 30 12:59:42 EET 2024
>
> Java version info
> java -version
> openjdk version "17.0.9" 2023-10-17
> OpenJDK Runtime Environment (build 17.0.9+9-Ubuntu-122.04)
> OpenJDK 64-Bit Server VM (build 17.0.9+9-Ubuntu-122.04, mixed mode, sharing)
>
>
> Reproducing the above error:
>
> # extract amq package to linux host
> tar xvf apache-activemq-5.18.3-bin.tar
> # Add plugin to activemq.xml
> <plugins>
> <runtimeConfigurationPlugin checkPeriod="0"/>
> </plugins>
> # Add start="false" to broker tag
> according to instructions from here
> [https://activemq.apache.org/runtime-configuration]
> # Starting activemq with
> activemq start
> # Connect to the started amq instance with jconsole and call the updateNow
> operation
>
>
> Observations
>
> If we don't add the start attribute with value false the class not found
> error is not shown but the configuration reload operation doesn't happen at
> all and this is the output
> No material change to configuration in null at: Thu Jan 01 01:59:59 EET 1970;
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)