Bill the Plumber

Software plumbing using middleware wrenches

  • My New Book

  • Recent Posts

  • Categories

  • Archives

Scannotation fix for /WEB-INF/classes

Posted by billburke on February 14, 2008

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.

One Response to “Scannotation fix for /WEB-INF/classes”

  1. blackthorn said

    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?

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>