小编Xan*_*Vos的帖子

在 docker 容器中启动项目时找不到 io.jsonwebtoken.impl.DefaultJwtBuilder

当在本地启动我的 Quarkus 项目时,mvn quarkus:dev执行使用 JJWT 的函数时没有错误。但是,当我将项目导出到 docker 容器时,它给我一个错误,指出它找不到 DefaultJwtBuilder。

当对我的项目进行 dockerizing 时,我首先执行

./mvnw package -Pnative -Dquarkus.native.container-build=true

如Quarkus 文档中所述,用于在不使用 GraalVM 的情况下创建 Linux 可执行文件。

其次是

docker build -f src/main/docker/Dockerfile.native -t quarkus-quickstart/getting-started .

当使用 Docker Desktop 启动项目时,出现错误。

我的 pom.xml 中的依赖项如下。

<dependency>
  <groupId>io.jsonwebtoken</groupId>
  <artifactId>jjwt-api</artifactId>
  <version>0.11.2</version>
</dependency>
<dependency>
  <groupId>io.jsonwebtoken</groupId>
  <artifactId>jjwt-impl</artifactId>
  <version>0.11.2</version>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>io.jsonwebtoken</groupId>
  <artifactId>jjwt-jackson</artifactId>
  <version>0.11.2</version>
  <scope>runtime</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)

详细的错误信息是

io.jsonwebtoken.lang.UnknownClassException: Unable to load class named [io.jsonwebtoken.impl.DefaultJwtBuilder] from the thread context, current, or system/application ClassLoaders. All heuristics have been exhausted. Class could …
Run Code Online (Sandbox Code Playgroud)

java maven docker jjwt quarkus

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

docker ×1

java ×1

jjwt ×1

maven ×1

quarkus ×1