Why does cancelling my running akka quickstart example app throw a java error? - scala

When I hit control-C to cancel my running akka quickstart app I get the following error.
Is this normal or is there an akka config that can avoid this?
Can someone explain why this occurs?
sbt:akka-quickstart-scala> exit
[info] shutting down sbt server
[warn] Run canceled.
Exception in thread "sbt-bg-threads-1" java.util.concurrent.RejectedExecutionException
at java.util.concurrent.ForkJoinPool.externalSubmit(ForkJoinPool.java:2328)
at java.util.concurrent.ForkJoinPool.externalPush(ForkJoinPool.java:2419)
at java.util.concurrent.ForkJoinPool.execute(ForkJoinPool.java:2648)
at scala.concurrent.impl.ExecutionContextImpl.execute(ExecutionContextImpl.scala:24)
at sbt.internal.BackgroundThreadPool$BackgroundRunnable.$anonfun$cleanup$1(DefaultBackgroundJobService.scala:390)
at sbt.internal.BackgroundThreadPool$BackgroundRunnable.$anonfun$cleanup$1$adapted(DefaultBackgroundJobService.scala:389)
at scala.collection.immutable.List.foreach(List.scala:392)
at sbt.internal.BackgroundThreadPool$BackgroundRunnable.cleanup(DefaultBackgroundJobService.scala:389)
at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:359)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

This is a known issue that can be seen in this github issue link.
In my case, When I upgraded my sbt to 1.3.3, same issue cropped up, my akka code was not getting closed using CTRL+C when launched by sbt run. It only logs a warning message and does not stop. So, I had to downgrade the sbt version from 1.3.3 to 1.2.8 to make it work.
Please let me know if it helps!!

Related

sbt run failed spark#3.2.1

I maded a simple spark app in this repository, where sbt run always report errors as
Exception in thread "Thread-2" java.lang.RuntimeException: java.nio.file.NoSuchFileException: /github.com/sammyne/spark-failure-with-sbt-run/target/bg-jobs/sbt_28d6c4e/target/2ab34e8d/81ecd14d/hadoop-client-api-3.3.1.jar
Environment
sbt 1.6.2
Scala 2.13.8
Spark 3.2.1
Ubuntu 20.04
Bug reproduction
Both of the following two cases trigger errors like NoSuchFileException, which are expected to run successfully.
sbt run in one shot
sbt run
Partial errors go as
Exception in thread "Thread-2" java.lang.RuntimeException: java.nio.file.NoSuchFileException: /github.com/sammyne/spark-failure-with-sbt-run/target/bg-jobs/sbt_b7a00768/target/2ab34e8d/81ecd14d/hadoop-client-api-3.3.1.jar
The full logs can be seen here.
sbt and then run
sbt
# after entering the sbt shell
run
At this moment, it's fine with logs as here.
However, once exit the shell, I got
[info] shutting down sbt server
22/04/27 07:55:10 INFO ShutdownHookManager: Shutdown hook called
22/04/27 07:55:10 INFO ShutdownHookManager: Deleting directory /tmp/spark-f28ecf9a-e963-459f-b54e-f1e4825ba210
22/04/27 07:55:10 ERROR Configuration: error parsing conf core-default.xml
java.nio.file.NoSuchFileException: /github.com/sammyne/spark-failure-with-sbt-run/target/bg-jobs/sbt_28d6c4e/target/2ab34e8d/81ecd14d/hadoop-client-api-3.3.1.jar
at
...
The full error can be seen as here

Sudden problem with Apache log4j Appender when trying to launch SBT

I was executing a scala program with SBT and needed to stop the execution, so I hit Ctrl+c to end execution, which also ends the execution of SBT. I've done this a thousand times, but this time SBT wouldn't restart, and gives me this error:
java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/Appender
at sbt.StandardMain$.initialGlobalLogging(Main.scala:114)
at sbt.StandardMain$.initialState(Main.scala:136)
at sbt.xMain.run(Main.scala:70)
at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
at xsbt.boot.Launch$.run(Launch.scala:149)
at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
at xsbt.boot.Launch$.launch(Launch.scala:159)
at xsbt.boot.Launch$.apply(Launch.scala:44)
at xsbt.boot.Launch$.apply(Launch.scala:21)
at xsbt.boot.Boot$.runImpl(Boot.scala:78)
at xsbt.boot.Boot$.run(Boot.scala:73)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.core.Appender
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 14 more
[error] [launcher] error during sbt launcher: java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/Appender
I tried installing a new version of SBT but that didn't work, and I get the same error.
I'm at a complete loss as to how to fix this problem. I really don't even know what the problem is. Thanks for any help.
I was able to get things working but I won't guarantee this would be a fix for everyone. Deleting my .sbt folder and restarting sbt worked. It created a new .sbt folder and everything is working correctly now. I only use sbt for compiling scala code so there isn't much that depends on sbt. Definitely back up your old .sbt folder if you're going to try this route.

Running story failed after upgrading to latest jbehave version 4.5.1

I have been using older jbehave version - 3.9.5, tried to upgrade to latest version - 4.5.1. However, while executing tests, it fails with AbstractMethodError
Below is the exact error encountered:
Failed to run story ABC/ABC-144.31.story
java.lang.AbstractMethodError: com.jbehaveforjira.javaclient.JiraStoryReporter.beforeScenario(Lorg/jbehave/core/model/Scenario;)V
at org.jbehave.core.reporters.DelegatingStoryReporter.beforeScenario(DelegatingStoryReporter.java:58)
at org.jbehave.core.reporters.ConcurrentStoryReporter.beforeScenario(ConcurrentStoryReporter.java:176)
at org.jbehave.core.embedder.PerformableTree$PerformableScenario.perform(PerformableTree.java:1007)
at org.jbehave.core.embedder.PerformableTree$PerformableStory.performScenarios(PerformableTree.java:907)
at org.jbehave.core.embedder.PerformableTree$PerformableStory.perform(PerformableTree.java:882)
at org.jbehave.core.embedder.PerformableTree.performCancellable(PerformableTree.java:435)
at org.jbehave.core.embedder.PerformableTree.perform(PerformableTree.java:402)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:293)
at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Based on this error and after debugging understood that before Scenario (String title) and two other methods have been deprecated in latest version.
I commented these methods in below classes/interface locally and rebuilt my application, but it didn't solve the problem. Please help to provide any help/suggestion.
org.jbehave.core.reporters.ConcurrentStoryReporter, org.jbehave.core.reporters.DelegatingStoryReporter,
org.jbehave.core.reporters.StoryReporter
org.jbehave.core.embedder.PerformableTree
I was able to update my jbehave from 4.1.3 to 4.5.1. I encountered the same error when only updating jbehave-core. So in addition to updating your jbehave version, you must also update other dependencies in your project. In my case, I updated the following: jbehave-core(to 4.5.1), serenity-core(to 1.9.40), serenity-jbehave(to 1.46.0). Please check your pom.xml or the jar files in your build path.

akka-kryo-serialization ClassNotFoundException: scala.Enumeration$Val

Sometimes when updating a dependency version for my project, when I would run the project I would get the following error:
ERROR 09:31:34:241 apply$mcV$sp - Class could not be loaded and/or registered: scala.Enumeration$Val
ERROR 09:31:34:247 apply$mcV$sp - exception caught during akka-kryo-serialization startup: java.lang.ClassNotFoundException: scala.Enumeration$Val
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
I usually got lucky and was able to fix this by tweaking the versions of my dependencies.
Until I updated my akka version from 2.3.6 to 2.3.12, specifically akka-contrib which contains akka-cluster, akka-remote and akka-peristance.
Turns out that the problem was actually occurring during the transition between akka 2.3.8 and 2.3.9. Looking at the change log, I found that between these two versions the Scala version was upgraded from 2.11.4 to 2.11.5.
My project was building on scala 2.11.4. Upgrading to 2.11.5 fixed the problem.
I couldn't find any help online for this, and lost a couple days trying to figure this out. I'm hoping that this will help someone else out.

Why is UnknownHostException: downloads.typesafe.com when running activator ui?

I am getting the following exception after starting activator ui from command line.
Checking for a newer version of Activator (current version 1.2.2)...
... our current version 1.2.2 looks like the latest.
Found previous process id: 2988
FOUND REPO = activator-local # file:////C:/shakti/scala/typesafe-activator-1.2.2
/activator-1.2.2/repository
Play server process ID is 5712
[info] play - Application started (Prod)
[info] play - Listening for HTTP on /127.0.0.1:8888
[ERROR] [06/15/2014 05:46:13.851] [default-akka.actor.default-dispatcher-3] [ActorSystem(default)] Failed to download http://downloads.typesafe.com/typesafe-activator/index/v2/index-07064250cfd1cc2444f19c731541332ccf93bc13.zip: sbt.TranslatedIOException: Error opening http://downloads.typesafe.com/typesafe-activator/index/v2/index-07064250cfd1cc2444f19c731541332ccf93bc13.zip: java.net.UnknownHostException: downloads.typesafe.com
[INFO] [06/15/2014 05:46:13.860] [default-akka.actor.default-dispatcher-3] [akka://default/user/template-cache] Unable to check remote server for template updates.
[INFO] [06/15/2014 05:46:19.155] [default-akka.actor.default-dispatcher-2] [akka://default/user/home-socket-1] Firing up web socket
What could be the reason and how to fix it?
Seems it was an intermittent issue due to some network problem. It is working fine now.
I resolve this prolem using ./activator ui instead using activator ui on linux