JMX for Compute Engine

Hello,
Sonarqube 8.2.0.32929 Enterprise Edition
I’m trying to enable remote JMX monitoring for CE. I added following lines to sonar.properties:

sonar.ce.javaAdditionalOpts=-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=3332 Dcom.sun.management.jmxremote.rmi.port=3333 -Dcom.sun.management.jmxremote.password.file=/app/sonarqube-8.2.0.32929/conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=/app/sonarqube-8.2.0.32929/conf/jmxremote.access

While running jconsole i receive:
The connection did not succeed.
I can see the open port on server with netstat. When i try to add item to zabbix (processing time), it gives me info:
attempt to add a Permission to a readonly Permissions object.
I’ve also tried changing sonar.ce.javaAdditionalOpts to sonar.ce.javaOpts, nothing changed.
When I do same for webserver, it works good.
My java on server:
OpenJDK 11.0.6+10-LTS

2 Likes

Hello,

Same error here trying to query MBeans locally with JMXTerm.
Version of SonarQube is 8.3.1.34397 Enterprise Edition.

Regards,

Benoît

I was able to reproduce the problem.
I suspect that the Security Manager in the CE is interfering with the JMX server.

Using jconsole -debug I get the following exception:

java.lang.SecurityException: attempt to add a Permission to a readonly Permissions 
objectjava.lang.SecurityException: attempt to add a Permission to a readonly Permissions object at 
java.base/java.security.Permissions.add(Permissions.java:128) at 
java.base/java.security.Policy$UnsupportedEmptyCollection.add(Policy.java:843) at 
java.rmi/sun.rmi.server.LoaderHandler.getLoaderAccessControlContext(LoaderHandler.java:1005) at 
java.rmi/sun.rmi.server.LoaderHandler.lookupLoader(LoaderHandler.java:881) at 
java.rmi/sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:404) at 
java.rmi/sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:186) at 
java.rmi/java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:637) at 
java.rmi/java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:264) at 
java.rmi/sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:213) at 
java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1886) at 
java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1772) at 
java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2060) at 
java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1594) at 
java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:430) at 
java.rmi/sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:322) at 
java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:339) at
 java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) at 
java.base/java.security.AccessController.doPrivileged(Native Method) at 
java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at 
java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) at 
java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) at 
java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:67
7) at java.base/java.security.AccessController.doPrivileged(Native Method) at 
java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at 
java.base/java.lang.Thread.run(Thread.java:834) at 
java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:
283) at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260) at 
java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161) at 
jdk.remoteref/jdk.jmx.remote.internal.rmi.PRef.invoke(Unknown Source) at 
java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl_Stub.isRegistered(Unknown Source) at 
java.management.rmi/javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.isRegistered(RMIConnector.java:865) at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at 
jdk.jconsole/sun.tools.jconsole.ProxyClient$SnapshotInvocationHandler.invoke(ProxyClient.java:992) at jdk.proxy1/com.sun.proxy.jdk.proxy1.$Proxy0.isRegistered(Unknown Source) at 
jdk.jconsole/sun.tools.jconsole.ProxyClient.tryConnect(ProxyClient.java:380) at 
jdk.jconsole/sun.tools.jconsole.ProxyClient.connect(ProxyClient.java:313) at 
jdk.jconsole/sun.tools.jconsole.VMPanel$2.run(VMPanel.java:296) 

This will require a deeper investigation. I created a ticket: https://jira.sonarsource.com/browse/SONAR-13559

2 Likes

Hi Duarte,

Do you have news about the ticket ?

Regards,

Benoît

Hi Benoit,

Feel free to vote for and watch the issue. Then Jira will automatically notify you when there’s movement.

 
:smiley:
Ann

Hi Ann,
Sure I will do this :wink:
Regards,
Benoît

Any updates on this ticket?

Hi @murat,

The ticket in question is Closed/Fixed.

You’ve resurrected a 4-year-old thread. Per the FAQ, please don’t do that. I’m going to close this now.

 
Ann