
The Payara Monthly Catch -September 2025
Welcome aboard the September issue of The Monthly Catch! With summer holidays wrapping up, the Java world is back […]
Taking inspiration from the way the integrated Hazelcast automatically searches for an open port when clustering, I decided to add in a similar feature for Payara Micro when trying to bind its HTTP and HTTPS ports.
In the upcoming Payara 4.1.153 release, Payara Micro will be shipping with support for the first working iteration of this new feature. To help and keep Payara as a drop-in replacement for GlassFish though, the auto-binding is not enabled by default, and is instead enabled by passing in an extra option when starting Payara Micro.
The three new Payara Micro options pertaining to this feature are:
The feature works in how you may have seen the Hazelcast clustering working; when the auto-bind feature is enabled, Payara Micro will attempt to connect to the specified port, and if that port is busy, it will instead try to bind on the next port up, repeating until it finds a port, or the –autoBindRange limiter is reached.
It’s super easy to use, you just have to set the respective auto-bind option to true for the HTTP and/or SSL port:
To grant some control over how the auto-bind feature works, I created the –autoBindRange option. This option allows you to determine how many ports to attempt binding to before giving up. This option defaults to 5 if not specified.As an example:
This will have Payara Micro attempt to find a free port on port 8080, then 8081, 8082, and 8083 before giving up and failing to start.In its current form, the auto-bind feature assumes that the default port is 8080 for HTTP, and 8181 for SSL; the feature will not release with the capability of reading values set in a domain.xml file. Having the auto-bind feature read the HTTP and HTTPS port values from a domain.xml is something we’ll be looking at for a future release.If you want to check out the source code for this, check out the pull request here: https://github.com/payara/Payara/pull/359/filesIf you have any ideas for how to improve this, or any other feature in Payara, please consider raising an issue on our GitHub project page!
Share:
Welcome aboard the September issue of The Monthly Catch! With summer holidays wrapping up, the Java world is back […]
We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]
Welcome aboard the August 2025 issue of The Payara Monthly Catch! With summer in full swing, things may have felt […]
Hi Andrew, this is a great feature. Are there any way to programmatically get the port that has been assigned ?
Thanks
Answer (for anyone else interested)
https://github.com/payara/Payara/issues/1191
how to auto redirect http to https in payara latest version ?
This post is really nice and helpful to me as I am confused about http vs https which is better for my website this post clears all my confusion, So Thanks for posting this helpful article.