Scala compiler never ending compilation - scala

I noticed my Scala IDE consuming all the available CPU... I tried to compile the project via SBT from the command line and I got the same situation.
How can I get to know what's going wrong? Is there a way to find out what file or class/object/trait is being compiled?
I'm getting the same issue in 2.10.2 and 2.10.4-RC1

I found out the problem was due to importing a library from Slick 2.0 called heterogenous.syntax. I also got a contact with the Slick developing team in order to give'em some code to investigate on.

Related

Drools 6.5: java.lang.RuntimeException: Illegal class for global. Expected [com.user.PersonAccount], found [com.user.PersonAccount]

I'm using the "org.springframework.boot:spring-boot-devtools" dependency in my Grails application for the live reload of the application on code change. The problem is, it seems that this dependency is causing some conflict with drools.
On kieSession.setGlobal(name, value) in my code, I get the following error:
java.lang.RuntimeException: Illegal class for global. Expected [com.user.PersonAccount], found [com.user.PersonAccount]
Removing the "spring-boot-devtools" dependency fixes the issue but I need this dependency for the live reload, it's important in development.
Anyone knows why this dependency is causing this conflict? and what I can do to fix it or as a workaround?
Thanks in advance!
To whoever might have the same issue in future, the issue is already reported and described before: https://issues.redhat.com/browse/DROOLS-1540 and a fix has been included in drools starting from version 7.26.0.Final (https://github.com/kiegroup/drools/commit/85c5308031a84a0ac4086c1df363bb1b4b3c6af9)
If you don't want to upgrade to the latest version of drools, there's still a workaround to fix the issue which is already mentioned on the devtools page of spring-boot (https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using.devtools.restart.customizing-the-classload).
I added META-INF/spring-devtools.properties with the jars that I want to include in the restart classloader (mainly the drools + kie jars) & the issue is fixed.
When the devtools recompile the class, the byte code no longer matches the byte code from your rules. It's not doing a very good job of warning you, but what it's trying to say is "you are trying to give me a com.user.PersonAccount instance, but it doesn't look like what I know a com.user.PersonAccount instance should look like."
Therefore if you insist on using this tool which will recompile things on the fly, you'll need to also recompile and reload the rules on the fly. Or not use spring-boot-devtools.

java.lang.ClassNotFoundException in Scala project

I built a MapReduce application and wrote it in Scala by using Akka Actor. I am trying to run 3 different JVMs in 3 Terminal Windows, one for my Client, and the other two for my remote Server (which I basically run on my localhost to simulate the distributed application). They can be compiled well. But when it comes to 'run', I saw the following exception. I am really bad at sbt and also new to Scala, Akka. Does anyone have any suggestions or ideas about how to fix it?
server side error
client side error
Updated: Nevermind, it turns out I made a silly mistake by forgetting to delete my old package name after deleted the package folder.

Explain Maven artifact differences: kafka-client, kafka_2.11-<kafkserver-version>, scalatest-embedded-kafka_2.11.

Please explain the maven artifact differences and when to use what? for kafka-client, kafka_2.11-, scalatest-embedded-kafka_2.11. Is anything specially used for writing unit tests?
I want to understand when to use what?
In my repo, we have been using kafka_2.9.2-0.8.1.1, currently we are planning to move to kafka broker 0.9.0.1. Hence I used kafka_2.11-0.9.0.1 and also tried kafka_2.10-0.9.0.1.
When the unit tests runs, kafkaTestServer (kafkaserverstartable) always hangs internittently with kafka_2.10 and kafka_2.11
but with kafka_2.9.2-0.8.1.1 - never had hang issue.
if it proceeds, it failed with KafkaConfig init error or ScalaObject not found error.
I m kind of confused about these artifacts? Can anyone explain me about this?
The names encode the use Scala version as well as the uses Kafka version. For example kafka_2.9.2-0.8.1.1 is for Kafka 0.8.1.1 (ie, the suffix after the - is the Kafka version number and the binaries got compiled using Scala 2.9.2.
Thus, if you write code, you want to use the same Scala version as you artifact was compiled with. I assume, that the hanging and error is due to Scala version mismatch.

playframework 2.5.0 Template fail to compile (fresh one)

I would like to get started with play running play 2.5...
but even installing the template with activator "play-java" has an error.
Using unsupported version of Play: 2.5.0
I have downloaded the full activator package and the minimal.
Both fail on 2 machines(JDK 73).
NO clue how to catch up on this, perhaps some could help me out. I would appreciate it very much.
Bets regards
Using 'activator ui', causes the activator to cycle. The error message is "Getting 'Using unsupported version of Play: 2.5.0'". The issue tracking the problem is https://github.com/typesafehub/activator/issues/1102.
Using 'activator' without the ui argument is a work-around.
Change directories to the play-java directory and running ./activator without the ui argument. This brings up the sbt command line. Sbt commands help, about, tasks, update, compile, test, and run work. A web browser pointed at localhost:9000 will contain a text field with "You're using Play 2.5.0" as content.
The "run" command starts a Netty server. Application interaction is possible using localhost:9000 in a web browser.
As a workaround you can create a project without the UI by using something like
activator new my-app play-scala
Play framework requires java 8 since 2.4 version
https://www.playframework.com/documentation/2.4.x/Migration24#Java-8-support

Convert Scala-Files into a Dll

I have some scala code I've written using IntelliJ with the SBT-Plugin and want to provide me code as an DLL for C++.
I already tried to use 'ikvmc': I packed all my classes via 'package' in one jar. Afterwards I manually set up one jar which contains all the dependencies I use (scala-library,scama,jamtio,jama). Unfortunately i obtain a lot of warnings:'IKVMC0119', "Emitted java.lang.VerificationError' and 'IKVMC0104' (analogously to the example below)!
Then i tried to convert a simple scala-class (no dependencies) using the method described above : package with sbt, add the scala-library.jar and try to convert it via ikvmc -target:library simpleClass.jar . I obtain the same warnings/errors as you see below...
I would be very happy if someone could give me a step-by-step explanation how to provide my Scala-code as an DLL.
Thanks a lot in advance!
Which IKVM version do you use?
If you already use 7.1 then it sounds like a bug in IKVM. Contact the mailing list or the bug list with a sample for reproduction.
If you use an older version then you should update.
After converting the hello.jar with the previous version of IKVM ('7.0.4335.0') i could use the dll in c# (even though i obtained warning from ikvmc). It also worked for my Scala code: converting the sbt-packaged jar with its dependencies delivered a dll. Afterwards i could use the classes in c#!