I am trying to compile the scala breeze library (release 0.9) with sbt 2.13.
I am getting the following error:
[info] Loading project definition from C:\scala\breeze-releases-v0.9\project
[info] Set current project to breeze-parent (in build file:/C:/scala/breeze-releases-v0.9/)
[info] Compiling 280 Scala sources to C:\scala\breeze-releases-v0.9\math\target\scala-2.11\classes...
[error] C:\scala\breeze-releases-v0.9\math\src\main\scala\breeze\util\HeapDump.scala:5: object management is not a member of package com.sun
[error] import com.sun.management.HotSpotDiagnosticMXBean
[error] C:\scala\breeze-releases-v0.9\math\src\main\scala\breeze\util\HeapDump.scala:21: not found: type HotSpotDiagnosticMXBean
[error] private lazy val hotspotMBean: HotSpotDiagnosticMXBean = getHotspotMBean();
[error] C:\scala\breeze-releases-v0.9\math\src\main\scala\breeze\util\HeapDump.scala:38: not found: type HotSpotDiagnosticMXBean
[error] private def getHotspotMBean():HotSpotDiagnosticMXBean = {
[error] C:\scala\breeze-releases-v0.9\math\src\main\scala\breeze\util\HeapDump.scala:42: not found: type HotSpotDiagnosticMXBean
[error] HOTSPOT_BEAN_NAME, classOf[HotSpotDiagnosticMXBean]);
[error] four errors found
I am on java sdk 1.7.0_02
What should I do?
Thanks,
Mike
I answered this on Breeze's mailing list, but this is because you're using a non-HotSpot VM. I'll delete this class in the next release of Breeze.
Related
Context: I'm looking to pick up Scalatra for the first time. I'm following instructions from Scalatra In Action as well as the sample code repo provided. I'm able to get a template project created using g8. When I update the code in the PageController file and start the jetty server I get some really strange error messaging, see below.
c:\Users\eric.barnes\Desktop\scalatra-cms>sbt
[info] welcome to sbt
1.4.5 (Oracle Corporation Java 16.0.2)
[info] loading global plugins from C:\Users\eric.barnes\.sbt\1.0\plugins
[info] loading settings for project scalatra-cms-build from plugins.sbt ...
[info] loading project definition from C:\Users\eric.barnes\Desktop\scalatra-cms\project
[info] loading settings for project hello from build.sbt ...
[info] set current project to Scalatra CMS (in build
file:/C:/Users/eric.barnes/Desktop/scalatra-cms/)
[info] sbt server started at local:sbt-server-dc962f233e7070ae620d
[info] started sbt server sbt:Scalatra CMS> ~jetty:start [info] compiling 1 Scala source to
C:\Users\eric.barnes\Desktop\scalatra-cms\target\scala-2.13\classes ...
[error] C:\Users\eric.barnes\Desktop\scalatra-
cms\src\main\scala\com\example\cms\PageController.scala:4:8: not found: object scalate
[error] import scalate.ScalateSupport [error] ^
[error] C:\Users\eric.barnes\Desktop\scalatra-
cms\src\main\scala\com\example\cms\PageController.scala:6:31: not found: type
ScalatraCmsStack [error] class PagesController extends ScalatraCmsStack {
[error] ^
[error] C:\Users\eric.barnes\Desktop\scalatra-
cms\src\main\scala\com\example\cms\PageController.scala:8:3: not found: value get
[error] get("/pages/:slug") {
[error] ^
[error] C:\Users\eric.barnes\Desktop\scalatra-
cms\src\main\scala\com\example\cms\PageController.scala:9:5: not found: value contentType
[error] contentType="text/html"
[error] ^
[error] C:\Users\eric.barnes\Desktop\scalatra-
cms\src\main\scala\com\example\cms\PageController.scala:10:35: not found: value params
[error] PageDao.pages find (_.slug == params("slug")) match {
[error] ^
[error] C:\Users\eric.barnes\Desktop\scalatra-
cms\src\main\scala\com\example\cms\PageController.scala:11:26: not found: value ssp
[error] case Some(page) => ssp("/pages/show", "page" -> page)
[error] ^
[error] 6 errors found [error] (Compile / compileIncremental) Compilation failed
[error] Total time: 2 s, completed Oct 4, 2021, 10:51:45 AM [info] 1. Monitoring source files
for hello/jetty:start... [info] Press <enter> to interrupt or '?' for more options.
Questions: The error messaging here is a little confusing for a first time Scalatra user. I'm using the same code in the PageController repo so why am I seeing these errors and how can I resolve them? It looks like my shell doesn't recognize the scalate library as an existing library but it's my understanding scalate comes packages with scalatra on install so I'm quite confused.
You have to add the following dependency to your build file to use Scalate (which is a template engine in Scala) in your Scalatra project:
"org.scalatra" %% "scalatra-scalate" % ScalatraVersion
You can see the build configuration of the Sample project at: https://github.com/scalatra/scalatra-in-action/blob/master/chapter02/project/build.scala
By the way, Scalatra in Action is a little old book based on Scalatra 2.4 while the latest major version of Scalatra 2.8. Though most of topics in the book are still effective for Scalatra 2.8, Scalate support has been deprecated in Scalatra 2.8. We recommend using Twirl instead of Scalate in Scalatra 2.8.
I'm trying out scala.js with zio using the sample app at
https://github.com/wongelz/zio-scalajs-solarsystem
as soon as I update the sbt version from 1.2.8 to 1.3.13 or 1.4.4 I'm getting the following error:
[error] Referring to non-existent method java.time.LocalTime$.NANOS_PER_SECOND()long
[error] called from private java.time.LocalDateTime.plusWithOverflow(java.time.LocalDate,long,long,long,long,int)java.time.LocalDateTime
[error] called from java.time.LocalDateTime.plusNanos(long)java.time.LocalDateTime
[error] called from java.time.LocalDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.LocalDateTime
[error] called from java.time.LocalDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.temporal.Temporal
[error] called from java.time.temporal.ChronoUnit.addTo(java.time.temporal.Temporal,long)java.time.temporal.Temporal
[error] called from java.time.OffsetDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.OffsetDateTime
[error] called from java.time.OffsetDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.temporal.Temporal
[error] called from java.time.Duration.addTo(java.time.temporal.Temporal)java.time.temporal.Temporal
[error] called from java.time.OffsetDateTime.plus(java.time.temporal.TemporalAmount)java.time.OffsetDateTime
[error] called from private zio.Schedule$.$anonfun$fixed$2(scala.Option,java.time.OffsetDateTime,long,java.time.Duration,long,scala.runtime.LazyRef)zio.Schedule$Decision
[error] called from private zio.Schedule$.$anonfun$fixed$1(scala.Option,long,java.time.Duration,long,scala.runtime.LazyRef,java.time.OffsetDateTime,java.lang.Object)zio.ZIO
[error] called from private zio.Schedule$.loop$23(scala.Option,long,long,java.time.Duration,scala.runtime.LazyRef)scala.Function2
[error] called from zio.Schedule$.fixed(java.time.Duration)zio.Schedule
[error] called from private SolarSystemExample$.$anonfun$run$1(SolarSystemExample$SolarSystem)zio.ZIO
[error] called from SolarSystemExample$.run(scala.collection.immutable.List)zio.ZIO
[error] called from private zio.App.$anonfun$main$1([java.lang.String)zio.ZIO
[error] called from zio.App.main([java.lang.String)void
[error] called from SolarSystemExample$.main([java.lang.String)void
[error] called from static SolarSystemExample.main([java.lang.String)void
[error] called from core module module initializers
[error] involving instantiated classes:
[error] java.time.LocalDateTime
[error] java.time.temporal.ChronoUnit
[error] java.time.OffsetDateTime
[error] java.time.Duration
[error] zio.Schedule$
[error] SolarSystemExample$
Why does this bug happen? And where should I report it?
To answer my own question (for anybody strugling with the same problem):
Make sure you don't have scalajs-java-time (1.0.0) as a dependency in your classpath.
It is a incomplete library and if it is picked before scala-java-time you will receive the error posted in the question.
The reason this error occurred, was, that at least on my system, the ordering of the classpath changed from sbt 1.2.8 to sbt 1.3.x, which resulted in the scalajs-java-time library being picked before scala-java-time which resulted in the
Referring to non-existent method java.time.LocalTime$.NANOS_PER_SECOND()long
Error
I'm trying to build https://github.com/gatling/gatling but the compilation fails. The steps I undertook:
Installed sbt using the documentation.
Clone the github project.
Execute sbt compile in the directory gatling.
I get the following error:
[error] /home/groot/gatling/gatling-commons/src/main/scala/io/gatling
/commons/util/Arrays.scala:36:32: macro implementation not found: cfor
[error] (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
[error] cfor(length)(_ > 1, _ - 1) { i =>
[error] ^
[error] /home/groot/gatling/gatling-commons/src/main/scala/io/gatling/commons/util/StringHelper.scala:40:23: macro implementation not found: fast
[error] (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
[error] val EmptyFastring = fast""
[error] ^
[error] /home/groot/gatling/gatling-commons/src/main/scala/io/gatling/commons/validation/package.scala:38:20: macro implementation not found: info
[error] (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
[error] logger.info(message, e)
[error] ^
[error] three errors found
[error] (gatling-commons / Compile / compileIncremental) Compilation failed
[error] Total time: 10 s, completed May 4, 2018, 11:30:14 AM
I do not know enough of scala to debug this, how can I fix this?
Try IntelliJ Idea with scala plugin
Just use IntelliJ Idea open the project folder
I've executed as sudo (sudo sbt compile) and now the compilation is succesful.
I have created a project by importing existing sources in Intellij IDEA.
When I run from my comand line,sbt and then console I got this
[info] Compiling 7 Scala sources to
/home/milenko/example/project/target/scala-2.10/classes...
[error] /home/milenko/example/project/CommonBuild.scala:20: not found: type ModuleID
[error] dependencies: Seq[ModuleID] = Seq(),
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:26: not found: type Build
[error] trait CommonBuild extends Build {
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:28: not found: value SettingKey
[error] val course = SettingKey[String]("course")
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:30: not found: value SettingKey
[error] val assignment = SettingKey[String]("assignment")
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:32: not found: value SettingKey
[error] val assignmentsMap = SettingKey[Map[String, Assignment]]("assignmentsMap")
My example folder
milenko#milenko-desktop:~/example$ ls
assignment.sbt build.sbt project src target
Then I have changed directory to project,and run sbt and console in project.
My IDEA import is here
It seems that CommonBuild.scala is not positioned at the wright place.How to change this?
You should run sbt command from the root of your build, not in the project directory. project directory is used to build the build definition of your project, because sbt is recursive.
In other words, in your case you need to run sbt in ~/example directory.
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"