I generated a "package" .jar with dependancies using maven, however when deployed, developer who deployed it have the following error :
10:23:27.604 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver - Resolving exception from handler [public org.springframework.http.ResponseEntity<?> company.Api.convertXmlToPdf(javax.servlet.http.HttpServletRequest)]: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javafx/util/Pair
10:23:27.606 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver - Resolving exception from handler [public org.springframework.http.ResponseEntity<?> company.Api.convertXmlToPdf(javax.servlet.http.HttpServletRequest)]: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javafx/util/Pair
10:23:27.606 [http-nio-8080-exec-1] DEBUG org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Resolving exception from handler [public org.springframework.http.ResponseEntity<?> company.Api.convertXmlToPdf(javax.servlet.http.HttpServletRequest)]: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javafx/util/Pair
Seems like the .jar does not include any dependance with javafx/util/Pair.
I've tried to add the dependancies using maven, adding the lib to the project :
<dependency>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
<version>2.2.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/jfxrt.jar</systemPath>
</dependency>
Does not work.
I've tried to add
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.8.3</version>
<configuration>
<mainClass>hermes.Api</mainClass>
</configuration>
</plugin>
in my build configuration (pom). Does not work either...
When tested in local, it runs well all tests are passed and I've a result. When building the package lifecycle build with maven, the Build is successful. However, when deployed, I've the error mentionned above, like the Pair
class is not found...
Both the developer machine and deployement machine are using
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
(deployement machine is using _172 version...)
EDIT: it is not a solution to the issue, but since the only part of the javafx used in the code is Pair, I've repalced it by AbstractMap.SimpleEntry which is mostly the same as Pair. I hope this might help someone...