0

I have cloned the spark-cassandra-connector in order to fix one of its unresolved issues. Prior to any code changes, I'm trying to build locally, as explained in the developer guide. But whichever SBT command that I run, fails with an unresolved dependency errors:

[error] sbt.librarymanagement.ResolveException: unresolved dependency: org.apache.logging.log4j#log4j-api;2.11.1: org.apache#apache;18!apache.pom(pom.original) origin location must be absolute: file:/Users/gcatz/.m2/repository/org/apache/apache/18/apache-18.pom
[error] unresolved dependency: org.apache.logging.log4j#log4j-core;2.11.1: org.apache#apache;18!apache.pom(pom.original) origin location must be absolute: file:/Users/gcatz/.m2/repository/org/apache/apache/18/apache-18.pom
[error] unresolved dependency: com.squareup.okhttp3#okhttp;3.7.0: org.sonatype.oss#oss-parent;7!oss-parent.pom(pom.original) origin location must be absolute: file:/Users/gcatz/.m2/repository/org/sonatype/oss/oss-parent/7/oss-parent-7.pom
...

I'm using a mac (Monterey), Java 1.8.

I wrote some comments regarding the issue in the original thread on DataStax community, but have been asked to open a new thread here instead.

Have you guys ever encountered such an issue with SBT?

Gideon Catz
  • 61
  • 1
  • 5
  • According to https://stackoverflow.com/questions/62517800/how-to-fix-origin-location-must-be-absolute-error-in-sbt-project-with-spark-2 https://stackoverflow.com/questions/45882265/sbt-new-runtimeexception https://stackoverflow.com/questions/44111648/origin-location-must-be-absolute-error-in-building-a-sbt-project-intellij this can be a broken cache. Try to delete the cache so that it will be downloaded from the scratch – Dmytro Mitin Dec 06 '22 at 20:58
  • Also try fresher sbt. Current sbt is 1.8.0 while the bundled is 1.3.3 (see directory `sbt`, and the project is built with 1.2.8, see `project/build.properties`) https://www.scala-sbt.org/download.html – Dmytro Mitin Dec 06 '22 at 21:03
  • If the issue remains please provide the full log of `sbt clean compile`. – Dmytro Mitin Dec 06 '22 at 21:03
  • Thanks @DmytroMitin, I have removed `~/.ivy2/cache` folder and ran `sbt/sbt clean compile`. It has successfully downloaded a bunch of dependencies without complaining. After that, however, the following error has occurred: `error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken (class java.lang.NullPointerException/Cannot invoke "scala.tools.nsc.Global$Run.typerPhase()" because the return value of "scala.tools.nsc.Global.currentRun()" is null) [error] java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI` – Gideon Catz Dec 07 '22 at 07:33
  • After that, I've downloaded sbt-launch 1.8.0 from (here)[https://jar-download.com/artifacts/org.scala-sbt/sbt-launch/1.8.0]. I placed that jar next to the existing 1.3.3, changed SBT_VERSION in the sbt script. and ran `sbt/sbt clean compile` again. The result appears to be the same. – Gideon Catz Dec 07 '22 at 07:40
  • `Launching sbt from sbt/sbt-launch-1.8.0.jar OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0 ... error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken (class java.lang.NullPointerException/Cannot invoke "scala.tools.nsc.Global$Run.typerPhase()" because the return value of "scala.tools.nsc.Global.currentRun()" is null) [error] java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI [error] at java.base/jdk.internal.jrtfs.JrtPath.toUri(JrtPath.java:175) ...` – Gideon Catz Dec 07 '22 at 07:44
  • There are different versions of sbt. Sbt is a shell script running [sbt-launch.jar](https://mvnrepository.com/artifact/org.scala-sbt/sbt-launch) (based on [launcher.jar](https://mvnrepository.com/artifact/org.scala-sbt/launcher)), which downloads and runs the rest of sbt https://stackoverflow.com/questions/74440324/sbt-gives-java-lang-nullpointerexception-when-trying-to-run-spark There is the version of script (currently 1.8.0), version of `sbt-launch.jar` (1.8.0, based on `launcher` 1.4.1), actual version of sbt used for project building (specified in `project/build.properties`). – Dmytro Mitin Dec 07 '22 at 12:16
  • You seem to mix older script with fresher launcher. Although this should work I would try to download sbt from https://www.scala-sbt.org/download.html, so using fresh `bin/sbt` script with fresh `bin/sbt-launch.jar` running fresh the rest of `sbt` and try to specify fresh sbt in `project/build.properties`. – Dmytro Mitin Dec 07 '22 at 12:16
  • Also `/modules/java.base/...` looks like you're using Java 9 (or fresher), not 8. Please execute `which java`, `java -version` to be sure what java is installed in the system and used. – Dmytro Mitin Dec 07 '22 at 12:18
  • 1
    Many thanks @DmytroMitin! It appears like the script was taking the wrong version of java after all. After I put the path to the java 8 installation as the first one in my $PATH, the sbt scripts stopped failing. – Gideon Catz Dec 07 '22 at 15:10
  • Great! Congrats. – Dmytro Mitin Dec 07 '22 at 15:12

1 Answers1

0

It seems the issue was in broken cache (~/.m2, ~/.ivy2). Removing the cache helped with origin location must be absolute

How to fix "origin location must be absolute" error in sbt project (with Spark 2.4.5 and DeltaLake 0.6.1)?

sbt new RuntimeException

Origin location must be absolute error in building a SBT project, IntelliJ

Also wrong version of Java was selected (Java 9 instead of 8). Correcting $PATH helped with error while loading String, class file '/modules/java.base/java/lang/String.class' is broken (class java.lang.NullPointerException/Cannot invoke "scala.tools.nsc.Global$Run.typerPhase()" because the return value of "scala.tools.nsc.Global.currentRun()" is null) [error] java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI [error] at java.base/jdk.internal.jrtfs.JrtPath.toUri(JrtPath.java:175)

Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66