N
netpro2k
im working on a plugin system that reads an XML and loads classes from
jars. Each module is loaded via a new URLClassLoader with their url.
The XML also contains names for each module ... any module that wants
another module calls the static meathod in Hub getModuleInstance(name)
.... this returns a module (an interface)...
All was going well for awhile while i was working on it and trying it
via my IDE...I recently created an ant build script that makes jars
from everything... so now the module classes are only in the jars...
not the jars and the classpath as was the case when ran from my IDE...
The module loading and naming works properly for several modules...
but when loading one it fails with a java.lang.NoClassDefFoundError on
a module it is trying to use. This module is the only module so far
that relies on another module without an interface in the classpath
(it has it as a member variable)
details (module interface is in the classpath):
login implements module (login is loaded from a jar via a
URLClassLoader)
connectionDefImpl implements connection,module (connectionDefImpl is
loaded from a jar via URLClassLoader, connection is in the classpath)
nnDatabaseConn implements module, databaseConn (nnDatabaseConn is
loaded from jar via URLClassLoader, databaseConn is in the classpath)
guiModule implements module extends JFrame (guiModule is loaded from
jar via URLClassLoader)
nnOS implements mdoule, iconCallBack (nnOS is loaded from jar via
URLClassLoader, iconCallback is in classpath)
nnOS has a member variable of type guiModule that is set to a
reference of the instance gotten from Hub...
hub loads up reads its config file and creates URLClassLoaders for
each jar .. then gets the Class object for each (loading the class
marked as Main-Class: in the jar)... then starts login (staring means
instantiating it if not done yet and calling the start meathod on
it)... login then starts connection and connects... then guiModule is
started... guiModule starts and asks hub for an instance of nnOS...
nnOS trys to instantiate but fails with an error of:
java.lang.NoClassDefFoundError:
com/summationtech/symmetry/client/Modules/guiModule
i think it may be that i have a guiModule member variable in nnOS and
subsequently have to import it, and guiModule is not in the
classpath.. if this is the reason how can i create a field of this
type without having to import it, or have it in the classpath (it is
loaded from a URLClassLoader)
jars. Each module is loaded via a new URLClassLoader with their url.
The XML also contains names for each module ... any module that wants
another module calls the static meathod in Hub getModuleInstance(name)
.... this returns a module (an interface)...
All was going well for awhile while i was working on it and trying it
via my IDE...I recently created an ant build script that makes jars
from everything... so now the module classes are only in the jars...
not the jars and the classpath as was the case when ran from my IDE...
The module loading and naming works properly for several modules...
but when loading one it fails with a java.lang.NoClassDefFoundError on
a module it is trying to use. This module is the only module so far
that relies on another module without an interface in the classpath
(it has it as a member variable)
details (module interface is in the classpath):
login implements module (login is loaded from a jar via a
URLClassLoader)
connectionDefImpl implements connection,module (connectionDefImpl is
loaded from a jar via URLClassLoader, connection is in the classpath)
nnDatabaseConn implements module, databaseConn (nnDatabaseConn is
loaded from jar via URLClassLoader, databaseConn is in the classpath)
guiModule implements module extends JFrame (guiModule is loaded from
jar via URLClassLoader)
nnOS implements mdoule, iconCallBack (nnOS is loaded from jar via
URLClassLoader, iconCallback is in classpath)
nnOS has a member variable of type guiModule that is set to a
reference of the instance gotten from Hub...
hub loads up reads its config file and creates URLClassLoaders for
each jar .. then gets the Class object for each (loading the class
marked as Main-Class: in the jar)... then starts login (staring means
instantiating it if not done yet and calling the start meathod on
it)... login then starts connection and connects... then guiModule is
started... guiModule starts and asks hub for an instance of nnOS...
nnOS trys to instantiate but fails with an error of:
java.lang.NoClassDefFoundError:
com/summationtech/symmetry/client/Modules/guiModule
i think it may be that i have a guiModule member variable in nnOS and
subsequently have to import it, and guiModule is not in the
classpath.. if this is the reason how can i create a field of this
type without having to import it, or have it in the classpath (it is
loaded from a URLClassLoader)