However, the first web context I have is "/aa" and the second one is "/aa/bb." At runtime, it doesn't seem to resolve "/aa/bb" correctly. Instead, it gave me the same reference as ctx1. This code runs fine if the second context doesn't start with "/aa". I guess somehow app server thought "aa/bb" is a part of "aa".
Am I violating any Servlet spec or missing something here? What is the right way to do it without changing the context names. Any workaround? I run this JBoss 4, by the way.