[ 
https://issues.apache.org/jira/browse/AMQ-9430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17836175#comment-17836175
 ] 

Matt Pavlovich commented on AMQ-9430:
-------------------------------------

I'm able to reproduce with JDK 11 and JDK 17. I believe the issue is 
classloader related as it only impacts when the JMX operation is invoked.

Manual update (via JMX) has error:
{noformat}
 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:62)
 ~[?:?]
        at 
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) ~[?:?]
        at jdk.internal.reflect.GeneratedMethodAccessor40.invoke(Unknown 
Source) ~[?:?]
        at 
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:260) ~[?:?]
        at 
com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
 ~[?:?]
        at 
com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
 ~[?:?]
        at 
com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237) 
~[?:?]
        at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138) 
~[?:?]
        at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252) 
~[?:?]
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
 ~[?:?]
        at 
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) ~[?:?]
        at 
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
 ~[?:?]
        at 
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
 ~[?:?]
        at 
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)
 ~[?:?]
        at 
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827)
 ~[?:?]
        at jdk.internal.reflect.GeneratedMethodAccessor49.invoke(Unknown 
Source) ~[?:?]
        at 
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) 
~[?:?]
        at sun.rmi.transport.Transport$1.run(Transport.java:200) ~[?:?]
        at sun.rmi.transport.Transport$1.run(Transport.java:197) ~[?:?]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
        at sun.rmi.transport.Transport.serviceCall(Transport.java:196) ~[?:?]
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) ~[?:?]
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
 ~[?:?]
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
 ~[?:?]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) 
[?:?]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
[?:?]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
[?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.ClassNotFoundException: 
com.sun.xml.internal.bind.v2.ContextFactory
        at 
jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) 
~[?:?]
        at 
jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
 ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
        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: Thu Apr 11 08:21:15 CDT 2024
{noformat}

Polling change works fine:
{noformat}
 INFO | change in class path resource [activemq.xml] at: Thu Apr 11 08:24:06 
CDT 2024
 INFO | changes to DestinationPolicy
 INFO | added policy for: queue://>
 INFO | No material change to configuration in class path resource 
[activemq.xml] at: Thu Apr 11 08:24:10 CDT 2024
{noformat}

> 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: 5.18.5
>
>
> 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)

Reply via email to