CUBA Class Loading
CUBA relies on the class loading and meta data retrieval mechanisms,
provided by the respective runtime environments.
Running CUBA components as EJBs is the simplest case in the sense that
there is actually nothing to mention over the standard. CUBA component
modules including generated EJB adapters and descriptors can directly
used as EJB modules and incorporated into EAR files. The application
are responsible for the retrieval of meta information (application
descriptors, module deployment descriptors, and code annotations) and
classes. In EJB mode, CUBA doesn't
any resource retrieval beyond the standard, so there's nothing more to
know than this.
Using CUBA's wired container for stand-alone applications allows to
with Java's standard system class loader in most cases. In wired mode,
CUBA needs to
This is usually achieved by simply adding all module archives to the
and declare the modules without path in the application descriptor. The
must also be loadable from a library or a directory on the CLASSPATH.
- Load classes
- Load the application descriptor META-INF/wired-application.xml
- Load the module descriptor META-INF/wired-jar.xml
for all modules, listed
in the application descriptor
If you produce large wired applications you may run into problems with
a growing classpath. E.g. on older Windows platforms, both environment
variables and command lines are limited to 1024 characters and may
problems when working with 20 separate component modules or more. For
cases, CUBA provides the alternative class DDClassLoader which
allows to address the component modules indirectly. The class loader
module names from the application descriptor and tries to locate them
all directories specified on the classpath. This allows e.g. to put all
modules in a single directory and specify only this directory on the
Beside component modules, the class loader also allows to located
libraries in the same way using the java
element in the wired-application.xml,
The DDClassLoader is
assumed to be used as system class loader
being specified by system property java.system.class.loader.
course, at least the wired-application.xml
must be available through
default system class loader or any of its parents.
Servlet engines like Tomcat are a kind of managed environment and
their own class loader hierarchy to fullfil the servlet specification.
The application class loader allows to retrieve classes and other
from either the WEB-INF/classes
directory or from any library
file in the WEB-INF/lib
directory. Using the wired container in
a servlet environment is therefore very simple. The component modules
any other libraries (at least the CUBA runtime library, of course) are
copied to the WEB-INF/lib
directory. For the wired-application.xml,
simply create the directory WEB-INF/classes/META-INF
the file into it.
Usually, an AXIS environment is nothing else but an ordinary web
in a servlet engine. I.e. there apply the same rules as above. That's