diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-10-21 11:07:17 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-10-21 11:07:17 +0000 |
commit | 9fc552aa74a366b68575354934949c6b985df3a5 (patch) | |
tree | 8d9b578e252bf08d5e9658d5db60664736e049ab /src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java | |
parent | c9c1a83c4e9fa47fb16d53a9242285613d3b2fc2 (diff) | |
download | vaadin-framework-9fc552aa74a366b68575354934949c6b985df3a5.tar.gz vaadin-framework-9fc552aa74a366b68575354934949c6b985df3a5.zip |
#7822 Loading Vaadin application in JBoss AS 7 throws java.lang.LinkageError
svn changeset:21773/svn branch:6.7
Diffstat (limited to 'src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java index 098a872ca6..b1d6f8ab13 100644 --- a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java +++ b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java @@ -1041,9 +1041,7 @@ public class JsonPaintTarget implements PaintTarget { try { return class1.isAnnotationPresent(ClientWidget.class); } catch (NoClassDefFoundError e) { - StringWriter writer = new StringWriter(); - e.printStackTrace(new PrintWriter(writer)); - String stacktrace = writer.toString(); + String stacktrace = getStacktraceString(e); if (stacktrace .contains("com.ibm.oti.reflect.AnnotationParser.parseClass")) { // #7479 IBM JVM apparently tries to eagerly load the classes @@ -1057,6 +1055,23 @@ public class JsonPaintTarget implements PaintTarget { // throw exception forward throw e; } + } catch (LinkageError e) { + String stacktrace = getStacktraceString(e); + if (stacktrace + .contains("org.jboss.modules.ModuleClassLoader.defineClass")) { + // #7822 JBoss AS 7 apparently tries to eagerly load the classes + // referred to by annotations. Checking the annotation from byte + // code to be sure that we are dealing the this case and not + // some other class loading issue. + if (bytecodeContainsClientWidgetAnnotation(class1)) { + // Seems that JBoss still prints a stacktrace to the logs + // even though the LinkageError has been caught + return true; + } + } else { + // throw exception forward + throw e; + } } catch (RuntimeException e) { if (e.getStackTrace()[0].getClassName().equals( "org.glassfish.web.loader.WebappClassLoader")) { @@ -1080,6 +1095,13 @@ public class JsonPaintTarget implements PaintTarget { return false; } + private static String getStacktraceString(Throwable e) { + StringWriter writer = new StringWriter(); + e.printStackTrace(new PrintWriter(writer)); + String stacktrace = writer.toString(); + return stacktrace; + } + private boolean bytecodeContainsClientWidgetAnnotation( Class<? extends Paintable> class1) { |