Cannot instantiate router [consistent-hashing-pool], defined in [/IO-DNS/inet-address] error in akka/spray - scala

I am trying create a sample akka/spray project from here
While the code compiles successfully in sbt, sbt run command throws me an error
java.lang.IllegalArgumentException: Cannot instantiate router [consistent-hashin
g-pool], defined in [/IO-DNS/inet-address], make sure it extends [akka.routing.R
outerConfig] and has constructor with [com.typesafe.config.Config] parameter
the same code compiles and runs successfully in IntelliJ Idea IDE.
EDIT:
Scala version I am using is 2.11 and related libraries
Akka version. 2.4.0 and spray 1.3.3

Yes , this is occurred if you are using akka version below 2.5.4 , because for lower version need to configure routing , Please follow the link http://doc.akka.io/docs/akka/2.4.0/scala/routing.html for routing in lower version . If you can upgrade the version onwards 2.5.4 then no need to routing.

Related

What scala-library dependenecy version can be used with Gradle 7.2 for Gatling performance testing

I am trying to do performance testing for my API using Gatling and Scala.
Below are the plugins/libraries I am using
gradle version : 7.2
gradle.plugin.com.github.lkishalmi.gatling:gradle-gatling-plugin:3.3.0
dependency : gatling 'org.scala-lang:scala-library:2.13.10'
I get the below error when I try to resolve dependencies
A problem occurred evaluating project ':performance-test'.
> Could not find method compile() for arguments [org.scala-lang:scala-library:2.13.10] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
My guess is that the scala version 2.13.10 is not compatible with the gradle version 7.2. I tried changing the scala version to latest and many others, but nothing seems to work.
I have also seen another project using gradle 6.6 and scala version 2.12.2 which works. In my case I can't downgrade the gradle version, unfortunately.
Does anyone know what scala version is compatible with gradle 7.2?
The com.github.lkishalmi.gatling:gradle-gatling-plugin plugin has been deprecated for a long time. Please use the official plugin: https://gatling.io/docs/gatling/reference/current/extensions/gradle_plugin/

Could not find or load main class Error when changing scala compiler version

The default version of Scala complier of Scala IDE for eclipse is 2.12. It runs well for hello world.
However when I change the Scala complier version to 2.11 like following:
Then it shows Error: Could not find or load main class
When I change back to 2.12, it works again.
My question:
My Scala IDE for eclipse version is latest. Why this happens? And what should I do? I have to change to scala 2.11 to load the apache-spark 2.4 jar files. Otherwise it will show errors.

Why when Maven Build Works good but adding Spark Jar as external Jars gives a compile error “object Apache is not a member of package org”

On Eclipse, while setting up spark , even after adding external jars to build path to spark-2.4.3-bin-hadoop2.7/jars/<_all.jar>,
Complier complains about '“object apache is not a member of package org''
Yes, Building dependencies via Maven or SBT would fix it. A question is asked
scalac compile yields "object apache is not a member of package org"
But Question over here is , WHY the traditional way is failing like this ?
If we reffer here , Scala/Spark version compatibility We could see a similar issue. The problem is Scala is NOT backward compatible. Hence each Spark module is complied against specific Scala library. But when we run from eclipse, the eclipse Scala environment may not be compatible that particular scala version of which we have the Spark libraries set up.

Cross-compiled with an incompatible version

I am using eclipse with m2eclipse-scala plugin. Currently, I get the following error message:
exampleA_2.10-2.0.1.jar of module build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page
It looks like the versions of extracted Scala and Scala IDE match. I just wanted to make sure that this is a "false-negative" as described here and can be safely turned off.
As #The Archetypal Paul suggested, it was because I was using wrong Scala library.
If you are using Scala 2.11 (check at About Scala IDE -> installation details), you can downgrade by following instruction here. It's a lot easier than uninstalling and re-installing Scala IDE as other Stackoverflow posts recommend.
I also faced the same issue->
I am trying to use casbah jar in scala to integrate with mongodb.
After analyzing the problem i found that ->
i am trying to use casbah 2.9.1 version and my scala version is 2.11.8
Root-Cause of such error is : your jar is compiled in 2.9.0 version and you are using scala 2.11.8 version
So, to resolve that i use the jar that is compiled into 2.11 scala version-
<groupId>org.mongodb</groupId>
<artifactId>casbah-core_2.11</artifactId>
<version>3.1.1</version>
I was facing similar issue in Eclipse IDE where I had built a Spark scala project in Maven. The scala version was set to 2.11.
Later, I upgraded Scala-Ide plugin in Eclipse after which my project marked below errors,
exampleA_2.10-2.0.1.jar of module build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page
Right click project folder > scala > set scala version. Here my scala version was displayed as 2.10. I selected 2.11 and removed all the error messages.

grails groovy version issue

I have a grails application with 2.4.1 grails version and used 2.3 groovy compiler.
I am getting following error when I try to run
java.lang.NoSuchMethodError: org.codehaus.groovy.runtime.DefaultGroovyMethods.count(Ljava/lang/Iterable;Lgroovy/lang/Closure;)Ljava/lang/Number;
at org.codehaus.groovy.grails.compiler.web.ControllerActionTransformer.processMethods(ControllerActionTransformer.java:234)
at org.codehaus.groovy.grails.compiler.web.ControllerActionTransformer.performInjectionOnAnnotatedClass(ControllerActionTransformer.java:204)
at org.codehaus.groovy.grails.compiler.web.ControllerActionTransformer.performInjection(ControllerActionTransformer.java:196)
at org.codehaus.groovy.grails.compiler.injection.GrailsAwareInjectionOperation.call(GrailsAwareInjectionOperation.java:154)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1213)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:645)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:623)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:600)
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:185)
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.analyseCode(GroovyCompilationUnitDeclaration.java:2213)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:834)
at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
at java.lang.Thread.run(Thread.java:701)
Grails 2.4.1 shipped with Groovy 2.3.3 and that is the only version of Groovy supported with that version of Grails. Normally you don't do anything to associate a version of Groovy with a version of Grails. Grails uses the version that is shipped with it.
Make sure that your GRAILS_HOME points to Grails 2.4.1 and that GRAILS_HOME/bin is on your PATH. If you have a different version of Grails on your PATH than the one that GRAILS_HOME points to, that can sometimes cause peculiar behavior.
I hope that helps.