IRONSOFTWAREHOME

IronPdfEngine Connection Failure from a Fat JAR

Curtis Chau
Curtis Chau
Updated: July 3, 2026

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
Text

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
SHELL

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
SHELL

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
SHELL

Linux / macOS:

java --add-opens java.base/java.nio=ALL-UNNAMED -cp "target/classes:target/libs/*" com.example.Main
SHELL

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 IronPdfEngine successfully, but the Java client never connects.
  • --add-opens alone 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, not PdfAVersions.PdfA2a.
Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Version:2026.8just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required
Java Maven Library for PDF
Install with Maven

Version: 2026.8

<dependency>
   <groupId>com.ironsoftware</groupId>
   <artifactId>ironpdf</artifactId>
   <version>2026.8.2</version>
</dependency>
https://central.sonatype.com/artifact/com.ironsoftware/ironpdf/2026.8.2
or
Java PDF JAR
Download JAR

Version: 2026.8

Download Now

Manually install into your project

Key in blue circle

Get your free 30-day Trial Key instantly.

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required