Sonarqube 9.9 loading always

Oh, and what was the NR version you were using until now? :slight_smile:

8.2.0 (latest)

1 Like

Hi @ganncamp Can you share the feature request that was raised at NR side?

Hi, this is the response I got from our NR team similar to what @ganncamp had mentioned yesterday.

This appears to be an instrumentation issue. It looks like the path to the newrelic.jar using -javaagent is not passed at the correct place and hence you’re observing this problem. I think the developers of the application would be able to provide the right place to add -javaagent flag. We might not be able to comment on the correct place since we have never tested our agent with SonarQube. I had a discussion about SonarQube with the product engineers earlier as well and they said that it’s not one of the supported technology with the Java agent so it’s difficult for us to suggest anything. But from the looks of the error, it seems the file where you’ve added the -javaagent flag is not acceptable by SonarQube. That said, I would be happy to create a feature request on your behalf for our product managers to consider adding the support of it in future releases.

Hi,

Sorry, I don’t have access to that.

 
Ann

1 Like

I find their response confusing. We have always used the well-documented SONAR_WEB_JAVAADDITIONALOPTS environment var to pass -javaagent:/opt/newrelic/newrelic.jar and it has not been an issue until Sonarqube version 9.8. NewRelic is being used for front-facing APM metrics, so the web server is the right place for integration.
My guess is still that the recent Sonarqube switch to Java 17 might have something to do with this but I cannot say for sure. Sonarqube should look into this as well as it may affect many customers.
We can look into other APMs like Open Telemetry in the mean time but thats extra work, does not guarantee a fix, and would force us to use a different observability platform to manage Sonarqube from our other tools.

also to note, I tested leaving -javaagent:/opt/newrelic/newrelic.jar in place and disabling the agent via NR configuration agent_enabled: false. Sonarqube then launched and was functioning successfully and the logs showed:

2023-05-16T18:00:14,301+0000 [142 1] com.newrelic INFO: New Relic Agent: Loading configuration file "/opt/newrelic/./newrelic.yml"
2023-05-16T18:00:14,364+0000 [142 1] com.newrelic INFO: Using default collector host: collector.newrelic.com
2023-05-16T18:00:14,364+0000 [142 1] com.newrelic INFO: Using default metric ingest URI: https://metric-api.newrelic.com/metric/v1
2023-05-16T18:00:14,364+0000 [142 1] com.newrelic INFO: Using default event ingest URI: https://insights-collector.newrelic.com/v1/accounts/events
2023-05-16T18:00:14,403+0000 [142 1] com.newrelic WARN: agent_enabled is false in the config. Not starting New Relic Agent.

So this shows newrelic.jar is included during startup and configuration in parsed successfully by the application. It is enabling of the agent that is causing problems

Hi @edlevin6612 This implementation (keeping agent_enabled: false) also worked for me. But it’s surprising that the newrelic.jar is NOT depending on this thing (agent_enabled: false) and starting up normally.
BUT, I see the logs throwing errors, and I’m wondering how this got started up…

2023-05-17T05:30:59,343+0000 [14854 38] com.newrelic INFO: New Relic JFR Monitor is disabled: JFR config has not been enabled in the Java agent.
2023-05-17T05:31:06,633+0000 [16322 1] com.newrelic INFO: Writing to New Relic log file: /opt/newrelic/sonarqube/logs/newrelic_agent.log
2023-05-17T05:31:06,633+0000 [16322 1] com.newrelic INFO: JRE vendor Eclipse Adoptium version 17.0.7
2023-05-17T05:31:06,634+0000 [16322 1] com.newrelic INFO: JVM vendor Eclipse Adoptium OpenJDK 64-Bit Server VM version 17.0.7+7
2023-05-17T05:31:06,634+0000 [16322 1] com.newrelic INFO: OS Linux version 5.4.0-1101-aws arch amd64
2023-05-17T05:31:06,634+0000 [16322 1] com.newrelic INFO: Agent Host: ip-172-16-137-158.eu-central-1.compute.internal IP: 172.16.137.158
2023-05-17T05:31:06,634+0000 [16322 1] com.newrelic INFO: New Relic Agent v7.7.0 is initializing...
2023-05-17T05:31:07,666+0000 [16322 16] com.newrelic INFO: Instrumentation com.newrelic.instrumentation.jdbc-resultset is disabled. Skipping.
2023-05-17T05:31:09,858+0000 [16322 1] com.newrelic.agent.RPMServiceManagerImpl INFO: Configured to connect to New Relic at collector.newrelic.com:443
2023-05-17T05:31:10,623+0000 [16322 1] com.newrelic INFO: Setting audit_mode to false
2023-05-17T05:31:10,980+0000 [16322 1] com.newrelic.agent.config.ConfigServiceImpl INFO: Configuration file is /opt/newrelic/sonarqube/./newrelic.yml
2023-05-17T05:31:10,981+0000 [16322 1] com.newrelic.agent.config.ConfigServiceImpl INFO: Distributed tracing is replacing cross application tracing as the default means of tracing betweenservices. To continue using cross application tracing, enable it with cross_application_tracer.enabled=true and distributed_tracing.enabled=false.
2023-05-17T05:31:10,993+0000 [16322 1] com.newrelic INFO: New Relic Agent v7.7.0 has started
2023-05-17T05:31:10,995+0000 [16322 1] com.newrelic INFO: Agent class loader: com.newrelic.bootstrap.BootstrapAgent$JVMAgentClassLoader@1b4fb997
2023-05-17T05:31:10,997+0000 [16322 1] com.newrelic INFO: Premain startup complete in 5,505ms
2023-05-17T05:31:22,851+0000 [16322 14] com.newrelic.agent.core.CoreServiceImpl INFO: JVM is shutting down
2023-05-17T05:31:22,858+0000 [16322 14] com.newrelic.agent.core.CoreServiceImpl INFO: New Relic Agent has shutdown
2023-05-17T05:31:23,483+0000 [14854 14] com.newrelic.agent.core.CoreServiceImpl INFO: JVM is shutting down
2023-05-17T05:31:23,733+0000 [14854 14] com.newrelic.agent.core.CoreServiceImpl INFO: New Relic Agent has shutdown
2023-05-17T05:31:24,123+0000 [14166 13] com.newrelic.agent.core.CoreServiceImpl INFO: JVM is shutting down
2023-05-17T05:31:24,137+0000 [14166 13] com.newrelic ERROR: Error shutting down New Relic Agent
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:485) ~[?:?]
        at java.security.AccessController.checkPermission(AccessController.java:1068) ~[?:?]
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:416) ~[?:?]
        at java.lang.ClassLoader.checkClassLoaderPermission(ClassLoader.java:2055) ~[?:?]
        at java.lang.Class.getClassLoader(Class.java:901) ~[?:?]
        at org.elasticsearch.secure_sm.SecureSM.isInnocuousThread(SecureSM.java:159) ~[?:?]
        at org.elasticsearch.secure_sm.SecureSM.checkThreadAccess(SecureSM.java:165) ~[?:?]
        at org.elasticsearch.secure_sm.SecureSM.checkAccess(SecureSM.java:120) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.checkShutdownAccess(ThreadPoolExecutor.java:758) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.shutdown(ThreadPoolExecutor.java:1383) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor.shutdown(ScheduledThreadPoolExecutor.java:842) ~[?:?]
        at java.util.concurrent.Executors$DelegatedExecutorService.shutdown(Executors.java:724) ~[?:?]
        at com.newrelic.agent.instrumentation.ClassTransformerServiceImpl.doStop(ClassTransformerServiceImpl.java:236) ~[newrelic.jar:7.7.0]
        at com.newrelic.agent.service.AbstractService.stop(AbstractService.java:74) ~[newrelic.jar:7.7.0]
        at com.newrelic.agent.service.ServiceManagerImpl.doStop(ServiceManagerImpl.java:347) ~[newrelic.jar:7.7.0]
        at com.newrelic.agent.service.AbstractService.stop(AbstractService.java:74) ~[newrelic.jar:7.7.0]
        at com.newrelic.agent.core.CoreServiceImpl.shutdown(CoreServiceImpl.java:147) [newrelic.jar:7.7.0]
        at com.newrelic.agent.core.CoreServiceImpl.jvmShutdown(CoreServiceImpl.java:141) [newrelic.jar:7.7.0]
        at com.newrelic.agent.core.CoreServiceImpl.access$000(CoreServiceImpl.java:31) [newrelic.jar:7.7.0]
        at com.newrelic.agent.core.CoreServiceImpl$1.run(CoreServiceImpl.java:69) [newrelic.jar:7.7.0]
        at java.lang.Thread.run(Thread.java:833) [?:?]

@edlevin6612 Did you observe anything being reported at the NR UI side?