| No, this is not a bug but a wanted feature. This problem derives from the way Java structures classes into subdirectories per package name. People suffer similar problems writing non-servlet code. (we have a love-hate relationship with this approach: it's clean, but it creates deep directory trees.) Java would expect a file called $DIR/test/SimpleServlet to have the fully-qualified classname test.SimpleServlet. It looks in the 'test' subdirectory of each directory in the classpath for files in the 'test' package.
The module currently converts a request for test/SimpleServlet into a request for the class test.SimpleServlet. It finds the class file, but gets confused because the file actually contains a definition of the file 'SimpleServlet'. In short: make sure the package name declared in the class matches the directory structure where the class file is located.
To fix this particular problem: declare the servlet using a proper package name: org.dummy.test.SimpleServlet, compile it into $ROOT/servlets/org/dummy/test/SimpleServlet.class, and make your ServletPath $ROOT/servlets. Add an alias or servlet.simple.code property to generate a shorter URL if you like. (Thanks to Martin Pool)
|