Kafka scalaConsole has ClassNotFoundException - scala

When starting scalaConsole from gradlew, the main Scala runner is not found on the classpath:
05:21:45/kafka-0.8.1-src:43 $./gradlew scalaConsole
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
Building project 'core' with Scala version 2.8.0
Building project 'perf' with Scala version 2.8.0
:core:compileJava UP-TO-DATE
:core:compileScala UP-TO-DATE
:core:processResources UP-TO-DATE
:core:classes UP-TO-DATE
:core:scalaConsole
Exception in thread "main" java.lang.NoClassDefFoundError: scala/tools/nsc/MainGenericRunner
Caused by: java.lang.ClassNotFoundException: scala.tools.nsc.MainGenericRunner
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
:core:scalaConsole FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':core:scalaConsole'.
> Process 'command '/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED

From http://sethrylan.org/2013/07/02/scala-gradle-scalaconsole.html, try adding the compiler to your runtime dependencies.
dependencies {
runtime "org.scala-lang:scala-compiler:2.10.4"
compile "org.scala-lang:scala-library:2.10.4"
}
The same article suggests starting it with Gradle's -q option:
$ gradle scalaConsole -q
Note that I don't think this is a very good solution since you really don't want to make your code dependent on the compiler, but at least it's a workaround.

Related

Plugins cloud_firestore and firebase_auth are preventing syncing with android Emulator

i am trying to implement the firebase database in my project in order to save data later but every time i add
cloud_firestore:
firebase_auth:
to my pubspec.yaml file no matter what version i get all sorts of errors
e.g. :
Plugin project :cloud_firestore_web not found. Please update settings.gradle.
Plugin project :firebase_core_web not found. Please update settings.gradle.
Plugin project :firebase_auth_web not found. Please update settings.gradle.'
(which leads me to a new question. Why does the error message call it firbase_auth_WEB. I mean where does the word "web" come from and why)
Note: C:\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.13.7\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.13.7\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.15.5+3\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
D8: Cannot fit requested classes in a single dex file (# methods: 95560 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:132)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:119)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:432)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:242)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:57)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:67)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:63)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:63)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:60)
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:200)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)``
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: null
at Version.fakeStackEntry(Version_2.1.62.java:0)
at com.android.tools.r8.utils.Y.a(SourceFile:78)
at com.android.tools.r8.D8.run(D8.java:11)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:117)
... 36 more
Caused by: com.android.tools.r8.utils.b: Cannot fit requested classes in a single dex file (# methods: 95560 > 65536)
at com.android.tools.r8.utils.T0.error(SourceFile:1)
at com.android.tools.r8.utils.T0.a(SourceFile:2)
at com.android.tools.r8.dex.P.a(SourceFile:740)
at com.android.tools.r8.dex.P$h.a(SourceFile:7)
at com.android.tools.r8.dex.b.a(SourceFile:14)
at com.android.tools.r8.dex.b.b(SourceFile:25)
at com.android.tools.r8.D8.d(D8.java:133)
at com.android.tools.r8.D8.b(D8.java:1)
at com.android.tools.r8.utils.Y.a(SourceFile:36)
... 38 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 58s
[!] The shrinker may have failed to optimize the Java bytecode.
To disable the shrinker, pass the `--no-shrink` flag to this command.
To learn more, see: https://developer.android.com/studio/build/shrink-code
Exception: Gradle task assembleDebug failed with exit code 1
Does anywone know how to solve this ?
And are there discord servers for showing fellow coders said problems?
Thanks in advance
D8: Cannot fit requested classes in a single dex file
means that you need to raise your minSdkVersion to at least 21 or otherwise enable MultiDex. This is also explained in the Firebase Android installation documentation.
If the problem still occur, please share a snippet of your pubspec.yaml that contains your declaration of the dependencies.

sbt test task is failing in IDE

I am trying to run the test sbt task using my IDE but I am getting the following error:
Compiling 12 Scala sources to
/home/user/newPrs/projectname/processing/target/scala-2.11/test-classes...
[trace] Stack trace suppressed: run last test:copyResources for the full output.
[error] (test:copyResources) java.io.FileNotFoundException: /home/user/newPrs/projectname/processing/target/scala-2.11/test-classes/rawData/data.parquet (Permission denied)
Any idea how to fix this please?
Thanks a lot

Sbt cross release: java.lang.IllegalStateException: Ivy file not found in cache for

I'm trying to cross publish a library for scala 2.12/2.11 using sbt-release, and getting a java.lang.IllegalStateException: Ivy file not found in cache exception in the 2.11 part (things continue for 2.12 and go all the way to being uploaded to sonatype)
[trace] Stack trace suppressed: run last monadic-rxJS/*:deliver for the full output.
java.lang.IllegalStateException: Ivy file not found in cache for in.nvilla#monadic-rx-cats_sjs0.6_2.11;0.2.0!
Here is the complete sbt output, and this is the current state of the build.sbt.

Trying to run Scala test, getting java.lang.ClassNotFoundException: org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner

I have a Gradle project in IntelliJ IDEA 2016.2. Everytime I run the Scala tests in the project, I get the following exception:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:48)
Caused by: java.lang.ClassNotFoundException: org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:123)
... 5 more
I checked the versions of the dependencies and I have added the Scala SDK to the project module as well. I also added the Scala plugin to the Gradle file and installed the Scala plugin in IntelliJ IDEA. Also, the tests run without an error on my colleague's computer so we have no idea what the error could be.
Found the cause: I have an accentuated letter in my user directory's name and IDEA is always trying to use some file from AppData under that directory. I have already changed the idea.properties file, but it has no effect regarding that file.
A possible workaround is using gradle (or maven/sbt/etc.). In my case, I use gradle, I just add #RunWith(classOf[JUnitRunner]) to the scala class I want to test, then execute gradle's test task.
For me the solution of command line length limitation was crucial. Idea offers about 3 ways of how to overcome too long command. Choose another and check.
It's in run configurations.

sphinx4 5alpha master package gradle Build fail in netbeans 8.0

I downloaded the sphinx4-master from github. when I try to build it gives me a run time exception at LiveRecognizerTest.java:53. and build fail.
here is my console output,
Executing: gradle build
Arguments: [-c, E:\project temp dev\sphinx4-master\settings.gradle]
:sphinx4-data:compileJava UP-TO-DATE
:sphinx4-data:processResources
:sphinx4-data:classes
:sphinx4-data:jar
:sphinx4-core:compileJava
:sphinx4-core:processResources
:sphinx4-core:classes
:sphinx4-core:jar
:sphinx4-data:javadoc UP-TO-DATE
:sphinx4-core:javadoc
:sphinx4-core:javadocJar
:sphinx4-core:packageSources
:sphinx4-core:assemble
:sphinx4-core:compileTestJava
:sphinx4-core:processTestResources
:sphinx4-core:testClasses
:sphinx4-core:test
Gradle suite > Gradle test > edu.cmu.sphinx.api.LiveRecognizerTest.testGram FAILED
java.lang.RuntimeException at LiveRecognizerTest.java:53
Caused by: java.net.ConnectException at LiveRecognizerTest.java:53
107 tests completed, 1 failed
:sphinx4-core:test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sphinx4-core:test'.
> There were failing tests. See the report at: file:///E:/project%20temp%20dev/sphinx4-master/sphinx4-core/build/reports/tests/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4 mins 36.326 secs
Build failure (see the Notifications window for stacktrace): gradle build
I previously got an problem with building my application. here the link for problem. can someone help me to fix this two errors.