question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AssertionError: expected protocol to be 'file' or empty in URI

See original GitHub issue

While running bloop compile with v1.4.1 I got the following error that I have never seen before 🤔

java.lang.RuntimeException: java.lang.AssertionError: assertion failed: Expected protocol to be 'file' or empty in URI jar:file:/Users/lgeirsson/workspace/bsp-projects/foobar/.bloop/bloop-jars/finatra.http.src.main.scala.com.twitter.finatra.http.response.response.jar
!/com/twitter/finatra/http/response/ResponseBuilder.class
	at com.sun.tools.javac.main.Main.compile(Main.java:559)
	at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
	at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
	at bloop.CompilerCache$BloopJavaCompiler.run(CompilerCache.scala:271)
	at sbt.internal.inc.javac.AnalyzingJavaCompiler.$anonfun$compile$11(AnalyzingJavaCompiler.scala:156)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.javac.AnalyzingJavaCompiler.timed(AnalyzingJavaCompiler.scala:234)
	at sbt.internal.inc.javac.AnalyzingJavaCompiler.compile(AnalyzingJavaCompiler.scala:146)
	at sbt.internal.inc.javac.AnalyzingJavaCompiler.compile(AnalyzingJavaCompiler.scala:73)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$9(BloopHighLevelCompiler.scala:179)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:72)
	at bloop.tracing.BraveTracer.traceInternal(BraveTracer.scala:64)
	at bloop.tracing.BraveTracer.trace(BraveTracer.scala:38)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:71)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$8(BloopHighLevelCompiler.scala:172)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at monix.eval.internal.TaskRunLoop$.monix$eval$internal$TaskRunLoop$$loop$1(TaskRunLoop.scala:187)
	at monix.eval.internal.TaskRunLoop$RestartCallback$1.onSuccess(TaskRunLoop.scala:119)
	at monix.eval.Task$.$anonfun$forkedUnit$2(Task.scala:1463)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.AssertionError: assertion failed: Expected protocol to be 'file' or empty in URI jar:file:/Users/lgeirsson/workspace/bsp-projects/foobar/.bloop/bloop-jars/finatra.http.src.main.scala.com.twitter.finatra.http.response.response.jar!/com/twitter/finatra/http/response/ResponseBuilder.class
	at scala.Predef$.assert(Predef.scala:223)
	at sbt.io.IO$.uriToFile(IO.scala:150)
	at sbt.io.IO$.toFile(IO.scala:123)
	at sbt.internal.inc.javac.DiagnosticsReporter$PositionImpl$.$anonfun$apply$1(DiagnosticsReporter.scala:107)
	at scala.Option.map(Option.scala:230)
	at sbt.internal.inc.javac.DiagnosticsReporter$PositionImpl$.apply(DiagnosticsReporter.scala:107)
	at sbt.internal.inc.javac.DiagnosticsReporter.report(DiagnosticsReporter.scala:50)
	at com.sun.tools.javac.api.ClientCodeWrapper$WrappedDiagnosticListener.report(ClientCodeWrapper.java:593)
	at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:616)
	at com.sun.tools.javac.util.Log$DefaultDiagnosticHandler.report(Log.java:591)
	at com.sun.tools.javac.util.Log$DeferredDiagnosticHandler.reportDeferredDiagnostics(Log.java:161)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.showDiagnostics(JavacProcessingEnvironment.java:1064)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1191)
	at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
	at com.sun.tools.javac.main.Main.compile(Main.java:523)
	... 24 more

I’m still working on minimizing a reproduction but wanted to start by opening a ticket with the stack trace. Any idea what might be causing this issue?

The jar from the exception is here response.jar (rename to response.jar to make it work). It’s a java codebase where the error happens.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Duhemmcommented, Jun 18, 2020

I cherry-picked the relevant parts of the commit I linked above to scalacenter/zinc#13.

I built it manually, and can confirm that this fixes our issue 🎉

1reaction
Duhemmcommented, Jun 17, 2020

This is caused by javac reporting the following warning:

Cannot find annotation method 'value()' in type 'com.company.MyAnnotation': class file for com.company.MyAnnotation not found

The error is indeed attached to a classfile inside a JAR on my classpath. This is fixed in upstream Zinc in https://github.com/sbt/zinc/commit/db028c338af528876e24fc8d6214e24f7d19d707#diff-8c308205e560ef07b6e6b8e73e438e5dR109-R123

Read more comments on GitHub >

github_iconTop Results From Across the Web

I'm receiving an java.lang.AssertionError in a test using REST ...
The problem is Rest-Assured automatically add charset=utf-8 , that may be returned back in response. You can assert them as follow: Assert.
Read more >
[#SPARK-18496] java.lang.AssertionError: assertion failed
I am getting this error when i store the estimates from Julia output to a DF and then i do df.cache() py4j.protocol.Py4JJavaError: An...
Read more >
Mocha test stops without further execution of other test cases if ...
AssertionError : expected 'Error' to equal 'Success'. But I want it to continue further executing below test and also other in many files...
Read more >
Error Messages | Cypress Documentation
This message means that Cypress was unable to find tests in the specified file. You'll likely get this message if you have an...
Read more >
sbt/sbt - Gitter
sbt exit code alway is 0, no matter whether tests fail or not. this happens when test is ... Before I the outer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found