IronPdfEngine Connection Failure from a Fat JAR
When your IronPDF for Java application is packaged as a fat (uber) JAR, the client cannot connect to the internal rendering engine. IronPdfEngine starts and listens on the correct port, but the Java client makes 20 connection attempts and fails every time.
Failed to connect to IronPdfEngine after 20 attempts
The failure comes from merging every dependency into a single self-assembled shaded (uber) JAR — for example with the Maven Shade or Gradle Shadow plugin. Overlapping resource files from the merged dependencies stop the Java client from reaching the IronPdfEngine subprocess: the engine launches and opens the expected port, but the client can never connect and gives up after 20 retries. Keeping each dependency as its own file on the classpath avoids the conflict.
Solution
Build the project normally, copy its dependencies into a folder, then launch the app by pointing Java at those files directly instead of using java -jar.
1. Build the Project
mvn clean package
mvn clean package
2. Copy Runtime Dependencies
Place every library into target/libs as separate JARs, which is what the classpath approach needs:
mvn dependency:copy-dependencies -DoutputDirectory=target/libs
mvn dependency:copy-dependencies -DoutputDirectory=target/libs
3. Run from the Classpath
Launch the app against the exploded classpath rather than the fat JAR. Replace com.example.Main with your actual main class.
Windows:
java --add-opens java.base/java.nio=ALL-UNNAMED -cp "target/classes;target/libs/*" com.example.Main
java --add-opens java.base/java.nio=ALL-UNNAMED -cp "target/classes;target/libs/*" com.example.Main
Linux / macOS:
java --add-opens java.base/java.nio=ALL-UNNAMED -cp "target/classes:target/libs/*" com.example.Main
java --add-opens java.base/java.nio=ALL-UNNAMED -cp "target/classes:target/libs/*" com.example.Main
The only difference between the two commands is the classpath separator: a semicolon (;) on Windows, a colon (:) on Linux and macOS.
Debug Tips
- What does not work: running from the fat JAR launches
IronPdfEnginesuccessfully, but the Java client never connects. --add-opensalone is not enough: adding the JVM flag while still running from a fat JAR does not fix the connection failure. The flag matters only alongside the classpath launch above.- PDF/A version strings: if your code passes a PDF/A version as a string argument, use
PdfA2a, notPdfAVersions.PdfA2a.


