EJB3, Stateful Firewalls, and Connection Timeouts with Payara
Recently, I encountered an interesting and frustrating problem when troubleshooting an EJB3 connection issue between two Payara server instances. After a change in firewall vendor, we noticed that remote EJB3 calls would start hanging after a period of inactivity. Initially, it seemed like an intermittent issue — but the deeper I looked, the more it felt like it never should have worked before the move either - a lovely Schroedinbug.
In this post, I’ll walk through the issue, why it happened, and the solution that ultimately fixed it.
The Problem
Our system uses remote EJB3 calls between two Payara instances, communicating over a network with a stateful firewall in between. After the firewall vendor change, we started seeing EJB3 calls hang indefinitely if the connection had been idle for some time. Once the hang occurred, it would eventually trigger client-side timeouts, retries, and application instability.
Here’s a simple view of the setup: