In brief: Is there a way of configuring all Ports used by management-agent.jar
(introduced in SonarQube 5.5) or even disabling it?
More Info: I'm trying to run SonarQube on OpenShift (again), this time version 5.5/5.6.
On startup I get the following error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 0; nested exception is: java.net.BindException: Permission denied
.
What I found out so far is that
- the agent opens three ports,
- where two can be configured (System properties
com.sun.management.jmxremote.port
andcom.sun.management.jmxremote.rmi.port
) - but one of them is by design always the ephemeral port (port 0), which doesn't seem to work on OpenShift.
In addition to setting the ports explicitly to the allowed range on OpenShift (ports 15000-35530), I tried the -XX:+DisableAttachMechanism
option with no luck.
Any ideas how to work around that? Can SonarQube work without the agent?
How to reproduce:
Create an OpenShift app from this, then change the SONAR_VERSION
to 5.5
or 5.6
in .openshift/action_hooks/build
Full Stacktrace
2016.06.02 16:09:34 INFO app[o.s.p.m.JavaProcessLauncher] Launch process[es]: java -Djava.awt.headless=true -javaagent:jre/lib/management-agent.jar -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 0; nested exception is:
java.net.BindException: Permission denied
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:384)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:397)
Caused by: java.lang.RuntimeException: Exception thrown by the agent
at sun.management.Agent.error(Agent.java:520)
at sun.management.Agent.error(Agent.java:511)
at sun.management.Agent.startAgent(Agent.java:268)
at sun.management.Agent.agentmain(Agent.java:134)
at sun.management.Agent.premain(Agent.java:116)
... 6 more