Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.ClassNotFoundException: scala.Int when using akka 2.5.6 with sbt version 1.0.2

I am trying to use akka -remoting version 2.5.4 with latest sbt 1.0.2

When I use sbt version 0.13.15 or 0.13.16 it is working very well.

But when I'm using sbt verion 1.0.2 as here, I'm getting below error.

The Below exception is runtime exception.

[error] (run-main-0) java.lang.ClassNotFoundException: scala.Int
[error] java.lang.ClassNotFoundException: scala.Int
[error]     at sbt.internal.inc.classpath.ClasspathFilter.loadClass(ClassLoaders.scala:74)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]     at java.lang.Class.forName0(Native Method)
[error]     at java.lang.Class.forName(Class.java:348)
[error]     at akka.actor.ReflectiveDynamicAccess.$anonfun$getClassFor$1(ReflectiveDynamicAccess.scala:21)
[error]     at scala.util.Try$.apply(Try.scala:209)
[error]     at akka.actor.ReflectiveDynamicAccess.getClassFor(ReflectiveDynamicAccess.scala:20)
[error]     at akka.serialization.Serialization.$anonfun$bindings$3(Serialization.scala:313)
[error]     at scala.collection.TraversableLike$WithFilter.$anonfun$map$2(TraversableLike.scala:739)
[error]     at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:231)
[error]     at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:462)
[error]     at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:738)
[error]     at akka.serialization.Serialization.<init>(Serialization.scala:311)
[error]     at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:15)
[error]     at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:12)
[error]     at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:880)
[error]     at akka.actor.ExtensionId.apply(Extension.scala:77)
[error]     at akka.actor.ExtensionId.apply$(Extension.scala:77)
[error]     at akka.serialization.SerializationExtension$.apply(SerializationExtension.scala:12)
[error]     at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:203)
[error]     at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:796)
[error]     at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:793)
[error]     at akka.actor.ActorSystemImpl._start(ActorSystem.scala:793)
[error]     at akka.actor.ActorSystemImpl.start(ActorSystem.scala:809)
[error]     at akka.actor.ActorSystem$.apply(ActorSystem.scala:244)
[error]     at akka.actor.ActorSystem$.apply(ActorSystem.scala:287)
[error]     at akka.actor.ActorSystem$.apply(ActorSystem.scala:262)
[error]     at module09.remoteB.RemoteBStartup$.main(RemoteBStartup.scala:8)
[error]     at module09.remoteB.RemoteBStartup.main(RemoteBStartup.scala)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:498)
[error]     at sbt.Run.invokeMain(Run.scala:89)
[error]     at sbt.Run.run0(Run.scala:83)
[error]     at sbt.Run.execute$1(Run.scala:61)
[error]     at sbt.Run.$anonfun$run$4(Run.scala:73)
[error]     at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error]     at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
[error]     at sbt.TrapExit$App.run(TrapExit.scala:252)
[error]     at java.lang.Thread.run(Thread.java:748)

The github location is here

To me, this looks like the error is because of ConfigFactory.load as in here is having some issues due to sbt latest version.

like image 787
Rajkumar Natarajan Avatar asked Oct 27 '17 20:10

Rajkumar Natarajan


2 Answers

This was a bug in sbt, so I filed it as such and it has been fixed in sbt version 1.1.0.

(If this would have turned out out to be hard to resolve, we might have considered to implement a workaround in Akka, but this turned out not to be needed)

like image 124
Arnout Engelen Avatar answered Nov 14 '22 02:11

Arnout Engelen


Adding fork in run := true (which will fork the JVM to run the task) appears to solve the problem with sbt.

This workaround is pointed out as a response on the issue opened by @Arnout

like image 35
Didac Montero Avatar answered Nov 14 '22 02:11

Didac Montero