这不是我的第一个基于模块的项目,但我对这一切是如何工作的,我相信这是我的问题。拼图计划现在对我来说就像烟雾和镜子。如有任何协助,将不胜感激。
下面是异常发生的地方:
result.payload().ifPresent(payloadString -> {
final var jsonReader = Json.createReader(new StringReader(payloadString));
final var jsonObject = jsonReader.readObject(); <== error here
jsonReader.close();
我的module-info.java
module com.mymodule.pocclient {
requires javafx.controls;
requires javafx.fxml;
requires jcip.annotations;
requires java.logging;
requires org.controlsfx.controls;
requires com.dlsc.formsfx;
requires jakarta.json.bind;
requires jakarta.json;
requires org.eclipse.yasson;
requires org.eclipse.parsson;
requires static lombok;
requires jjwt.api;
requires com.mymodule.cryptography;
opens com.mymodule.pocclient.controllers to javafx.fxml;
opens com.mymodule.pocclient.model to javafx.base, org.eclipse.yasson;
opens com.mymodule.pocclient to javafx.fxml;
opens com.mymodule.pocclient.network to org.eclipse.parsson;
exports com.mymodule.pocclient;
exports com.mymodule.pocclient.controllers;
}
例外情况:
java.lang.NoClassDefFoundError: jakarta/json/JsonConfig$KeyStrategy
at org.eclipse.parsson@1.1.0/org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy.<clinit>(JsonObjectBuilderImpl.java:373)
at org.eclipse.parsson@1.1.0/org.eclipse.parsson.JsonObjectBuilderImpl.<init>(JsonObjectBuilderImpl.java:59)
at org.eclipse.parsson@1.1.0/org.eclipse.parsson.JsonParserImpl.getObject(JsonParserImpl.java:171)
at org.eclipse.parsson@1.1.0/org.eclipse.parsson.JsonReaderImpl.readObject(JsonReaderImpl.java:103)
at com.lifelenz.poclifelenzclient/com.mymodule.pocclient.controllers.LoginController.lambda$processAuthenticatedUser$0(LoginController.java:121)
从我的pom文件依赖(不知道有多少是相关的)
<dependency>
<groupId>com.lifelenz.jmsa</groupId>
<artifactId>cryptography</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.3.0.Final</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<version>3.0.0-RC2</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.5</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId> <!-- or jjwt-gson if Gson is preferred -->
<version>0.11.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>com.dlsc.formsfx</groupId>
<artifactId>formsfx-core</artifactId>
<version>11.5.0</version>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>18.0.1</version>
</dependency>
2条答案
按热度按时间mwg9r5ms1#
删除以下依赖项解决了问题。
我猜是和帕森的冲突。
ycggw6v22#
我不得不将
jakarta.json-api
添加到更高或相等的2.1.0
版本中(JsonConfig
类是在jakarta jsonb实现的2.1
版本中引入的)。