You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Miguel Angel Pastor Olivar <mi...@gmail.com> on 2012/10/03 08:55:08 UTC
WebAppClassLoader and hasExternalRepositories
Hey guys,
This is my first email on this mailing list; I have been searching among
old messages but I have not found anything related to my next question.
Sorry if I am duplicating content :(.
Let me explain my current situation:
- I am embedding Apache Felix OSGI container into my web application.
Apache Felix, adds a new URL to the classloader which has loaded it
(WebappClassLoader)
- The previous method call sets the field *hasExternalRepositories* to
be true in the WebappClassLoader instance
- When my webapp is loading, the Xalan extension manager is searching
for a class with that format "java:.......PortletBridge".
- Because the hasExternalRepositories is set to true (because the Apache
Felix container) the super.findClass(name) is invoked
if ((clazz == null) && hasExternalRepositories && !searchExternalFirst) {
try {
* clazz = super.findClass(name);*
} catch(AccessControlException ace) {
log.warn("WebappClassLoader.findClassInternal(" + name
+ ") security exception: " + ace.getMessage(),
ace);
throw new ClassNotFoundException(name, ace);
} catch (RuntimeException e) {
if (log.isTraceEnabled())
log.trace(" -->RuntimeException Rethrown", e);
throw e;
}
}
- The previous method call receives "java:......PortletBridge" as the
parameter, which cause an IllegalArgumentException. This issue causes the
Xalan extensions to be not properly configured
- If I disable the underlying Apache Felix container everything works
perfectly because the previous code is not executed.
So, my question is, when catching the RuntimeException and rethrowing it,
would it be possible to throw a ClassNotFoundException? I mean
if ((clazz == null) && hasExternalRepositories && !searchExternalFirst) {
try {
clazz = super.findClass(name);
} catch(AccessControlException ace) {
log.warn("WebappClassLoader.findClassInternal(" + name
+ ") security exception: " + ace.getMessage(),
ace);
throw new ClassNotFoundException(name, ace);
} *catch (RuntimeException e) {*
* if (log.isTraceEnabled())*
* log.trace(" -->RuntimeException ocurred", e);*
* throw new ClassNotFoundException(name, e);*
* }*
}
Thx and sorry about the long email.!
--
Un saludo,
Migue
http://migue.github.com