A dedicated AuthN server presenting only a trivial interface built on a minimal-runtime memory-safe language with no shared database is an extremely hard target. Not that either outcome is likely, but a reasonable person can argue that you are more likely to make a mistake implementing HSM-augmented password hashing on a general-purpose app server than you are to screw up a dedicated Java AuthN server.
"Hardware" isn't magic. The magic power of an HSM isn't the hardware; it's the minimalized attack surface of the software.
"Hardware" isn't magic. The magic power of an HSM isn't the hardware; it's the minimalized attack surface of the software.