1

This is not my first module based project but I am very shakey on how it all works, I am sure this is my issue. Project Jigsaw seems like smoke and mirrors to me at the moment. Any assistance would be greatly appreciated.

Here is where the exception happens:

result.payload().ifPresent(payloadString -> { final var jsonReader = Json.createReader(new StringReader(payloadString)); final var jsonObject = jsonReader.readObject(); <== error here jsonReader.close(); 

My 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; } 

The exception:

java.lang.NoClassDefFoundError: jakarta/json/JsonConfig$KeyStrategy at [email protected]/org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy.<clinit>(JsonObjectBuilderImpl.java:373) at [email protected]/org.eclipse.parsson.JsonObjectBuilderImpl.<init>(JsonObjectBuilderImpl.java:59) at [email protected]/org.eclipse.parsson.JsonParserImpl.getObject(JsonParserImpl.java:171) at [email protected]/org.eclipse.parsson.JsonReaderImpl.readObject(JsonReaderImpl.java:103) at com.lifelenz.poclifelenzclient/com.mymodule.pocclient.controllers.LoginController.lambda$processAuthenticatedUser$0(LoginController.java:121) 

dependencies from my pom file (not sure how much is relevant)

<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> 
3
  • Have you tried it without all this module stuff? Commented May 22, 2022 at 11:04
  • 1
    This is the direction that Java wants us to go, so it is my intention to resolve this not give up. Commented May 22, 2022 at 11:54
  • 1
    I did not say that you should give up but it is good practice to split up problems into smaller ones that you can then investigate step by step. In your case the problem may be a missing maven dependency and/or a missing module dependency. So, if you can exclude the first you can then concentrate on the second. Commented May 22, 2022 at 11:59

2 Answers 2

3

I had to add the jakarta.json-api in a version higher or equal 2.1.0 (JsonConfig class was introduced in version 2.1 of jakarta jsonb implementation)

<dependency> <groupId>jakarta.json</groupId> <artifactId>jakarta.json-api</artifactId> <version>2.1.2</version> </dependency> 
Sign up to request clarification or add additional context in comments.

Comments

1

Removing the following dependency resolved the issue.

 <dependency> <groupId>org.glassfish</groupId> <artifactId>jakarta.json</artifactId> <version>2.0.1</version> </dependency> 

I assume it was clashing with parsson.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.