users@glassfish.java.net

Re: Unable to use annotations that refer to classes that cannot be loaded

From: Sahoo <Sahoo_at_Sun.COM>
Date: Wed, 30 Dec 2009 09:50:20 +0530

Please share the complete stack trace including any embedded exception
stack trace.

Thanks,
Sahoo

glassfish_at_javadesktop.org wrote:
> Hi,
>
> When trying to use the newest Vaadin version with Glassfish v3 we have noted that it fails completely due to annotations that refer to classes which in turn cannot be loaded. The idea with the annotation is that during runtime it is only necessary to check if the annotation is present or not, not to check its actual value.
>
> With all other servers we have tested, including Glassfish v2, this works just fine by doing
>
> ClientWidget annotation = class1.getAnnotation(ClientWidget.class);
>
> This will return null or an instance of ClientWidget which contains a sun.reflect.annotation.TypeNotPresentExceptionProxy as its value.
> With Glassfish v3 however a RuntimeException is thrown with the message
> "WEB9033: Unable to load class with name [com.vaadin.terminal.gwt.client.ui.VView], reason: java.lang.NoClassDefFoundError: com/google/gwt/event/logical/shared/ResizeHandler"
>
> The reason as far as I saw using the debugger (might be completely wrong, never looked at Glassfish or java annotation parser code before) is that the java annotation parser (AnnotationParser.parseClassValue) expects the classloader to throw a NoClassDefFoundError while loading the annotation if there is a problem. This is caught and a new TypeNotPresentExceptionProxy is created. In Glassfish v3 a RuntimeException is thrown instead of the NoClassDefFoundError and this is not caught in the annotation parser.
>
> Any suggestions on how to get around this in Glassfish v3 or how to get it fixed as soon as possible?
> [Message sent by forum member 'artur_s' (artur_at_vaadin.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=377932
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>