I have a confession. I didn’t really test the code that allowed you to scan /WEB-INF/classes for my Scannotation project. In the old code, if you run within Tomcat, you’ll get a “jndi:” protocol based URL that my code doesn’t understand yet how to scan
Instead, I obtain the URL by doing a ServletContext.getRealPath(“/WEB-INF/classes”). Unfortunately, this is not guaranteed to work by the specification, so, if you run into this problem, you’re gonna have to find another way to scan this directory portably.
I’ve released a version 1.02 of Scannotation that has this RealPath fix along with a few other minor bug fixes I found while using the library.
Nov 30, 2009 @ 07:28:59
This is an issue with glassfish as well.
Being able to access the url wouldn’t do you any good as it points to a top level package (i.e. jndi:/server/myapp/WEB-INF/lib/com/) and not to a file.
I tried using the JNDI API to recursively scan the entire directory tree for class files, but they aren’t there. Does anyone have a fix for this?