Description
What doesn't work:
In SecurityLifecycle
class, Util.isEmbeddedServer()
method is used to detect whether the runtime is GF Embedded. But the method always returns false, hence system properties for login.conf and server.policy are not set.
The Util.isEmbeddedServer()
method uses the Server
class and weird logic that mode is embedded if there are some Server instances. It seems to me that the Server
class and related classes that implement EmbeddedContainer
are dead code. The only way to create Server
instances is using the Builder
class, which is used only in tests, which probably test this unused container functionality: https://github.com/search?q=repo%3Aeclipse-ee4j%2Fglassfish++Server.Builder&type=code
Fix
Change the Util.isEmbeddedServer()
method to rely on one of the two ways that work:
- EmbeddedSecurityUtil.isEmbedded(), as in
- EjbContainerUtilImpl.isEmbeddedServer(), which seems to use a similar code, but completely distinct and duplicated
Additional refactor
Check whether it makes sense to
- Unify the above 2 working approaches to detecting the runtime and replace them with a single approach
- Remove the dead code of
Server
and related classes