tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Monsen <hair...@gmail.com>
Subject poor-man's plugins: loading a subclass of a Web application class from common/lib
Date Sat, 10 Oct 2009 23:53:35 GMT
I have a Web application which includes an abstract class: "TransactionImport".

I compiled a subclass of TransactionImport (AudiBankImporter), placed
the class in a jar, then placed the jar in $CATALINA_HOME/lib.

What I'd like to do is load the compiled AudiBankImporter class from
the Web application at runtime. When I do this using Class.forName()
or ClassLoader.loadClass(), I get "java.lang.NoClassDefFoundError:
TransactionImport".

If I change AudiBankImporter so that it no longer subclasses
TransactionImport, I am able to load the class.

I feel like I'm missing something fundamental about class loading in
general or Tomcat classloaders, but I don't know what.

If this isn't enough information to help me, I can code up a simple
example. Basically what I'm trying to do is allow users to make
plugins for my Web application, and force their plugins to subclass an
abstract class I define. I could probably also use an interface or an
actual class if that would work better in Tomcat.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message