[jboss-dev-forums] [JBoss AS7 Development] - Re: Help, my extension isn't starting

Carlo de Wolf do-not-reply at jboss.com
Tue Feb 1 07:24:25 EST 2011


Carlo de Wolf [http://community.jboss.org/people/wolfc] created the discussion

"Re: Help, my extension isn't starting"

To view the discussion, visit: http://community.jboss.org/message/584599#584599

--------------------------------------------------------------
+Why is this such a hassle?+

For that we need to take a look in the JDK source ServiceLoader.java:
    public S next() {
        if (!hasNext()) {
        throw new NoSuchElementException();
        }
        String cn = nextName;
        nextName = null;
        try {
        S p = service.cast(Class.forName(cn, true, loader)
                   .newInstance());
        providers.put(cn, p);
        return p;
        } catch (ClassNotFoundException x) {
        fail(service,
             "Provider " + cn + " not found");
        } catch (Throwable x) {
        fail(service,
             "Provider " + cn + " could not be instantiated: " + x,
             x);
        }
        throw new Error();        // This cannot happen
    }


If it encounters a ClassNotFoundException it doesn't emmit which class it can not find. Also the original exception is swallowed, so any diagnostic information within is lost.

They got one thing right though: fail. ;-)
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/584599#584599]

Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20110201/36e99022/attachment.html 


More information about the jboss-dev-forums mailing list