[Java] Not receiving any statistics when I've upgrade to Java 17 version for Scala application

We have a scala application that used to run on java 8 and new relic statistics were working flawlessly. But when we have upgraded to java 17 version application did not work. The application is terminating with Java 17 App server immediately after starting with below error. To avoid that, I have set lite_mode as true in newrelic configuration, but this change will not record the transactions.

Exception in thread “main” java.lang.IllegalAccessError: Update to non-static final field akka.http.scaladsl.server.Directives$.DoubleNumber attempted from a different method (akka$http$scaladsl$server$PathMatchers$setter$DoubleNumber_$eq) than the initializer method
at akka.http.scaladsl.server.Directives$.akka$http$scaladsl$server$PathMatchers$setter$DoubleNumber_$eq(Directives.scala:41)
at akka.http.scaladsl.server.PathMatchers.$init$(PathMatcher.scala:474)
at akka.http.scaladsl.server.Directives$.(Directives.scala:41)
at akka.http.scaladsl.server.Directives$.(Directives.scala)
at com.yupptv.rivulet.app.server.path.BasePathRouter$.(BasePathRouter.scala:30)
at com.yupptv.rivulet.app.server.path.BasePathRouter$.(BasePathRouter.scala)
at com.yupptv.rivulet.app.server.main.Bootstrapper$.(Bootstrapper.scala:49)
at com.yupptv.rivulet.app.server.main.Bootstrapper$.(Bootstrapper.scala)
at com.yupptv.rivulet.app.server.main.Main$.main(Main.scala:14)
at com.yupptv.rivulet.app.server.main.Main.main(Main.scala)

Highly appreciated, if some one explain how to run new relic with java 17 scala application with recording of api transactions.

Hello @user708 ,

Can you let me know the New Relic Java Agent version you are using?

Are you using Scala 2.12?
There is a bug that affects Scala 12 with Java versions higher than 8.
It is due to the way that final variables in traits are created and used.
Scala 2.13 should not be affected.

We are working on a fix. It will likely be in agent 7.9.0.

1 Like

Hi @aonuki , Any update on this? We have tried out with agent 7.9.0 and the problem persists. When are you planning to fix this?

The fix missed the 7.9.0 release by a few days.
The code has already been incorporated in our main code base and will be in the 7.10.0 release.

Hi @aonuki,

Any time frame when we can expect 7.10.0 would be released?

Mid to late September.

Hi @aonuki,
New relic compatibility with Scala 12, java17 still issue persist in Java agent v7.10.0

Can you help here?

Is it the same error?
This is the PR that should have fixed this error:

Hi @aonuki ,

I was also waiting for 7.10.0 but still we have a similar error on our Akka Stream application:

Exception in thread "main" java.lang.IllegalAccessError: Update to non-static final field scala.concurrent.impl.Promise$Transformation.cnmFuture attempted from a different method (cnmFutureCallbackAdded) than the initializer method <init> 
      at scala.concurrent.impl.Promise$Transformation.cnmFutureCallbackAdded(Promise.scala:120)
      at scala.concurrent.impl.Promise$DefaultPromise.dispatchOrAddCallbacks(Promise.scala:60)
      at scala.concurrent.impl.Promise$DefaultPromise.onComplete(Promise.scala:216)
      at akka.actor.ActorSystemImpl$TerminationCallbacks.<init>(ActorSystem.scala:1271)
      at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:970)
      at akka.actor.ActorSystem$.apply(ActorSystem.scala:272)
      at akka.actor.ActorSystem$.apply(ActorSystem.scala:316)
      at akka.actor.ActorSystem$.apply(ActorSystem.scala:290)

Scala 2.13.9, New Relic 7.10.0, Java 11

btw, no issue with NewRelic 6.5.3. somehow latest versions fails.

Hi @aonuki,

When we use java 17 and scala 2.12 with newrelic java agent version: 7.9.0, 7.10.0 the newrelic initiated log is not printing in our scala application logs. Also newrelic log file newrelic_agent.log is not being created in the path: newrelic/logs.

Hence, I am unable to trouble shoot why newrelic agent is not being initiated.

Anyways, if we use java8, scala 2.12 with newrelic java agent version: 7.9.0 the newrelic is initiated and log file newrelic_agent.log is generated.

Please help us here what needs to be done from our side.

This look like a small variation on the bug we fixed recently. We need to investigate this.

Does your application logs show a few lines about the agent?
Usually the first handful of lines is the agent telling that it is starting and where it will log to.

@aonuki ,

To make things more complex in our application logs, we can not see even single line of agent logs. Please suggest any other ways how to troble shoot this problem.

Looks like your problem is different from the original one in this thread.
Do you mind opening another thread so we don’t pollute this one?