[Akka/Java] Scala exception when updating maven dependencies

350 views
Skip to first unread message

Mark McShane

unread,
Apr 3, 2017, 2:33:45 PM4/3/17
to Akka User List
I'm working on a project making use of various Akka modules in Java (akka-actor, akka-remote etc.). These modules were loaded in as dependencies through maven, each version being around Akka 2.10:3.9. I left the dependencies at these versions as I figured "If it ain't broke then don't fix it", and things are working as expected.

I wanted to test some features from akka-cluster-metrics, but I'm have problems when I include the dependency in my pom.xml. I suspect the issue is some sort of problem with scala major versions. I'm hoping that perhaps someone could give me some advice on how to fix my problem.

I'm getting the same exception (listed a bit below) regardless of the versions of each dependency. The format for the jars (see https://mvnrepository.com/) seems to be akka-<whatever>_2.<scala version>:<update number>. At first I thought if I updated the old akka 2.10 jars to being akka 2.12, the problem would be resolved, but I still get the exception.

The exception occurs consistently at the first place akka/scala is used in my application, this works fine prior to meddling with dependencies.
final ActorSystem system = ActorSystem.create("QuadraticSystem",
        ConfigFactory.parseString("akka.remote.netty.tcp {" +
                "\nhostname =\"" + analysisInfo[0] + "\"" +
                "\nport=" + analysisInfo[1] +
                "\n}").
                withFallback(ConfigFactory.load("application.conf")));

A cleaned up form of the exception:
Exception in thread "main" java.lang.VerifyError: Uninitialized object exists on backward branch 209
Exception Details:
  Location:
    scala/collection/immutable/HashMap$HashTrieMap.split()Lscala/collection/immutable/Seq; @249: goto
  Reason:
    Error exists in the bytecode
  Bytecode:
    0x0000000: 2ab6 0057 04a0 001e b200 afb2 00b4 04bd
    0x0000010: 0002 5903 2a53 c000 b6b6 00ba b600 bec0
...<lots of bytecode>
Stackmap Table:
same_frame(@35)
full_frame(@141,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#105]},{})
append_frame(@151,Object[#125],Object[#125])
at scala.collection.immutable.HashMap$.scala$collection$immutable$HashMap$$makeHashTrieMap(HashMap.scala:179)
at scala.collection.immutable.HashMap$HashMap1.updated0(HashMap.scala:211)
...<higher up chain>
at akka.actor.ActorSystem$Settings.<init>(ActorSystem.scala:328)
at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:683)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:245)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:288)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:263)
at akka.actor.ActorSystem$.create(ActorSystem.scala:191)
at akka.actor.ActorSystem.create(ActorSystem.scala)
at uk.ac.qub.ccrcb.bioinf.ssc.CMDLauncher.main(CMDLauncher.java:38) <the above code segment>

For the record, my existing (working) pom.xml contains the following relevant dependencies:
akka-actor, akka-remote (both 2.10_2.3.9), typesafe config 1.2.1, scala-library 2.10.4.

When I tried to update each dependency to 2.12, each is at:
akka-actor, akka-remote, akka-cluster-metrics (all at 2.12_2.4.17), typesafe config 1.3.1, scala-library 2.12.1.

The earliest jar I can get cluster-metrics for is 2.11 (major version of scala still incompatible, afaik). Any configuration of versions I have tried result in this same exception. For reference, 
I'm using a Macbook Pro running macOs Sierra 10.12.3. My java version is the 'latest' I could get from the oracle site (although I'm confused as there seems to be inconsistency between the versions of java listed, I can only find one jdk myself).



Patrik Nordwall

unread,
Apr 4, 2017, 1:08:59 AM4/4/17
to Akka User List
You must use the same version for all Akka artifacts, e.g. 2.12_2.4.17 for everything. Cluster-metrics exists for that version.

Akka 2.4.x is released for Scala 2.11 and 2.12 but you have to pick one and don't mix.

/Patrik
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Mark McShane

unread,
Apr 4, 2017, 4:52:04 AM4/4/17
to Akka User List
I have tried that and it doesn't work, still getting the exception. 
Thanks for the reply though, here's how I edited the pom.xml:

Mark McShane

unread,
Apr 8, 2017, 2:41:05 PM4/8/17
to Akka User List
I managed to solve the issue by using the Scala 2.11 versions of each library as so:
<!-- typesafe -->
<dependency>
    <groupId>com.typesafe.akka</groupId>
    <artifactId>akka-actor_2.11</artifactId>
    <version>2.4.17</version>
</dependency>

<dependency>
    <groupId>com.typesafe.akka</groupId>
    <artifactId>akka-remote_2.11</artifactId>
    <version>2.4.17</version>
</dependency>

<dependency>
    <groupId>com.typesafe.akka</groupId>
    <artifactId>akka-cluster-metrics_2.11</artifactId>
    <version>2.4.17</version>
</dependency>


<dependency>
    <groupId>com.typesafe</groupId>
    <artifactId>config</artifactId>
    <version>1.3.1</version>
</dependency>

<dependency>
    <groupId>org.scala-lang</groupId>
    <artifactId>scala-library</artifactId>
    <version>2.11.1</version>
</dependency>
<!-- end of typesafe -->

Reply all
Reply to author
Forward
0 new messages