Version: 9.3.28.v20191105 |

Managing Server Classpath
Previous | Chapter 9. Starting Jetty Home | Next

##### Contact the core Jetty developers at www.webtide.com

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

## Managing Server Classpath

Jetty Server Classpath is determined by a combination of factors.

The java.class.path System Property
  If you start Jetty with a JVM specified classpath, then Jetty will use the java.class.path System Property to populate the initial classpath.
Module specified Libraries
  The module system declares various libraries that are required for that module to operate. These module defined libraries are added to the Jetty Server classpath when any module is activated with library declarations.
Command Line Libraries
  The command line option `--lib=<path>` can be used as a final means to add arbitrary entries to the Jetty Server classpath.

Of special note, there are 2 structural modules defined to ease some of this for you.

--module=ext
  The `ext` module will enable the `lib/ext/*.jar` logic. + If this module is activated, then all jar files found in the lib/ext/ paths will be automatically added to the Jetty Server Classpath.
--module=resources
  The `resources` module will add the `resources/` directory the classpath. + If you have 3rd party libraries that lookup resources from the classpath, put your files in here. + Logging libraries often have classpath lookup of their configuration files (eg: `log4j.properties`, `log4j.xml`, `logging.properties`, and `logback.xml`), so this would be the ideal setup for this sort of configuration demand.

> ### Note

> Both the `ext` and `resources` modules declare relative paths that follow Jetty Base and Jetty Home path resolution rules.

### Interrogating the Server Classpath

The Jetty `start.jar` has the ability to resolve the classpath from the command line, modules and configuration, and to list the classpath entries it will use to start jetty.

The `--list-classpath` command line option is used as such.

(Demonstrated with the demo-base from the Jetty Distribution)

    [demo-base]$ java -jar $JETTY_HOME/start.jar --list-classpath

    Jetty Server Classpath:
    -----------------------
    Version Information on 42 entries in the classpath.
    Note: order presented here is how they would appear on the classpath.
          changes to the --module=name command line options will be reflected here.
     0:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-client-9.3.28.v20191105.jar
     1:      1.4.1.v201005082020 | ${jetty.base}/lib/ext/javax.mail.glassfish-1.4.1.v201005082020.jar
     2:               9.3.28.v20191105 | ${jetty.base}/lib/ext/test-mock-resources-9.3.28.v20191105.jar
     3:                    (dir) | ${jetty.home}/resources
     4:                    3.1.0 | ${jetty.home}/lib/servlet-api-3.1.jar
     5:                  3.1.RC0 | ${jetty.home}/lib/jetty-schemas-3.1.jar
     6:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-http-9.3.28.v20191105.jar
     7:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-continuation-9.3.28.v20191105.jar
     8:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-server-9.3.28.v20191105.jar
     9:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-xml-9.3.28.v20191105.jar
    10:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-util-9.3.28.v20191105.jar
    11:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-io-9.3.28.v20191105.jar
    12:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-jaas-9.3.28.v20191105.jar
    13:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-jndi-9.3.28.v20191105.jar
    14:      1.1.0.v201105071233 | ${jetty.home}/lib/jndi/javax.activation-1.1.0.v201105071233.jar
    15:      1.4.1.v201005082020 | ${jetty.home}/lib/jndi/javax.mail.glassfish-1.4.1.v201005082020.jar
    16:                      1.2 | ${jetty.home}/lib/jndi/javax.transaction-api-1.2.jar
    17:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-rewrite-9.3.28.v20191105.jar
    18:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-security-9.3.28.v20191105.jar
    19:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-servlet-9.3.28.v20191105.jar
    20:                    3.0.0 | ${jetty.home}/lib/jsp/javax.el-3.0.0.jar
    21:      1.2.0.v201105211821 | ${jetty.home}/lib/jsp/javax.servlet.jsp.jstl-1.2.0.v201105211821.jar
    22:                    2.3.2 | ${jetty.home}/lib/jsp/javax.servlet.jsp-2.3.2.jar
    23:                    2.3.1 | ${jetty.home}/lib/jsp/javax.servlet.jsp-api-2.3.1.jar
    24:                    2.3.3 | ${jetty.home}/lib/jsp/jetty-jsp-jdt-2.3.3.jar
    25:      1.2.0.v201112081803 | ${jetty.home}/lib/jsp/org.apache.taglibs.standard.glassfish-1.2.0.v201112081803.jar
    26:   3.8.2.v20130121-145325 | ${jetty.home}/lib/jsp/org.eclipse.jdt.core-3.8.2.v20130121.jar
    27:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-plus-9.3.28.v20191105.jar
    28:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-webapp-9.3.28.v20191105.jar
    29:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-annotations-9.3.28.v20191105.jar
    30:                      4.1 | ${jetty.home}/lib/annotations/asm-4.1.jar
    31:                      4.1 | ${jetty.home}/lib/annotations/asm-commons-4.1.jar
    32:                      1.2 | ${jetty.home}/lib/annotations/javax.annotation-api-1.2.jar
    33:               9.3.28.v20191105 | ${jetty.home}/lib/jetty-deploy-9.3.28.v20191105.jar
    34:                      1.0 | ${jetty.home}/lib/websocket/javax.websocket-api-1.0.jar
    35:               9.3.28.v20191105 | ${jetty.home}/lib/websocket/javax-websocket-client-impl-9.3.28.v20191105.jar
    36:               9.3.28.v20191105 | ${jetty.home}/lib/websocket/javax-websocket-server-impl-9.3.28.v20191105.jar
    37:               9.3.28.v20191105 | ${jetty.home}/lib/websocket/websocket-api-9.3.28.v20191105.jar
    38:               9.3.28.v20191105 | ${jetty.home}/lib/websocket/websocket-client-9.3.28.v20191105.jar
    39:               9.3.28.v20191105 | ${jetty.home}/lib/websocket/websocket-common-9.3.28.v20191105.jar
    40:               9.3.28.v20191105 | ${jetty.home}/lib/websocket/websocket-server-9.3.28.v20191105.jar
    41:               9.3.28.v20191105 | ${jetty.home}/lib/websocket/websocket-servlet-9.3.28.v20191105.jar

Of note is that an attempt is made to list the internally declared version of each artifact on the Server Classpath, which can potentially help when diagnosing classpath issues.

Previous | Top | Next
Managing XML Based Startup Configuration | Home | Managing Startup Modules

See an error or something missing? Contribute to this documentation at Github!(Generated: 2019-11-05)