Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-9430

ActiveMQ 5.18.3 (Classic) and Java 17: runtimeConfigurationPlugin causes ClassNotFoundException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.18.3
    • 5.18.5, 6.1.2
    • Broker, JMX, Plugin
    • None

    Description

      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:

       

      1. extract amq package to linux host

      tar xvf apache-activemq-5.18.3-bin.tar

      1. Add plugin to activemq.xml

      <plugins>

        <runtimeConfigurationPlugin checkPeriod="0"/>

      </plugins>

      1. Add start="false" to broker tag

      according to instructions from here https://activemq.apache.org/runtime-configuration

      1. Starting activemq with

      activemq start

      1. 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;

       

      Attachments

        Activity

          People

            jbonofre Jean-Baptiste Onofré
            mika_raty Mika Räty
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h