Symbol 'type akka.stream.scaladsl.Flow' is missing from the classpath - scala

I'm learning Scala and following this video https://www.youtube.com/watch?v=yU85EowqhY4
But when I tried to run my AkkaHttpJson class I end up getting this error
Symbol 'type akka.stream.scaladsl.Flow' is missing from the classpath. This symbol is required by 'method akka.http.scaladsl.server.RouteResult.routeToFlow'. Make sure that type Flow is in your classpath and check for conflicting dependencies with `-Ylog-classpath`. A full rebuild may help if 'RouteResult.class' was compiled against an incompatible version of akka.stream.scaladsl. Http().newServerAt("localhost", 8081).bind(route)
Why am I getting this error? Everything is exactly as shown in the video.
Is it the dependencies that are causing these issues?
Also, If I make a project using Scala 2.* and then want to convert to Scala 3, would I always face issues?
I'm really new to Scala, so I appreciate all help!

Posted the question here and got the answer :)

Related

Can't expand macros compiled by previous versions of Scala

I changed my Scala version from 2.10.x to 2.11.8. I am getting some compilation issues. I tried, but still not able to resolve because I am poor in Scala and sbt.
WebService.scala:36: can't expand macros compiled by previous versions of Scala
[error] logger.error(s"WebService.getSiteData(${Id}): Unknown Error, Error Message: $e")
What might be the issue here?
I resolved this issue but it not a single thing, I did couple of things:
First I gone through the error location in WebService.scala.
Then to the corresponding "Logger" class.
I check from which jar that "Logger" class coming.
I found that it referring to some thing else jar than what I am expecting.
That jar is coming from one of my dependent project (modules) so in build.sbt, those dependent jars I excluded that wrong jar which I found.
After I changed the code in WebService.scala, I removed that import for logger and added new import having Logger what I expecting. I did same all the other places in my project.
WebService.scala:36: can't expand macros compiled by previous versions of Scala
[error] logger.error(s"WebService.getSiteData(${Id}): Unknown Error, Error Message: $e")
This is not particular to logger issue. If you are getting "can't expand macros compiled by previous versions of Scala" issue", you have to do same procedure for corresponding to your error (my case logger).
First time, I search online regarding this issue, I found same issue facing lot of people, but different library classes (I face Logger class issue).

Spark Scala - TokenizerExample - Intellij Error

I am facing issue in compiling 'TokenizerExample' that comes along with Spark-Scala package.
I have setup my environment in IntelliJ and I am able to successfully compile other Spark-Scala examples such as NaiveBayes, CosineSimilarity etc.
But when I load the 'TokenizerExample' into IntelliJ IDE, system displays an error message on the below line stating 'Cannot resolve reference transform with such signature':
val tokenized = tokenizer.transform(sentenceDataFrame)
val regexTokenized = regexTokenizer.transform(sentenceDataFrame)
I have not done any edit and I could observe that the issue is with the transform method. Could you please help me address this issue? Appreciate your support.
Thanks!
SBT/Maven, make sure you have all the dependencies listed in the .sbt or pom.xml file for the mllib module and rebuild. I personally didn't work on mllib, but this kind of errors will show up if we don't resolve the dependencies well enough. Thanks.

bad symbolic reference on SQLContext.class in Eclipse Luna scala IDE

I have setup eclipse for scala IDE on a Linux box. I get the following error on build
bad symbolic reference. A signature in SQLContext.class refers to term types in package org.apache.spark.sql which is not available.
I understand from other similar questions in stackoverflow that I'm missing a dependency. However I am not sure what I am missing.
I have the following jars in the build path
spark-core_2.10-1.5.2.jar
spark-sql_2.10-1.5.2.jar
spark-graphx_2.10-1.5.2.jar
spark-hive_2.10-1.5.2.jar
log4j-1.2.17.jar
Any idea?
Added scala-reflect-2.10.4.jar to the project dependency to solve this. Thanks!

import lift mapper caught an error missing jar file

hi im creating a lift scala application
this is my problem
when i import net.liftweb.mapper._ package the compiler gives me error...
i tried to add lift-mapper_2.9.1-2.4-M4.jar jar file to build path ,but the error exists..!
the compiler shows..
bad symbolic reference. A signature in package.class refers to term db in package net.liftweb 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 package.class.
Try to add the mapper via SBT or maven configuration?
Anyway, Scala-2.9.1 and Lift 2.4-M4 are very-very out of date. Better use something like that for a good start: https://github.com/lift/lift_25_sbt/
It works out of the box, and you'll only have to add 1 line to add the mapper support for it. (After that, all dependencies would be downloaded and added to the project automatically, by SBT.)

eclipse complain compilation error for play 2.0.1

The eclipse complain the following compilation error for play 2.0.1
The type play.api.templates.Html cannot be resolved. It is
indirectly referenced from required .class files
But in play console, it can successfully compile.
anything wrong with my environment ? has anyone encounter this issue ?
Got the solution, I need to put target/scala-2.9.1/src_managed/main to source folder