Caucho maker of Resin Server | Application Server (Java EE Certified) and Web Server


 

Resin Documentation

home company docs 
app server 
 Resin Server | Application Server (Java EE Certified) and Web Server
 

environment: class loaders


Resin organizes resources and classloaders into nested environments. Each environment context merges its own configuration with configuration inherited from the parent environment. Each environment context: server, host, web-app, etc. may be configured with any of the environment configuration tags.

Classloaders

class-loader

Adds dynamic classloaders to the current environment.

Each environment (<server>, <host>, <web-app>) etc, can add dynamic classloaders. The environment will inherit the parent classloaders. Each <class-loader> is comprised of several implementing loader items: library-loader for WEB-INF/lib, compiling-loader for WEB-INF/classes, even make-loader for more complex auto-compilation.

<class-loader> in resin-web.xml
<web-app xmlns="http://caucho.com/ns/resin">
  <prologue>
    <class-loader>
      <compiling-loader path="WEB-INF/classes"/>

      <library-loader path="WEB-INF/lib"/>
    </class-loader>
  </prologue>
</web-app>

compiling-loader

Configures an auto-compiling WEB-INF/classes-style class loader.

The compiling-loader will automatically compile Java code into .class files loading them.

compiling-loader Attributes
ATTRIBUTEDESCRIPTIONDEFAULT
argsAdditional arguments to be passed to the Java compilernone
batchIf true, multiple changed *.java files will be compiled in a single batchtrue
encodingI18N encoding for the Java compilernone
pathFilesystem path for the class loaderrequired
sourceJava source directoryvalue of path
require-sourceIf true, .class files without matching .java files will be deletedfalse

library-loader

Configures a jar library, WEB-INF/lib-style class loader.

The library-loader will add jar files in its path to the current classpath. Jar files are recognized when they have a filename extension of .jar or .zip.

library-loader Attributes
ATTRIBUTEDESCRIPTIONDEFAULT
pathFilesystem path for the class loaderrequired

See com.caucho.loader.DirectoryLoader.

tree-loader

Configures a jar library, WEB-INF/lib-style class loader similar to <library-loader>, but will also find .jar and .zip files in subdirectories.

tree-loader Attributes
ATTRIBUTEDESCRIPTIONDEFAULT
pathFilesystem path for the class loaderrequired

See com.caucho.loader.TreeLoader.

make-loader

Configures a custom make-style loader.

servlet-hack

Use of servlet-hack is discouraged. Using servlet-hack violates the JDK's classloader delegation model and can produce surprising ClassCastExceptions.

servlet-hack reverses the normal class loader order. Instead of parent classloaders having priority, child classloaders have priority.

simple-loader

Configures a simple classes-style class loader.

.class files in the specified directory will be loaded without any special compilation steps (in contrast with compiling-loader.)

simple-loader Attributes
ATTRIBUTEDESCRIPTIONDEFAULT
pathFilesystem path for the class loaderrequired
prefixClass package prefix to only load to a subset of classesnone

Copyright © 1998-2015 Caucho Technology, Inc. All rights reserved. Resin ® is a registered trademark. Quercustm, and Hessiantm are trademarks of Caucho Technology.

Cloud-optimized Resin Server is a Java EE certified Java Application Server, and Web Server, and Distributed Cache Server (Memcached).
Leading companies worldwide with demand for reliability and high performance web applications including SalesForce.com, CNET, DZone and many more are powered by Resin.

home company docs 
app server