Confluence won't work properly on Glassfish (v2.1 or v3) unless the classloader delegation is switched off. This can be configured via sun-web.xml which could be bundled with Confluence without affecting any other containers.
Unless the classloader delegation if turned off, the container will try to use container's classloader to load classes before the application specific classloader is used. This will result in all kinds of weird errors in cases where same libraries but different versions are bundled with both Confluence and GlassFish (e.g. Felix, Xalan, etc).