how to get more debugging for sbt compile error? "MethodHandle not found" - scala

Attempting to sbt compile a branch of my project ENSIME (experiment if you're interested) under Java 6 is giving a bizarre compiler warning:
[info] Compiling 48 Scala sources to /home/fommil/Projects/ensime-server/target/scala-2.11/classes...
[error] Class java.lang.invoke.MethodHandle not found - continuing with a stub.
[error] two errors found
[error] (compile:compile) Compilation failed
[error] Total time: 18 s, completed 03-Sep-2014 22:57:44
It works under Java 7.
Calling last reveals nothing more than the classpath of the compile (this would be equivalent to setting --debug level).
I've removed all the plugins from the project, and the problem still shows.
If I remove all my code - leaving just the build system and dependencies - with some stub scala entry points then there is no problem.
However, I can't exactly bisect my source code file because then it doesn't compile.
When the code is compiled, a grep (including binaries) of MethodHandle doesn't give any hits (although there is a jdk8 file in the tests resources, it is not relevant because the problem appears if it is removed).
It is only one (big) patch that has caused the problem (the previous commit compiles ok).
How can I debug this further in sbt? it doesn't want to give any more info
is this a known problem, or can anyone make an informed guess what is going on?

It turns out that this was caused by pulling in Lucene, which requires Java 7.
A bit of an epic message fail from sbt: there doesn't appear to be any way to get it to output anything sensible.

Related

GWT 2.6.1 compilation error | Unable to find Entrypoint

i'm struggling since a couple of days ago in the attempt to resuscitate an old GWT application (which version is not updatable due to budget reasons).
In particular i've found several issues during the compilation phase.
This is what is blocking me:
Compiling module OctoMonitor Validating units: Ignored 200 units with compilation errors in first pass. Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors. Finding entry point classes [ERROR] Unable to find type 'com.lynxspa.octomonitor.frontend.client.OctoMonitorEntryPoint' [ERROR] Hint: Check that the type name 'com.lynxspa.octomonitor.frontend.client.OctoMonitorEntryPoint' is really what you meant [ERROR] Hint: Check that your classpath includes all required source roots [ERROR] Compiler returned false [WARN] continuing to serve previous version
I've checked my source folder (which is referred in classpath) and my .gwt.xml file is in the parent folder of my EntryPoint class.
source folder:
.gwt.xml file
client folder (containing EntryPoint Class)
I've also checked in project > preference > build path > source that every entry does not have any excluded resource anymore.
Ideas?

How to solve compilation error on inclusion of GWT Material Design

I want to use MaterialCarousel on my project and hence I think I set up my project accordingly. Here is what I am getting while I tried to compile.
Compiling module org.vadiraj.curiosity.GWTCuriosity
Ignored 240 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Tracing compile failure path for type 'gwt.material.design.addins.client.carousel.MaterialCarousel'
[ERROR] Errors in 'gwt/material/design/addins/client/carousel/MaterialCarousel.java'
[ERROR] Line 135: Lambda expressions are allowed only at source level 1.8 or above
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
GWT 2.7 does not support Java 8, and so does not support any recent build of GWT Material Design. GWT 2.8.0 was released in 2016, and the latest version as of this answer is 2.8.2, and generally should be used instead of an earlier 2.8 build.

Intellij 15.0.5 issue with SBT and Scala project

I am trying to set up IntelliJ for my Scala development after hearing how much better it is compared to alternatives. But I can't seem to run anything. The problems I'm facing are as follows:
As soon as the project is created, the console shows SBT failures
My build.sbt file shows red wiggles (compile time errors)
The confusing part is that opening the "SBT Console" view from within the IDE works fine.
The error trace is something along the lines of:
[info] Loading project definition from D:\workspaces\intellij\scala\untitled\project
java.io.IOException: The filename, directory name or volume label syntax is incorrect
[error] (*:update) java.io.IOException: The filename, directory name or volume label syntax is incorrect
Would anyone please know what can cause this? I have tried deleting the project and creating a new one but the problem still persists.
UPDATE
Just had a look at .sbt\boot\update.log and something seems fishy. Is it just me or the sbt.ivy.home is completely borked?
impossible to define new type: class not found: org.apache.ivy.osgi.obr.OBRResolver in [] nor Ivy classloader
impossible to define glob matcher: org.apache.ivy.plugins.matcher.GlobPatternMatcher was not found.
setting 'jline.esc.timeout' to '0'
setting 'sbt.ivy.home' to 'D:\software\installed\sbt\.ivy2 -Divy.home=D:\software\installed\sbt\.ivy2'
setting 'java.runtime.name' to 'Java(TM) SE Runtime Environment'
I have finally managed to hunt down the root cause. The errors were due to rogue environment variables set in my profile related to SBT (specifically SBT_OPTS). Once I deleted all of them and started with a clean slate, things started working on expected.

error while loading <root>, Error accessing .ivy2/cache/org.apache.spark/spark-core_2.11/jars/spark-core_2.11-1.4.0.jar

While following an example to deploy an application in Spark, I keep getting the error below while "compile" in sbt.
[info] Updating {file:/home/sankalp/Desktop/spark/SVMexample/}svmexample...
[info] Resolving com.sun.jersey.jersey-test-framework#jersey-test-framework-grizzl[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /home/sankalp/Desktop/spark/SVMexample/target/scala-2.11/classes...
[error] error while loading <root>, Error accessing /home/sankalp/.ivy2/cache/org.apache.spark/spark-core_2.11/jars/spark-core_2.11-1.4.0.jar
[trace] Stack trace suppressed: run last compile:compileIncremental for the full output.
[error] (compile:compileIncremental) scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.
[error] Total time: 21 s, completed Aug 16, 2015 2:36:53 AM
Can anyone help?
Thanks,
I am no expert, but in my case it helped editing:
project/Versions.scala -> val Spark = "1.4.0" -> "1.4.1".
Although it is actually a mystery to me why it did help :).
EDIT:
On the second thought i've noticed by accident, that the file spark-core_2.11-1.4.0.jar was broken (each time it was downloaded by sbt).
It also helped to replacing .jar with valid one from:
http://mvnrepository.com/artifact/org.apache.spark/spark-core_2.11/1.4.0
I suppose it is somehow connected with spark-cassandra-connector build system or repo from which file is downloaded.
Maybe we should file an issue.
EDIT2:
i found out, that broken .jar comes from (at least in my case):
https://jcenter.bintray.com/org/apache/spark/spark-core_2.11/1.4.0/spark-core_2.11-1.4.0.jar
you can see its origin in: .ivy2/cache/org.apache.spark/spark-core_2.11/ivydata-1.4.0.properties
i did not manage to find out why it comes from jcenter (https://bintray.com/bintray/jcenter). maybe it is somehow connected with adding bintray repo to my linux mint or new version of sbt or datastax uses bintray. i will probably investigate later.
The previous suggestions seemed very specific to a particular use case. My solution is inefficient, brute force, but was effective:
Reinstall IntelliJ completely

Can't build kie-wb-webapp 6.1.x (JBPM)

I need to modify KIE Workbench source and I have two issues that are stopping me from building with Maven 3.2.5, one on Windows and one on Linux.
On Windows 7, I am getting an error that says
[deletia...]SNAPSHOT\uberfire-backend-api-0.4.0-SNAPSHOT-sources.jar,
com.google.gwt.dev.Compiler,-logLevel, INFO, -style, OBF, -war,
c:\kie-wb-webapp\target\kie-wb-webapp-6.1.1-SNAPSHOT, -localWorkers, 1,
-strict, -XfragmentCount, -1, -deploy, c:\kie-wb-webapp\target\gwt-symbols-deploy, -gen,
c:\kie-wb-webapp\target\.generated, org.kie.workbench.FastCompiledKIEWebapp]:
Error while executing process. Cannot run program "c:\development\software\jdk\jdk1.7.0_71\jre\bin\java":
CreateProcess error=206, The filename or extension is too long.
So I looked it up and apparently, this is well known limitation since gwt-maven-plugin creates a command-line that is longer than 8191 chars and this is forbidden. So I gave it a shot on Ubuntu.
On Ubuntu,
I am getting:
[INFO] --- gwt-maven-plugin:2.5.1:compile (gwt-compile) # kie-wb-webapp [ERROR] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[ERROR] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
[INFO] Compiling module org.kie.workbench.FastCompiledKIEWebapp
[INFO] Validating units:
[INFO] [ERROR] Errors in 'jar:file:/home/rich/.m2/repository/com/google/guava/guava-gwt/14.0.1/guava-gwt-14.0.1.jar!/com/google/common/primitives/Booleans.java'
[INFO] [ERROR] Line 29: The import java.util.BitSet cannot be resolved
[INFO] [ERROR] Aborting compile due to errors in some input files
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE*
It's really important that I find a workaround to 1 or both of these issues (my guess is that if I clear the command-line issue on Windows, I'll just run into the guava issue again). Also, unless it's absolutely necessary, I can't upgrade to 6.2.x, because this would cause a lot of work for my project.
Has anyone run into this?
If you don't need Java 8 support, you may be able to solve the problem by using an earlier version of the JDK. I believe that you do this by setting JAVA_HOME for your Maven run. You can download a JDK 7 here.
You could also build Guava yourself from HEAD, as the problem has been fixed there but not included in a release. Or you could wait for a 19.0-rc1, which we hope to have out soon.