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.

ClassNotFoundException - Multi Project build

See original GitHub issue

Hi there -

Ran into an odd issue when I was leveraging this in a multi-project build with scalafmtOnCompile := true. If I ran:

sbt "project someProject" clean reload compile

I would receive an exception (noted below).

However, if I ran:

sbt clean and then sbt "project someProject" reload compile

Things worked as intended. Not sure exactly what’s going on here.

[error] java.util.concurrent.ExecutionException: java.lang.ClassNotFoundException: com.lucidchart.scalafmt.impl.ScalafmtFactory [error] at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:502) [error] at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:461) [error] at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:83) [error] at com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:142) [error] at com.google.common.cache.LocalCache$Segment.getAndRecordStats(LocalCache.java:2453) [error] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2417) [error] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2299) [error] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212) [error] at com.google.common.cache.LocalCache.get(LocalCache.java:4147) [error] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4151) [error] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5140) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$.$anonfun$buildSettings$4(ScalafmtCorePlugin.scala:234) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$autoImport$.$anonfun$scalafmtCoreSettings$26(ScalafmtCorePlugin.scala:154) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:44) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42) [error] at sbt.std.Transform$$anon$4.work(System.scala:64) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16) [error] at sbt.Execute.work(Execute.scala:266) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32) [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.lang.ClassNotFoundException: com.lucidchart.scalafmt.impl.ScalafmtFactory [error] at java.net.URLClassLoader.findClass(URLClassLoader.java:381) [error] at com.lucidchart.sbt.scalafmt.BridgeClassLoader.findClass(BridgeClassLoader.scala:11) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$$anon$1.load(ScalafmtCorePlugin.scala:230) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$$anon$1.load(ScalafmtCorePlugin.scala:227) [error] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3708) [error] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2416) [error] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2299) [error] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212) [error] at com.google.common.cache.LocalCache.get(LocalCache.java:4147) [error] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4151) [error] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5140) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$.$anonfun$buildSettings$4(ScalafmtCorePlugin.scala:234) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$autoImport$.$anonfun$scalafmtCoreSettings$26(ScalafmtCorePlugin.scala:154) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:44) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42) [error] at sbt.std.Transform$$anon$4.work(System.scala:64) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16) [error] at sbt.Execute.work(Execute.scala:266) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32) [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] java.util.concurrent.ExecutionException: java.lang.ClassNotFoundException: com.lucidchart.scalafmt.impl.ScalafmtFactory [error] at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:502) [error] at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:481) [error] at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:83) [error] at com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:142) [error] at com.google.common.cache.LocalCache$LoadingValueReference.waitForValue(LocalCache.java:3755) [error] at com.google.common.cache.LocalCache$Segment.waitForLoadingValue(LocalCache.java:2319) [error] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2306) [error] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212) [error] at com.google.common.cache.LocalCache.get(LocalCache.java:4147) [error] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4151) [error] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5140) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$.$anonfun$buildSettings$4(ScalafmtCorePlugin.scala:234) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$autoImport$.$anonfun$scalafmtCoreSettings$26(ScalafmtCorePlugin.scala:154) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:44) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42) [error] at sbt.std.Transform$$anon$4.work(System.scala:64) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16) [error] at sbt.Execute.work(Execute.scala:266) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32) [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.lang.ClassNotFoundException: com.lucidchart.scalafmt.impl.ScalafmtFactory [error] at java.net.URLClassLoader.findClass(URLClassLoader.java:381) [error] at com.lucidchart.sbt.scalafmt.BridgeClassLoader.findClass(BridgeClassLoader.scala:11) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$$anon$1.load(ScalafmtCorePlugin.scala:230) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$$anon$1.load(ScalafmtCorePlugin.scala:227) [error] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3708) [error] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2416) [error] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2299) [error] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212) [error] at com.google.common.cache.LocalCache.get(LocalCache.java:4147) [error] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4151) [error] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5140) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$.$anonfun$buildSettings$4(ScalafmtCorePlugin.scala:234) [error] at com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin$autoImport$.$anonfun$scalafmtCoreSettings$26(ScalafmtCorePlugin.scala:154) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:44) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42) [error] at sbt.std.Transform$$anon$4.work(System.scala:64) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16) [error] at sbt.Execute.work(Execute.scala:266) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32) [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)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:8

github_iconTop GitHub Comments

4reactions
avandendaelecommented, Apr 17, 2019

I ran into the same issue. In my case, the cause was libraryDependencies := instead of libraryDependencies ++=. Hope it may help some of you 😉

1reaction
muuki88commented, Dec 5, 2018

Same here. Error still persists.

  • sbt 1.2.3
  • scalafmt 1.15
  • project matrix 0.1.0
Read more comments on GitHub >

github_iconTop Results From Across the Web

Gradle multi module project java.lang.NoClassDeffFoundError
Yes i run the multi module project with IntelJ without errors. Only if i build it and run the jar i get the...
Read more >
Multiproject build, ClassNotFoundException only after ...
I believe gradle might have some specific cache loaded which prevents it from detecting something.jar preventing it from accessing the class.
Read more >
NoClassDefFoundError with multi-module project - Issue Tracker
I have a multi-module project (only six modules right now). It's a heterogeneous mix with an android app module, a couple android library ......
Read more >
classnotfoundexception in multi project web application-eclipse
First of all, using provided , means that while the library is present at compile time, it will not be added to your...
Read more >
Building applications with Maven - Quarkus
There are a several configuration options that will define what the output of your project build will be. These are provided in application.properties...
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