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.

java.lang.NoClassDefFoundError: io/jsonwebtoken/Jwts

See original GitHub issue

java.lang.NoClassDefFoundError: io/jsonwebtoken/Jwts

When I run locally with mvn spring-boot:run , there’s no problem.

But when I package my application into a fully executable jar with mvn clean installand then run the jar as a systemd service, I get this error seen above.

It comes from this line:

String user = Jwts.parser()...

Some information: Version of this package that the issue occurs: 0.11.1 Platform: Ubuntu 18.04 Related dependency in maven pom.xml:

<dependency>
    <groupId>io.jsonwebtoken</groupId>
    <artifactId>jjwt-impl</artifactId>
    <version>0.11.1</version>
</dependency>

Also I checked the generated jar file, the dependency jjwt-impl.0.11.1 is there:

BOOT-INF.lib.jjwt-impl-0.11.1.jar BOOT-INF.lib.jjwt-api-0.11.1.jar BOOT-INF.lib.jjwt-jackson-0.11.1.jar

Don’t know how to solve this. I thought just adding the io.jsonwebtoken to maven dependency would solve all things related to classpath etc…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
VilleMiekkojacommented, Jun 6, 2020

At the moment no, but if I am unable to fix this soon, I’ll create a one.

I tried updating maven package spring-boot-starter-parent which handles packaging to 1.5.2.RELEASE -> 1.5.22.RELEASE, and now Im getting a different error:

java.lang.NoClassDefFoundError: org/apache/tomcat/util/http/parser/AcceptLanguage

0reactions
lhazlewoodcommented, Jun 6, 2020

Glad to hear you got it working!

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NoClassDefFoundError: io/jsonwebtoken/Jwts
When i use this code using java main() method, its works perfectly but when i call from servlet to that class, the method...
Read more >
Error 500: java.lang.NoClassDefFoundError: psdi.webclient ...
This is the error i am getting when starting up maximo. All the services are up but i cannot connect to the database....
Read more >
io/jsonwebtoken/Jwts - maven spring-boot-Springboot
Coding example for the question java.lang.NoClassDefFoundError: io/jsonwebtoken/Jwts - maven spring-boot-Springboot.
Read more >
Could Not Initialize Class Io.Jsonwebtoken ... - ADocLib
NoClassDefFoundError : io/jsonwebtoken/Jwts. When I run locally with mvn spring-boot:run , there's no problem. 43. Ville Miekk-oja : java.lang.
Read more >
Article: Java.lang.NoClassDefFoundError - Boomi Community
Java.lang.NoClassDefFoundError · Description. This error code typically occurs when a molecule or cloud JVM cannot access a jar file on its fileshare at...
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