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.

`ThinJarWrapper` can not run when project indirect dependencies from `nimbus-jose-jwt` which depended by `spring-security-oauth2-client`

See original GitHub issue

It can not run with ThinJarWrapper when project indirect dependencies like this from nimbus-jose-jwt which depended by spring-security-oauth2-client

<dependency>
  <groupId>net.minidev</groupId>
  <artifactId>json-smart</artifactId>
  <version>[1.3.1,2.3]</version>
</dependency>
<dependency>
  <groupId>org.bouncycastle</groupId>
  <artifactId>bcprov-jdk15on</artifactId>
  <version>[1.52,)</version>
  <optional>true</optional>
</dependency>
<dependency>
  <groupId>org.bouncycastle</groupId>
  <artifactId>bcpkix-jdk15on</artifactId>
  <version>[1.52,)</version>
  <optional>true</optional>
</dependency>

dependencies dir resolve like this:

json-smart
  1.3.1
  2.0
  2.0-RC1
  2.0-RC2
  2.0-RC3
  2.1.0
  2.1.1
  2.2
  2.2.1
  2.3
  maven-metadata-alimaven.xml
  maven-metadata-alimaven.xml.sha1
  maven-metadata-central.xml
  maven-metadata-central.xml.sha1
  maven-metadata-spring-snapshots.xml
  maven-metadata-spring-snapshots.xml.sha1
  resolver-status.properties

cause by:

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.boot.loader.wrapper.ThinJarWrapper.launch(ThinJarWrapper.java:139)
	at org.springframework.boot.loader.wrapper.ThinJarWrapper.main(ThinJarWrapper.java:107)
Caused by: java.lang.RuntimeException: Cannot access alimaven (https://maven.aliyun.com/repository/public) in offline mode and the artifact net.minidev:json-smart:jar:2.3 has not been downloaded from it before.
Cannot access alimaven (https://maven.aliyun.com/repository/public) in offline mode and the artifact com.nimbusds:lang-tag:jar:1.5 has not been downloaded from it before.
	at org.springframework.boot.loader.thin.DependencyResolver.dependencies(DependencyResolver.java:222)
	at org.springframework.boot.loader.thin.PathResolver.extract(PathResolver.java:259)
	at org.springframework.boot.loader.thin.PathResolver.resolve(PathResolver.java:105)
	at org.springframework.boot.loader.thin.ThinJarLauncher.getClassPathArchives(ThinJarLauncher.java:343)
	at org.springframework.boot.loader.thin.ThinJarLauncher.getClassPathArchives(ThinJarLauncher.java:330)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:49)
	at org.springframework.boot.loader.thin.ThinJarLauncher.launch(ThinJarLauncher.java:187)
	at org.springframework.boot.loader.thin.ThinJarLauncher.main(ThinJarLauncher.java:140)
	... 6 more

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
dsyercommented, Jan 22, 2021

I raised this with the nimbus team some time ago, and I thought they had fixed it (https://bitbucket.org/connect2id/nimbus-jose-jwt/issues/283/dependency-failing-when-used-with-latest). They shouldn’t be using version ranges in a library like that - it will cause unstable builds for other projects. But I guess we can maybe do something here. Can you make a minimal sample app and paste a link to a github repo here?

0reactions
PC-Chiucommented, Jan 22, 2021

Yeh, I tried to update and combine multiple versions of the JDK, Spring Boot, It only happens Spring Boot version below 2.3.x with spring-boot-starter-oauth2-client, As I use 2.2.10.RELEASE, the oauth2-oidc-sdk version 6.14 using version ranges in the library like this:

<dependency>
	<groupId>net.minidev</groupId>
	<artifactId>json-smart</artifactId>
	<version>[1.3.1,2.3]</version>
</dependency>
<dependency>
	<groupId>com.nimbusds</groupId>
	<artifactId>lang-tag</artifactId>
	<version>[1.4.3,)</version>
</dependency>
<dependency>
	<groupId>com.nimbusds</groupId>
	<artifactId>nimbus-jose-jwt</artifactId>
	<version>[6.0.1,)</version>
</dependency>
image

dependencies dir resolve like this:

json-smart
  1.3.1
  2.0
  2.0-RC1
  2.0-RC2
  2.0-RC3
  2.1.0
  2.1.1
  2.2
  2.2.1
  2.3
  maven-metadata-alimaven.xml
  maven-metadata-alimaven.xml.sha1
  maven-metadata-central.xml
  maven-metadata-central.xml.sha1
  maven-metadata-spring-snapshots.xml
  maven-metadata-spring-snapshots.xml.sha1
  resolver-status.properties

When I upgraded to Spring Boot 2.3/2.4 with spring-boot-starter-oauth2-client, all problem go away.

Thanks a lot, I will upgrade to Spring Boot 2.3 or 2.4 to solve the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

com.nimbusds:nimbus-jose-jwt:5.1 -> net.minidev:json-smart ...
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art ifact with the ...
Read more >
In project 'app' a resolved Google Play services library ...
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art ifact with the issue.
Read more >
"Dependency failing" when used with latest "google-services"
Dependency failing: com.nimbusds:nimbus-jose-jwt:5.1 ... following dependencies are project dependencies that are direct or have transitive ...
Read more >
Spring Projects Experimental spring-boot-thin-launcher Issues
`ThinJarWrapper` can not run when project indirect dependencies from `nimbus-jose-jwt` which depended by `spring-security-oauth2-client`.
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