Resolution: Won't Fix
Affects Version/s: 22.214.171.124
Fix Version/s: None
Deploying Nexus on Glassfish fails with a StackOverFlowError in the admin console. This exception is not logged, so I had to attach a debugger to find out what happened.
I found out that Glassfish overrides System.out to with a custom PrintWriter that redirects to the Java Logging system. They probably thought this was a smart trick to catch the output of any code that writes to System.out instead of using proper logging.
The problem is that Nexus uses Slf4j's SLF4JBridgeHandler to redirect all JUL logging to Slf4j. Slf4j again wraps Log4J.
Nexus configures Log4j with a ConsoleAppender writing to System.out, so what happens is this:
1) Some code writes to a Plexus Logger component.
2) The Plexus Logger component logs to Slf4j's Logger (in Slf4jLogger form Plexus logging)
3) Slf4j logs to log4j
4) log4j writes result to System.out through the configured ConsoleAppender
5) Glassfish's custom System.out redirect console output to Java Logging
6) Java Logging redirects it's logging to Slf4j becuse of SLF4JBridgeHandler being installed.
7) See 3
So we have an infinite loop in logging ending in a StackOverFlowError.
I've confirmed that removing Slf4jHandlerInstaller from plexus.xml prevents the loop and that Nexus actually starts up on Glassfish when this change is made.
I guess the Slf4jHandlerInstaller is probably there for a reason, so just removing it is probably not the best way to fix this.
BTW: The Nexus FAQ states that "Glassfish is not yet supported as it conflicts with Log4j". This should probably be updated because log4j isn't really the problem here.