Iteratee is not a member of package play.api.libs - scala

While upgrading from play 2.4 -> 2.5 I hit an issue where
Symbol 'type <none>.iteratee.Iteratee' is missing from the classpath
I checked the migration guide and included the dependency "com.typesafe.play" % "play-iteratees_2.11" % 2.5.18 into sbt. From the new play-iteratees repo, I was under the impression that package play.api.libs.iteratee is where I'd find what to import. But it doesnt seem to work?
Error log:
[error] /Users/arnogau/Documents/alice/common/src/main/scala/common/util/Autodesk.scala:23: object iteratee is not a member of package play.api.libs
[error] import play.api.libs.iteratee.Iteratee
[error] ^
[error] /Users/arnogau/Documents/alice/common/src/main/scala/common/util/Autodesk.scala:158: Symbol 'type <none>.iteratee.Iteratee' is missing from the classpath.
[error] This symbol is required by 'method play.api.libs.ws.WSRequest.get'.
[error] Make sure that type Iteratee is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'WSRequest.class' was compiled against an incompatible version of <none>.iteratee.
[error] val req = client.url(MANIFEST_URL(urn)).withToken(token).get()
[error] ^
[error] two errors found

Related

Symbol 'term org.apache.spark.annotation' is missing from the classpath(spark kubernetes)

I am using spark with Kubernetes and facing an issue while building a fat jar with "sbt assembly" command with libraryDependencies += "org.apache.spark" %% "spark-kubernetes" % "2.4.5" in my build.sbt. Everything is working fine if i downgrade the spark kubernetes version to "2.4.2" but not with "2.4.5".`
And in another case when i rebuild the same code again using sbt assembly after deleted the target folder generated by previous sbt assembly command then it starts working fine with the same 2.4.5 spark Kubernetes jar.
I just want to avoid this multiple times assembly jar building activity and i have also tried by adding spark tags library in my build.sbt file but still it is not working.
So Please help me with this issue.
I am using spark 2.4.4 and scala 2.11.12 and sbt 1.2.8
Kindly find the attached logs .
[error] import org.apache.spark.sql.{SQLContext, SparkSession}
[error] ^
[error] /d02/scala/sparktest/app/controllers/MainController.scala:92:15: Symbol 'term org.apache.spark.annotation' is missing from the classpath.
[error] This symbol is required by ' <none>'.
[error] Make sure that term annotation is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'SparkSession.class' was compiled against an incompatible version of org.apache.spark.
[error] var spark = SparkSession.builder().appName("sparktest").config(conf).getOrCreate()
[error] ^
[error] /d02/scala/sparktest/app/controllers/MainController.scala:94:24: Symbol 'term org.apache.spark.annotation' is missing from the classpath.
[error] This symbol is required by ' <none>'.
[error] Make sure that term annotation is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'SQLContext.class' was compiled against an incompatible version of org.apache.spark.
[error] var sqlContext = new SQLContext(sc)
[error] ^
[error] three errors found
[error] (Compile / compileIncremental) Compilation failed.

Scalac option Yopt-log-inline make errors

With scala 2.12.4 when I use theses parameters
scalacOptions := Seq("-unchecked", "-deprecation", "-opt:l:inline","-opt-inline-from:bfd.DateTime$","-Yopt-log-inline")
I have error which doesn't exist when I don't use "-Yopt-log-inline"
[info] Compiling 7 Scala sources to /Users/admin/Workspace/bfd/target/scala-2.12/classes ...
[error] error while loading Object, Missing dependency 'object scala in compiler mirror', required by /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
[error] ## Exception when compiling 7 sources to /Users/admin/Workspace/bfd/target/scala-2.12/classes
[error] object scala in compiler mirror not found.
[error] scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
[error] scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)
[error] scala.reflect.internal.Mirrors$RootsBase.$anonfun$getModuleOrClass$4(Mirrors.scala:54)
[error] scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:54)
[error] scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
[error] scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:172)
[error] scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage$lzycompute(Definitions.scala:169)
[error] scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage(Definitions.scala:169)
[error] scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass$lzycompute(Definitions.scala:170)
[error] scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass(Definitions.scala:170)
[error] scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1423)
[error] scala.tools.nsc.Global$Run.<init>(Global.scala:1164)
[error] xsbt.ZincCompiler$ZincRun.<init>(CallbackGlobal.scala:63)
[error] xsbt.CachedCompiler0.run(CompilerInterface.scala:129)
[error] xsbt.CachedCompiler0.run(CompilerInterface.scala:106)
[error] xsbt.CompilerInterface.run(CompilerInterface.scala:32)
[error] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
...
I think the error is not related to the usage of inline. Maybe the options override the scala dependency definition.
Is it a bug in the compiler or just a bad setting with an unclear feedback?
-Yopt-log-inline expect a parameter. The equivalent to the wild card of -opt-inline-from:** is the underscore _.
So to correct this error add this parameter to scalacOptions like this.
scalacOptions ++= Seq("-opt:l:inline","-opt-inline-from:bfd.DateTime$","-Yopt-log-inline", "_")
edit:
What hepping here is a problem between scalac and sbt, sbt gives the class pass next to Scala option, so scalac think the classpath is the option of -Yopt-log-inline and start without actual classpath, which make a crach.
If you are using sbt and don't want to fall in this kind of error you can use "-Y" as your last option.

Linker error in ScalaJS: "Referring to non-existent class"

I am getting a bunch of linker errors when trying to link to FastParse in a Scala project which I've just tried to build a ScalaJS web app in.
I added the ScalaJS dependency for FastParse into my build.sbt: here's approximately the relevant line (full file here):
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "fastparse" % "0.4.1"
)
My errors are voluminous, but here's a representative one:
[error] Referring to non-existent class fastparse.Implicits$Repeater$
[error] called from parsers.MainParser$$anonfun$impls$1.apply()fastparse.core.Parser
[error] called from parsers.MainParser$$anonfun$impls$1.apply()java.lang.Object
[error] called from scala.Option.getOrElse(scala.Function0)java.lang.Object
[error] called from fastparse.StringReprOps$.errorMessage(fastparse.utils.ParserInput,java.lang.String,scala.Int)java.lang.String
[error] called from fastparse.core.ParseError.<init>(fastparse.core.Parsed$Failure)
[error] called from fastparse.Api.<init>(scala.reflect.ClassTag,fastparse.utils.ElemSetHelper,fastparse.utils.ReprOps,scala.math.Ordering)
[error] called from fastparse.StringApi.<init>()
[error] called from fastparse.all$.<init>()
[error] called from parsers.MainParser$.<init>()
[error] called from webapp.WebApp$.makeChoices(java.lang.String,java.lang.String)scala.collection.immutable.List
[error] called from webapp.WebApp$.$$js$exported$meth$makeChoices(java.lang.String,java.lang.String)java.lang.Object
[error] called from webapp.WebApp$.makeChoices
[error] exported to JavaScript with #JSExport
[error] involving instantiated classes:
[error] parsers.MainParser$$anonfun$impls$1
[error] scala.None$
[error] scala.Some
[error] fastparse.StringReprOps$
[error] webapp.WebApp$
What am I doing wrong?
The problem was that I was requiring the JVM version of FastParse two lines up in my build.sbt. This broke my build apparently. I removed that line and cleaned my build and now both the ScalaJS and ScalaJVM versions of the project are building nicely.
(Thanks heaps to Li Haoyi for spotting the problem for me)

Bad Symbolic reference to reactivemongo.api.collections.GenericHandlers encountered in class file 'JSONGenericHandlers.class'

I'm having my apis in play 2.3 with reactive mongo. Recently, i tried to cleaned the project and during the process, some things got updated. Later, when i tried to run or compile that, i'm getting these errors. Apart from clean, i didn't do anything. Kindly help me.
[info] Compiling 48 Scala sources and 1 Java source to /home/Ruthvick/zcapi/zceapi /target /scala-2.11/classes...
[error] bad symbolic reference to reactivemongo.api.collections.GenericHandlers encountered in class file 'JSONGenericHandlers.class'.
[error] Cannot access type GenericHandlers in package reactivemongo.api.collections. The current classpath may be
[error] missing a definition for reactivemongo.api.collections.GenericHandlers, or JSONGenericHandlers.class may have been compiled against a version that's
[error] incompatible with the one found on the current classpath.
[error] /home/Ruthvick/zcapi/zceapi/app/controllers/Application.scala:28: type arguments [play.modules.reactivemongo.json.collection.JSONCollection] do not conform to method collection's type parameter bounds [C <: reactivemongo.api.Collection]
[error] def collection: JSONCollection = db.collection[JSONCollection]("shoppage")
[error] ^
[error] /home/Ruthvick/zcapi/zceapi/app/controllers/Application.scala:47: could not find implicit value for parameter writer: GenericCollection.this.pack.Writer[play.api.libs.json.JsObject]
[error] collection.insert(result).map { lastError =>
[error] ^
[error] 60 errors found
[error] (compile:compile) Compilation failed
[error] application -
Thanks,
Your version of Play is not compatible with the newest Snapshot of Play Reactive Mongo. You could just use Version 0.10.5.
Add this to your Library Dependencies
"org.reactivemongo" %% "play2-reactivemongo" % "0.10.5.0.akka23"

Class Resolving in one namespace, but not the other

When running play compile, I get a compile-time error.
[error] test.scala:14: object BOMInputStream is not a member of package org.ap
ache.commons.io.input
[error] import org.apache.commons.io.input.BOMInputStream
[error] ^
[error] test.scala:80: not found: type BOMInputStream
[error] val bomIn = new BOMInputStream(fileInpStream, false)
[error] ^
[error] two errors found
However, I successfully ran a scalatest test using the BOMInputStream in the same play project within the /test directory.
When I comment out the offending lines in the above compile-time error, the test succeeds.
Note that I've updated my /project/Build.scala appropriately:
"org.apache.commons" % "commons-io" % "1.3.2"
After deleting a JAR, which contained the BOMInputStream class, from my PLAY-PROJECT/lib/ directory, I was able to compile.