Bug 46344 - Two org.apache.AnnotationProcessor classes can cause ClassCastExceptions
Summary: Two org.apache.AnnotationProcessor classes can cause ClassCastExceptions
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 6.0.18
Hardware: All All
: P2 major (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2008-12-05 00:08 UTC by Roger Villars
Modified: 2008-12-27 14:19 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Roger Villars 2008-12-05 00:08:51 UTC
In the binary packages of tomcat 6 the class org.apache.AnnotationProcessor exists twice. Once in the catalina.jar and once in the jasper.jar. Normally this isn't a problem because both contain the same code and there is normally only one classpath (one patches the other).

But in special environments this causes problems. In fact it isn't possible to use tomcat 6 in an OSGi environment where catalina and jasper are in different bundles with different classpaths because org.apache.catalina.util.DefaultAnnotationProcessor implements org.apache.AnnotationProcessor from the catalina bundle and jasper wants to cast it to org.apache.AnnotationProcessor from the jasper bundle which is in another classpath. That causes a ClassCastException.
Comment 1 Mark Thomas 2008-12-27 14:19:17 UTC
I have fixed this in trunk (so it will be in Tomcat 7 onwards) but will not be proposing this for porting to 6.0.x since it is too likely to break things for existing users.