NPE during GWT compilation - gwt

Following NPE appears during GWT compilation. It's in the compiler itself, not in application code:
[ERROR] Exception in thread "pool-1-thread-96" java.lang.NullPointerException
[ERROR] at com.google.gwt.dev.util.DiskCache.transferToStream(DiskCache.java:185)
[ERROR] at com.google.gwt.dev.util.DiskCacheToken.writeObject(DiskCacheToken.java:73)
[ERROR] at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
[ERROR] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
[ERROR] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[ERROR] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[ERROR] at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
[ERROR] at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:441)
[ERROR] at com.google.gwt.dev.javac.CachedCompilationUnit.writeObject(CachedCompilationUnit.java:222)
[ERROR] at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
[ERROR] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
[ERROR] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[ERROR] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[ERROR] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
[ERROR] at com.google.gwt.dev.javac.PersistentUnitCache$6.run(PersistentUnitCache.java:492)
[ERROR] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[ERROR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[ERROR] at java.lang.Thread.run(Thread.java:745)
GWT version 2.6.1

This bug usually happen when not all shared classes (used both on server and client side) implements Serializable interface.

Related

Scala/Sbt project on IntelliJ

It's been a while since I used Scala and Intellij. But I wanted to learn about Big Data, and I decided to start a course.
I have been trying to setup IntelliJ to run the first project. I installed openjdk 16 and scala 2.12.13.
I am able to run the project from terminal
$ sbt clean compile run
In IntelliJ I created an sbt task with the same commands, but I am getting the following error.
[info] running com.sundogsoftware.sparkstreaming.PrintTweets
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
[error] (run-main-1) java.lang.ExceptionInInitializerError
[error] java.lang.ExceptionInInitializerError
[error] at org.apache.spark.unsafe.array.ByteArrayMethods.<clinit>(ByteArrayMethods.java:54)
[error] at org.apache.spark.internal.config.package$.<init>(package.scala:1006)
[error] at org.apache.spark.internal.config.package$.<clinit>(package.scala)
[error] at org.apache.spark.SparkConf$.<init>(SparkConf.scala:639)
[error] at org.apache.spark.SparkConf$.<clinit>(SparkConf.scala)
[error] at org.apache.spark.SparkConf.set(SparkConf.scala:94)
[error] at org.apache.spark.SparkConf.set(SparkConf.scala:83)
[error] at org.apache.spark.SparkConf.setMaster(SparkConf.scala:115)
[error] at org.apache.spark.SparkContext$.updatedConf(SparkContext.scala:2698)
[error] at org.apache.spark.streaming.StreamingContext$.createNewSparkContext(StreamingContext.scala:862)
[error] at org.apache.spark.streaming.StreamingContext.<init>(StreamingContext.scala:101)
[error] at com.sundogsoftware.sparkstreaming.PrintTweets$.main(PrintTweets.scala:24)
[error] at com.sundogsoftware.sparkstreaming.PrintTweets.main(PrintTweets.scala)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[error] Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.nio.DirectByteBuffer(long,int) accessible: module java.base does not "opens java.nio" to unnamed module #3d8f7200
[error] at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
[error] at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
[error] at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:188)
[error] at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:181)
[error] at org.apache.spark.unsafe.Platform.<clinit>(Platform.java:56)
[error] at org.apache.spark.unsafe.array.ByteArrayMethods.<clinit>(ByteArrayMethods.java:54)
[error] at org.apache.spark.internal.config.package$.<init>(package.scala:1006)
[error] at org.apache.spark.internal.config.package$.<clinit>(package.scala)
[error] at org.apache.spark.SparkConf$.<init>(SparkConf.scala:639)
[error] at org.apache.spark.SparkConf$.<clinit>(SparkConf.scala)
[error] at org.apache.spark.SparkConf.set(SparkConf.scala:94)
[error] at org.apache.spark.SparkConf.set(SparkConf.scala:83)
[error] at org.apache.spark.SparkConf.setMaster(SparkConf.scala:115)
[error] at org.apache.spark.SparkContext$.updatedConf(SparkContext.scala:2698)
[error] at org.apache.spark.streaming.StreamingContext$.createNewSparkContext(StreamingContext.scala:862)
[error] at org.apache.spark.streaming.StreamingContext.<init>(StreamingContext.scala:101)
[error] at com.sundogsoftware.sparkstreaming.PrintTweets$.main(PrintTweets.scala:24)
[error] at com.sundogsoftware.sparkstreaming.PrintTweets.main(PrintTweets.scala)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[error] stack trace is suppressed; run last Compile / bgRun for the full output
[error] Nonzero exit code: 1
[error] (Compile / run) Nonzero exit code: 1
[error] Total time: 1 s, completed Apr 8, 2021, 8:17:21 AM
I am stuck, I have been trying to vary the setup, delete the .idea folder and invalidate cache/restart intellij. But I am always getting the same error.

Cannot Create IntelliJ Scala Project Due to Missing Ivy Module

I am using IntelliJ Community 2019.1. I am trying to create a new Scala project via SBT; however, when the project tries to build and dump project structure from SBT, I get the following error. SBT version 1.2.7; Scala version 2.11.12; JDK 1.8.0_202,
Error while importing sbt project:
[error] java.lang.NoClassDefFoundError: org/apache/ivy/core/module/id/ModuleRevisionId
[error] at sbt.Keys$.<init>(Keys.scala:439)
[error] at sbt.Keys$.<clinit>(Keys.scala)
[error] at sbt.Cross$.$anonfun$requireSession$1(Cross.scala:78)
[error] at sbt.Command$.$anonfun$applyEffect$3(Command.scala:142)
[error] at sbt.Command$.$anonfun$combine$2(Command.scala:147)
[error] at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
[error] at scala.collection.immutable.List.foreach(List.scala:388)
[error] at scala.collection.TraversableLike.map(TraversableLike.scala:233)
[error] at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
[error] at scala.collection.immutable.List.map(List.scala:294)
[error] at sbt.Command$.$anonfun$combine$1(Command.scala:147)
[error] at sbt.Command$.process(Command.scala:180)
[error] at sbt.MainLoop$.processCommand(MainLoop.scala:151)
[error] at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:139)
[error] at sbt.State$$anon$1.runCmd$1(State.scala:246)
[error] at sbt.State$$anon$1.process(State.scala:250)
[error] at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:139)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.MainLoop$.next(MainLoop.scala:139)
[error] at sbt.MainLoop$.run(MainLoop.scala:132)
[error] at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:110)
[error] at sbt.io.Using.apply(Using.scala:22)
[error] at sbt.MainLoop$.runWithNewLog(MainLoop.scala:104)
[error] at sbt.MainLoop$.runAndClearLast(MainLoop.scala:59)
[error] at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:44)
[error] at sbt.MainLoop$.runLogged(MainLoop.scala:35)
[error] at sbt.StandardMain$.runManaged(Main.scala:138)
[error] at sbt.xMain.run(Main.scala:89)
[error] at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error] at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error] at xsbt.boot.Launch$.run(Launch.scala:109)
[error] at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error] at xsbt.boot.Launch$.launch(Launch.scala:117)
[error] at xsbt.boot.Launch$.apply(Launch.scala:18)
[error] at xsbt.boot.Boot$.runImpl(Boot.scala:56)
[error] at xsbt.boot.Boot$.main(Boot.scala:18)
[error] at xsbt.boot.Boot.main(Boot.scala)
[error] Caused by: java.lang.ClassNotFoundException: org.apache.ivy.core.module.id.ModuleRevisionId
[error] at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error] at sbt.Keys$.<init>(Keys.scala:439)
[error] at sbt.Keys$.<clinit>(Keys.scala)
[error] at sbt.Cross$.$anonfun$requireSession$1(Cross.scala:78)
[error] at sbt.Command$.$anonfun$applyEffect$3(Command.scala:142)
[error] at sbt.Command$.$anonfun$combine$2(Command.scala:147)
[error] at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
[error] at scala.collection.immutable.List.foreach(List.scala:388)
[error] at scala.collection.TraversableLike.map(TraversableLike.scala:233)
[error] at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
[error] at scala.collection.immutable.List.map(List.scala:294)
[error] at sbt.Command$.$anonfun$combine$1(Command.scala:147)
[error] at sbt.Command$.process(Command.scala:180)
[error] at sbt.MainLoop$.processCommand(MainLoop.scala:151)
[error] at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:139)
[error] at sbt.State$$anon$1.runCmd$1(State.scala:246)
[error] at sbt.State$$anon$1.process(State.scala:250)
[error] at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:139)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.MainLoop$.next(MainLoop.scala:139)
[error] at sbt.MainLoop$.run(MainLoop.scala:132)
[error] at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:110)
[error] at sbt.io.Using.apply(Using.scala:22)
[error] at sbt.MainLoop$.runWithNewLog(MainLoop.scala:104)
[error] at sbt.MainLoop$.runAndClearLast(MainLoop.scala:59)
[error] at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:44)
[error] at sbt.MainLoop$.runLogged(MainLoop.scala:35)
[error] at sbt.StandardMain$.runManaged(Main.scala:138)
[error] at sbt.xMain.run(Main.scala:89)
[error] at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error] at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error] at xsbt.boot.Launch$.run(Launch.scala:109)
[error] at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error] at xsbt.boot.Launch$.launch(Launch.scala:117)
[error] at xsbt.boot.Launch$.apply(Launch.scala:18)
[error] at xsbt.boot.Boot$.runImpl(Boot.scala:56)
[error] at xsbt.boot.Boot$.main(Boot.scala:18)
[error] at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.NoClassDefFoundError: org/apache/ivy/core/module/id/ModuleRevisionId
I have tried re-installing IntelliJ, adding the apache ivy jars from Apache (and importing them in the build.sbt!), re-packaging, re-assembling, and restarting the IDE. None of which have worked to create a new project.
Any assistance in resolving the error is greatly appreciated. Thank you!
After a considerable amount of trial and error, Google searches, and frustration, I finally found and corrected the issue I was having!
There was an sbt version conflict; I was attempting to use sbt 1.2.7, but when I upgraded to sbt 1.2.8, all has been working as expected. I am able to create new projects via sbt, and build existing projects I've cloned from my company's enterprise GitHub. I hope this can help someone else save hours of work and frustration!

Error while using sbt-native-packager to get the docker support for my sbt project

I have added sbt-native-packager, version 1.3.15 in my plugins.sbt file.
in build.sbt file I am using enablePlugins(DockerPligin).
I am facing the below error when I am running the following command on sbt shell:
sbt>docker:publishLocal
ERROR -->
[error] java.io.IOException: Cannot run program "docker" (in directory "C:\Users\A674634\Desktop\Scala\playProjects\akka-cluster-playground\target\docker\stage"): CreateProcess error=2, The system cannot find the file specified
[error] at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
[error] at scala.sys.process.ProcessBuilderImpl$Simple.run(ProcessBuilderImpl.scala:71)
[error] at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.run(ProcessBuilderImpl.scala:102)
[error] at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$anonfun$runBuffered$1(ProcessBuilderImpl.scala:150)
[error] at scala.runtime.java8.JFunction0$mcI$sp.apply(JFunction0$mcI$sp.java:12)
[error] at com.typesafe.sbt.packager.docker.DockerPlugin$$anon$1.buffer(DockerPlugin.scala:348)
[error] at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.runBuffered(ProcessBuilderImpl.scala:150)
[error] at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang(ProcessBuilderImpl.scala:116)
[error] at com.typesafe.sbt.packager.docker.DockerPlugin$.publishLocalDocker(DockerPlugin.scala:355)
[error] at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$30(DockerPlugin.scala:127)
[error] at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$30$adapted(DockerPlugin.scala:125)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:278)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
[error] at java.lang.ProcessImpl.create(Native Method)
[error] at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
[error] at java.lang.ProcessImpl.start(ProcessImpl.java:137)
[error] at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
[error] at scala.sys.process.ProcessBuilderImpl$Simple.run(ProcessBuilderImpl.scala:71)
[error] at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.run(ProcessBuilderImpl.scala:102)
[error] at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$anonfun$runBuffered$1(ProcessBuilderImpl.scala:150)
[error] at scala.runtime.java8.JFunction0$mcI$sp.apply(JFunction0$mcI$sp.java:12)
[error] at com.typesafe.sbt.packager.docker.DockerPlugin$$anon$1.buffer(DockerPlugin.scala:348)
[error] at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.runBuffered(ProcessBuilderImpl.scala:150)
[error] at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang(ProcessBuilderImpl.scala:116)
[error] at com.typesafe.sbt.packager.docker.DockerPlugin$.publishLocalDocker(DockerPlugin.scala:355)
[error] at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$30(DockerPlugin.scala:127)
[error] at com.typesafe.sbt.packager.docker.DockerPlugin$.$anonfun$projectSettings$30$adapted(DockerPlugin.scala:125)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:278)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[IJ]sbt:akka-cluster-playground> [error] (Docker / publishLocal) java.io.IOException: Cannot run program "docker" (in directory "C:\Users\A674634\Desktop\Scala\playProjects\akka-cluster-playground\target\docker\stage"): CreateProcess error=2, The system cannot find the file specified
I believe you should execute that command in the project root folder. Which folder are you in now?

Scala SBT can't use third-party library

I faced with situation described further. I have a SBT project with traditional catalog structure in which I would like to use this library. Problem occurring when I try to parse the string directly in the program.
import io.github.facaiy.math.expression.MathExp
object SampleApp extends App {
val str = "1 + 5 / 2"
val ex = MathExp.parse(str)
val output = ex.eval(Map[String, Double]())
println(output)
}
I'm getting error with message
sbt:StackOvTest> run
[info] Packaging /home/kost/Prog/MyDev/Scala/StackOvTest/target/scala-2.12/stackovtest_2.12-0.1.0.jar ...
[info] Done packaging.
[info] Running SampleApp
[error] (run-main-1) java.lang.NoClassDefFoundError: scala/util/parsing/combinator/JavaTokenParsers
[error] java.lang.NoClassDefFoundError: scala/util/parsing/combinator/JavaTokenParsers
[error] at java.lang.ClassLoader.defineClass1(Native Method)
[error] at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
[error] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[error] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
[error] at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
[error] at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
[error] at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
[error] at java.security.AccessController.doPrivileged(Native Method)
[error] at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error] at io.github.facaiy.math.expression.compiler.MathExpCompiler$.apply(MathExpCompiler.scala:13)
[error] at io.github.facaiy.math.expression.MathExp$.parse(MathExp.scala:14)
[error] at SampleApp$.delayedEndpoint$SampleApp$1(SampleApp.scala:6)
[error] at SampleApp$delayedInit$body.apply(SampleApp.scala:3)
[error] at scala.Function0.apply$mcV$sp(Function0.scala:34)
[error] at scala.Function0.apply$mcV$sp$(Function0.scala:34)
[error] at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error] at scala.App.$anonfun$main$1$adapted(App.scala:76)
[error] at scala.collection.immutable.List.foreach(List.scala:389)
[error] at scala.App.main(App.scala:76)
[error] at scala.App.main$(App.scala:74)
[error] at SampleApp$.main(SampleApp.scala:3)
[error] at SampleApp.main(SampleApp.scala)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.lang.reflect.Method.invoke(Method.java:498)
[error] at sbt.Run.invokeMain(Run.scala:93)
[error] at sbt.Run.run0(Run.scala:87)
[error] at sbt.Run.execute$1(Run.scala:65)
[error] at sbt.Run.$anonfun$run$4(Run.scala:77)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
[error] at sbt.TrapExit$App.run(TrapExit.scala:252)
[error] at java.lang.Thread.run(Thread.java:748)
[error] Caused by: java.lang.ClassNotFoundException: scala.util.parsing.combinator.JavaTokenParsers
[error] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error] at java.lang.ClassLoader.defineClass1(Native Method)
[error] at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
[error] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[error] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
[error] at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
[error] at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
[error] at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
[error] at java.security.AccessController.doPrivileged(Native Method)
[error] at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error] at io.github.facaiy.math.expression.compiler.MathExpCompiler$.apply(MathExpCompiler.scala:13)
[error] at io.github.facaiy.math.expression.MathExp$.parse(MathExp.scala:14)
[error] at SampleApp$.delayedEndpoint$SampleApp$1(SampleApp.scala:6)
[error] at SampleApp$delayedInit$body.apply(SampleApp.scala:3)
[error] at scala.Function0.apply$mcV$sp(Function0.scala:34)
[error] at scala.Function0.apply$mcV$sp$(Function0.scala:34)
[error] at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error] at scala.App.$anonfun$main$1$adapted(App.scala:76)
[error] at scala.collection.immutable.List.foreach(List.scala:389)
[error] at scala.App.main(App.scala:76)
[error] at scala.App.main$(App.scala:74)
[error] at SampleApp$.main(SampleApp.scala:3)
[error] at SampleApp.main(SampleApp.scala)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.lang.reflect.Method.invoke(Method.java:498)
[error] at sbt.Run.invokeMain(Run.scala:93)
[error] at sbt.Run.run0(Run.scala:87)
[error] at sbt.Run.execute$1(Run.scala:65)
[error] at sbt.Run.$anonfun$run$4(Run.scala:77)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
[error] at sbt.TrapExit$App.run(TrapExit.scala:252)
[error] at java.lang.Thread.run(Thread.java:748)
[error] java.lang.RuntimeException: Nonzero exit code: 1
[error] at sbt.Run$.executeTrapExit(Run.scala:124)
[error] at sbt.Run.run(Run.scala:77)
[error] at sbt.Defaults$.$anonfun$bgRunTask$5(Defaults.scala:1168)
[error] at sbt.Defaults$.$anonfun$bgRunTask$5$adapted(Defaults.scala:1163)
[error] at sbt.internal.BackgroundThreadPool.$anonfun$run$1(DefaultBackgroundJobService.scala:366)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at scala.util.Try$.apply(Try.scala:209)
[error] at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:289)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (Compile / run) Nonzero exit code: 1
[error] Total time: 1 s, completed May 25, 2018 6:13:01 PM
in the case of configuring library via build.sbt, which is as follows:
name := "StackOvTest"
version := "0.1.0"
scalaVersion := "2.12.3"
libraryDependencies += "io.github.facaiy" % "math-expression-parser" % "0.0.1"
Also, I tried to download the appropriate jar-file containing this library and put that archive into the StackOvTest/lib directory, but I'm still getting the same error. I noticed some messages regarding scala parser combinators. Even after adding
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.7"
nothing makes it work. What I am doing wrong?
Looks like the library you're trying to use does not have a compatible Scala 2.12 jar available in public maven repository, see here.
That means that SBT imports the version of that library that expects Scala 2.11 to be used, so it fails when looking up classes that exist there and do not exist in 2.12.
Usually you'd use SBT's %% symbol to fetch the "right" version of a library (the one using the Scala version used in your build):
"io.github.facaiy" %% "math-expression-parser" % "0.0.1"
And indeed in this case, if you use this in a Scala 2.12 project, you'll see that SBT can't find a matching version:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: io.github.facaiy#math-expression-parser_2.12;0.0.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
You don't have any easy solutions here, either use Scala 2.11 in your project, or you'll have to try compiling the sources of that library using Scala 2.12 yourself.

scala import error from Play starter projects

im getting this error when i try to import play 2.6.12 scala starter project in intellij
Scala plugin version:2017.2.13
Intellij version:Ultimate 2017.2.1
https://www.playframework.com/download#starters
Applying State transformations org.jetbrains.sbt.CreateTasks from /Users/qdt624/Library/Application Support/IntelliJIdea2017.2/Scala/launcher/sbt-structure-1.1.jar
[error] java.lang.ClassNotFoundException: org.jetbrains.sbt.CreateTasks$
[error] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error] at java.lang.Class.forName0(Native Method)
[error] at java.lang.Class.forName(Class.java:348)
[error] at sbt.internal.inc.ModuleUtilities$.getObject(ModuleUtilities.scala:20)
[error] at sbt.BasicCommands$.$anonfun$call$5(BasicCommands.scala:203)
[error] at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
[error] at scala.collection.immutable.List.foreach(List.scala:389)
[error] at scala.collection.TraversableLike.map(TraversableLike.scala:234)
[error] at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
[error] at scala.collection.immutable.List.map(List.scala:295)
[error] at sbt.BasicCommands$.$anonfun$call$2(BasicCommands.scala:203)
[error] at sbt.Command$.$anonfun$applyEffect$4(Command.scala:134)
[error] at sbt.Command$.$anonfun$applyEffect$2(Command.scala:130)
[error] at sbt.MainLoop$.processCommand(MainLoop.scala:153)
[error] at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:136)
[error] at sbt.State$$anon$1.runCmd$1(State.scala:242)
[error] at sbt.State$$anon$1.process(State.scala:248)
[error] at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:136)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.MainLoop$.next(MainLoop.scala:136)
[error] at sbt.MainLoop$.run(MainLoop.scala:129)
[error] at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:107)
[error] at sbt.io.Using.apply(Using.scala:22)
[error] at sbt.MainLoop$.runWithNewLog(MainLoop.scala:101)
[error] at sbt.MainLoop$.runAndClearLast(MainLoop.scala:57)
[error] at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:42)
[error] at sbt.MainLoop$.runLogged(MainLoop.scala:34)
[error] at sbt.StandardMain$.runManaged(Main.scala:113)
[error] at sbt.xMain.run(Main.scala:76)
[error] at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error] at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error] at xsbt.boot.Launch$.run(Launch.scala:109)
[error] at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error] at xsbt.boot.Launch$.launch(Launch.scala:117)
[error] at xsbt.boot.Launch$.apply(Launch.scala:18)
[error] at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error] at xsbt.boot.Boot$.main(Boot.scala:17)
[error] at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.ClassNotFoundException: org.jetbrains.sbt.CreateTasks$
[error] Use 'last' for the full log.
[info] shutting down server
[INFO] [04/05/2018 00:47:35.443] [Thread-3] [CoordinatedShutdown(akka://sbt-web)] Starting coordinated shutdown from JVM shutdown hook
I have tried deleting .idea folder and reimporting the project
This problem has been fixed and the fix will be available in the next release of the IntelliJ Scala plugin (2018.1.9+) or right now in the Nightly releases.
As a workaround until then, you can close the project and do a fresh import.