grails groovy version issue - eclipse

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.

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/

Using graphql plugin in grails ends up with: java.lang.ClassNotFoundException: org.grails.compiler.web.converters.RenderConverterTrait

I try to make my 1st experience with graphql in the grails context.
I'm using:
jdk1.8.0_162
Eclipse Java EE IDE for Web Developers.
Version: Oxygen.2 Release (4.7.2)
Build id: 20171218-0600
OS: Linux, v.4.4.0-116-generic, x86_64 / gtk 3.18.9
Grails Version: 3.3.3
Groovy Version: 2.4.14
In build.gradle I entered the graphql-plugin via
compile "org.grails.plugins:gorm-graphql:1.0.3.BUILD-SNAPSHOT"
in the dependencies section. Starting grails ends up with build successful, run-up ends up in
java.lang.ClassNotFoundException: org.grails.compiler.web.converters.RenderConverterTrait
Any hints on Incompatibilities or missing entries in build.gradle?
Peter
Please change dependency from
compile "org.grails.plugins:gorm-graphql:1.0.3.BUILD-SNAPSHOT"
To
compile 'org.grails.plugins:converters:3.3.1'
OR
compile "org.grails.plugins:converters"
This is the Converters plugin that has been part of Grails core up until version 3.3 and now is a standalone plugin.
Users of Grails 3.3.x and above should use this plugin.
see plugin repository here
Hope this will helps you

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.

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

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.

Error while including casbah dependencies

I am facing problem in getting started with casabah to integrate scala and mongoDb. I am using Spring Tool Suite(STS) and imported the following jar files :
spring-data-mongodb-1.6.0.RELEASE.jar
com.mongodb.jar
casbah-commons_2.10-2.7.2.jar
casbah-query_2.10-2.7.2.jar
joda-time-2.1.jar
slf4j-api-1.7.7.jar
casbah-gridfs_2.10-2.5.0.jar
scalaj-collection_2.10-1.4.jar
slf4j-simple-1.7.7.jar
casbah-core_2.10-2.7.2.jar
mongo-2.10.0.jar
mongo-java-driver-2.10.0.jar
However, I get an error.
Error:Description Resource Path Location Type bad symbolic reference. A signature in Implicits.class refers to type Cursor in package com.mongodb which is not available. It may be completely missing from the current classpath, or the version on the classpath might be incompatible with the version used when compiling Implicits.class.
I read a couple of posts that says the problem is with the version in mongo-java-driver so i tried with mongo-java-driver-2.10.1.jar as well , But it was still giving me an error.
Could someone please help me resolve this error??
Thanks a lot in advance!!!
It looks like its a dependency issue. Casbah is built upon a fixed version of the Mongo Java driver so is reliant on a specific binary compatible version.
The Casbah version numbers should all be the same - above you mainly have Casbah 2.7.2 but the gridfs version is wrong: casbah-gridfs_2.10-2.5.0.jar.
Also, Casbah 2.7.2 relies on version 2.12.2 of the Mongo Java Driver, however, the latest version of Casbah is 2.7.3 which relies on version 2.12.3 of the Mongo Java Driver.
To make this simpler there is a all dependencies jar for Casbah that includes the latest version of the java driver and all the other relevant dependencies. Alternatively, the pom file should point all dependent packages which declare their dependencies. (As Casbah is split into sub packages the casbah-commons pom has all the external dependencies listed).