Play Framework InjectedRoutesGenerator Error - scala

I have created new Play + Scala project using latest typesafe activator and when trying to import in IntelliJ IDE I was getting below error,
info] Loading project definition from E:\Personal\Scala Workspace\DeployZip\project
E:\Personal\Scala Workspace\DeployZip\build.sbt:18: error: not found: value routesGenerator
routesGenerator := InjectedRoutesGenerator
^
[error] Type error in expression
Consult IDE log for more details (Help | Show Log)
What are the possible reasons for this error?

I have installed jdk 1.8 and now I am able to create project successfully without any error.
But when I tried to run play application using
activator run
I was getting below error now,
java.lang.UnsupportedClassVersionError: org/webjars/WebJarExtractor$Cache : Unsupported major.minor version 51.0

According to this article, I think Unsupported major.minor version 51.0 means that your play application were compiled with Java 1.7 (version 51), but you have Java 1.8 (version 52) installed instead, so you got this error. I'd suggest that you refer to this article for how you could switch between different Java versions.
I was having the error that said Unsupported major.minor version 52.0, and after I installed the latest one (Java 1.8) it was solved.
Hope this helps.

Here is what I've done to solve the issue. Even if you install the java 1.8 it is not sufficient. You have to update the 'path' and 'JAVA_HOME'.
After you install, try to set the jdk1.8 path in the PATH of the environment variables. Also make sure that if you have other versions of the java in the PATH then put the jdk 1.8 path prior to the previous version of java. Or just in case put it in the very beginning of the paths.

I had this same issue. Everything worked after I upgraded Intellij to the latest version (maybe my outdated version used JDK1.7, while activator used 1.8?).

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/

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.

Selecting exact Groovy version in Eclipse Juno

In Eclipse Juno when I try to run Groovy source (that has a main method inside of it) I get:
Caught: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.3.4 and you are trying to load version 2.3.3
Google, surprisingly, turned up nothing. When I go to Project >> Properties >> Groovy Compiler I see that my Groovy compiler is at 2.3, but it doesn't give me the option to select 2.3.3 or 2.3.4.
Any ideas what the fix is?
There is no fix for that. Each groovy-eclipse compiler is a version tweaked to work with eclipse JDT and whatnot. You can try to use other groovy-eclipse versions, which might feature the groovy version you need

play -help gives Error: Could not retrieve sbt 0.13.0: missing sbt.xMain

I created a new app using command play new hello and cd'ed into the directory. When I type play in the directory, I receive the following error:
akshay#Akshay:~/play/testn$ play -help
Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Getting org.scala-sbt sbt 0.13.0 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
0 artifacts copied, 43 already retrieved (0kB/45ms)
Error: Could not retrieve sbt 0.13.0: missing sbt.xMain
Play was working fine in my old Ubuntu box. Today only I got a fresh copy of Ubuntu 12.04 32 bit. I know it is error due to change in version, but certainly, I am not able to solve this. Please help me on this.
In checked .sbt/boot/update.log and I can see this :
trying http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
tried http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
HTTP response status: 404 url=http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
CLIENT ERROR: Not Found url=http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
typesafe-ivy-releases: resource not reachable for org.sonatype.oss#oss-parent;7: res=http://repo.typesafe.com/typesafe/ivy-releases/org.$
trying http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/
Though error was coming from a fresh ubuntu installation with oracle jdk 8, I tried completely removing jdk and then installing jdk 7, but still no solution. Since it was a fresh installation, I reinstalled ubuntu and installed jdk 7 and problem is solved. Not sure why is it contradictory to Play's recomendation of using Jdk 6 or above. Notifying Play Google Groups about this.
I was getting the same error while trying to build using sbt-launcher.jar which was invoked through jenkins. In my case there were two Scala versions within ~/.sbt/boot/ and removing the older version solved the issue.
I was trying to setup my development environment for one of our projects when I hit this issue. The problem was the sbt.version parameter in the build.properties file of our project which specifically mentioned the version of sbt as 0.13.8 and I had sbt 0.13.11.
After removing sbt 0.13.11 and installing 0.13.8, the issue got resolved. Or if it is possible for you to change the sbt version in your build.properties file, you can do that as well.

Drools Java 7 support in Eclipse

I created a Drools project in Eclipse (Indigo) configured to use JRE 1.7. But I get an error pointing to my .drl file:
com/sample/DroolsTest$Message : Unsupported major.minor version 51.0
The com.sample.DroolsTest.Message class is imported by the .drl file. The Drools runtime was 5.2.1 (also tried with 5.3.0.Final).
Any help would be appreciated. Thanks.
This exception doesn't seem to have to do anything with Drools in particular, but is a generic Java error. It occurs if you try to execute a Java class with a JRE that is older than the JDK that was used to compile it. For example, if you compiled the class with a JDK7 and then tried to execute it with a JDK6, you would get this error.
Just to detail above answer and comment. I had both JRE6 and JRE7 installed, with JRE7 being the default. I had to do two things to remove the error from the drools sample project.
Set the JRE for the project to 1.6
Project properties->Java Build Path->Libraries. Remove JRE System Library 1.7 and Add Library->JRE System Library->Alternate JRE->JRE6
Set the compiler compliance level for the project at 1.6.
Project properties->Java Compiler->check Enable Project specific settings and set Compiler compliance level at 1.6.