According to the spec and the examples therein, the code appears to be correct; however, I have attempted to run it on JBoss AS 7.0.0.Final and JBoss 6.0.0.Final, but it doesn't work. Note that the module name and application name are correctly looked up, but a NamingException is thrown when it attempts to lookup either form of the context root JNDI path (the ctx.lookup() calls from each of the getModuleUrl methods). This issue seems to indicate that this should have been fixed in JBoss 6. Is my code wrong, or does JBoss not implement this correctly?