How to resolve this exception - scala

This Exception invoked and not able to resolved it ...
Error:scalac: missing or invalid dependency detected while loading class file 'GenericCollection.class'.
Could not access term play in package <root>,
because it (or its dependencies) are missing. Check your build definition for
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'GenericCollection.class' was compiled against an incompatible version of <root>.

The error message is basically saying that GenericCollection.class has a reference to the _root_.play package, but the play package can't be found.
You have to add a dependency to the library that provides the play package, which is very likely part of the play framework.

Related

Why am I getting "object scala.runtime in compiler mirror not found." with scala-maven-plugin when dependency is upgraded?

I have a Maven based project that uses Scala. I tried to upgrade an internal dependency and now I get
[ERROR] : error while loading Object, Missing dependency 'class scala.native in compiler mirror', required by /modules/java.base/java/lang
/Object.class
[ERROR] ## Exception when compiling 59 sources to ...\target\classes
scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found.
I am digging through the sub dependency differences but does anyone know why this might happen?
Additional Information
The error is super vague so I will update as best I can with more info.

Could not access type LoggingAdapter in value akka.event

I migrated from Scala 2.10.8 to 2.11.7 and Akka 2.1.2 to 2.3.14. I did lot of changes in *.sbt and source also. Now, I am getting some issue. I check online, but I did not get actual cause. I think the spray version is not suite to Akka version. But which version of Spray I have to use for Akka 2.3.14, I did not get any information yet online and Akka documents also.
The Issue is:
[error] missing or invalid dependency detected while loading class file 'LoggingContext.class'.
[error] Could not access type LoggingAdapter in value akka.event,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'LoggingContext.class' was compiled against an incompatible version of akka.event.
My Project dependency is this:
https://www.dropbox.com/s/tp1ruackt9tued6/dependencyTree2.txt?dl=0
If you need to use spray, the latest version of Akka you may use is 2.2.x as you can see in their documentation.
In case that you have to use a newer version of Akka, you will have to use Akka HTTP and follow their migration guide.

Spark-Scala Invalid dependency while loading class file

Type missing or invalid dependency detected while loading class file 'SQLImplicits.class'. Could not access type Encoder in package org.apache.spark.sql, because it (or its dependencies) are missing. Check your build definition for missing or conflicting dependencies. (Re-run with -Ylog-classpath to see the problematic classpath.) A full rebuild may help if 'SQLImplicits.class' was compiled against an incompatible version of org.apache.spark.sql. SparkScala Unknown Scala Problem.
Description Resource Path Location Type
missing or invalid dependency detected while loading class file 'package.class'. Could not access type Row in package org.apache.spark.sql, because it (or its dependencies) are missing. Check your build definition for missing or conflicting dependencies. (Re-run with -Ylog-classpath to see the problematic classpath.) A full rebuild may help if 'package.class' was compiled against an incompatible version of org.apache.spark.sql. SparkScala Unknown Scala Problem
I'm new to this world. Any help would be highly appreciated!!
I have installed both 2.11 versions of spark and scala.
This was caused due to d not matching the org.apache.spark.sql version with org.apache.spark core. make sure both have same version.
I hope this will solve the issue.

scalac: missing or invalid dependency detected while loading class file 'CassandraSession.class'

I've been developing in Javadsl with Maven, but I haven't been able to compile the project in my intellij 2016 since I added Scaladsl libraries.
This is the error I am getting:
Error:scalac: missing or invalid dependency detected while loading
class file 'CassandraSession.class'. Could not access term session in
package akka.persistence.cassandra, because it (or its dependencies)
are missing. Check your build definition for missing or conflicting
dependencies. (Re-run with -Ylog-classpath to see the problematic
classpath.) A full rebuild may help if 'CassandraSession.class' was
compiled against an incompatible version of
akka.persistence.cassandra.
I tried the followings:
Invalidate Cache and Restart the Intellij
Maven Clean Install (failed)
Restart the PC
None of them worked.
Does anyone know how to fix this problem?
This is my POM.xml for the module which I am using both Scaladsl and Javadsl.
Thanks!

How to resolve reference to twirl generated template class in Scala-IDE?

Using twirl for generating template class. Everything is working fine with sbt and the webpages are rendering.
I am using Scala-IDE for development. And in the Scala-IDE the reference to the template class i.e. "html.test()", test is the template name, is showing as an error.
This is the error:
Description Resource Path Location Type
missing or invalid dependency detected while loading class file 'test.class'.
Could not access term api in value .twirl, because it (or its dependencies) are missing.
Check your build definition for missing or conflicting dependencies. (Re-run with -Ylog-classpath to see the problematic classpath.) A full rebuild may help if 'test.class' was compiled against an incompatible version of .twirl. ApiService.scala /api/src/main/scala/com/komma/api/rest line 97 Scala Problem.
I did a clean and it is giving "not found: value html" error now.
Is there any way to resolve this error in the scala IDE ?
Thanks.
Re-running sbt eclipse added target/scala-2.11/twirl/main as a source folder which resolved the compilation errors for me.
For my twirl configuration, sbt eclipse did not add the twirl output directory as a source folder. Adding
target/scala-2.11/twirl/main to the eclipse project build path through the Add Folder button, under Java Build Path, by hand, was my solution.