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.

Runtime error when using Shapeless > 2.3.3

See original GitHub issue

I am getting a strange error at runtime, which I could not reproduce:

java.lang.NoClassDefFoundError: shapeless/ops/hlist$ZipWithKeys$$anon$158
[info]   at com.byond.infinity.defs$ProgramResponse$anon$lazy$macro$25$1.inst$macro$1$lzycompute(defs.scala:93)
[info]   at com.byond.infinity.defs$ProgramResponse$anon$lazy$macro$25$1.inst$macro$1(defs.scala:93)
[info]   at com.byond.infinity.defs$ProgramResponse$.<clinit>(defs.scala:93)

Here is the line:

case class ProgramResponse(
    id: UUID,
    name: String,
    description: String,
    program: String,
    dependencies: Dependencies,
    created: Instant,
    updated: Instant,
    createdBy: Option[String],
    updatedBy: Option[String]
  )

  object ProgramResponse {
    implicit val decoder: Decoder[ProgramResponse] = deriveDecoder
    implicit val encoder: Encoder[ProgramResponse] = deriveEncoder
  }

final case class Dependencies(value: List[String]) extends AnyVal
object Dependencies {
    implicit val decoder: Decoder[Dependencies] = Decoder[List[String]].map(Dependencies.apply)
    implicit val encoder: Encoder[Dependencies] = Encoder[List[String]].contramap(_.value)

  }

This only happens when I upgraded a dependency that used shapeless 2.3.5 (2.3.4 gives the same results).

Scala version: 2.13.5 Circe version: 0.13.0

Please help

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
armanbilgecommented, May 17, 2021

Now that my project compiles on shapeless 2.3.7, I am getting a similar exception.

Exception in thread "main" java.lang.NoSuchMethodError: 'shapeless.DefaultSymbolicLabelling shapeless.DefaultSymbolicLabelling$.instance(shapeless.HList)'
	at s.o.app.Server$anon$importedDecoder$macro$375$1.inst$macro$1$lzycompute(Server.scala:48)
	at s.o.app.Server$anon$importedDecoder$macro$375$1.inst$macro$1(Server.scala:48)
	at s.o.app.Server$.main(Server.scala:48)
	at s.o.app.Server.main(Server.scala)

~I’ll try and put together a working example.~

UPDATE: my bad, all I needed was a clean rebuild.

0reactions
soujiro32167commented, May 18, 2021

tried with 2.3.7, still same result; and, sadly, I cannot reproduce on Scastie… N00b question: Is sbt clean test enough to do a clean rebuild?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shapeless error while trying trying to use PureConfig and ...
This error is because of conflicting shapeless library versions. Spark 3.1.2 ships with shapeless 2.3.3 whereas both these packages need shapeless 2.3.7.
Read more >
milessabin/shapeless - Gitter
When I'm trying to start a spark-shell(spark 3.0.1 ) with a custom jar I'm getting this error java.lang.NoSuchMethodError: 'shapeless.
Read more >
shapeless-2.3.3 released! - Miles Sabin
If so then updating your shapeless dependency to 2.3. 3 should resolve the issue.
Read more >
Ammonite
Version 2.5.5. Ammonite lets you use the Scala language for scripting purposes: in the REPL or as scripts. ... com.chuusai::shapeless:2.3.3`, shapeless.
Read more >
How to create a small json lib using antlr and shapeless
In this article i will show how antlr4 and shapeless can be used to create ... ErrorNode): Json = throw new RuntimeException("Parse error") ......
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