blob: 22fc5cbdc83dc8ce87a69fb260f9613aa74c931f [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Managing Server Classpath</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><meta name="keywords" content="jetty, servlet, servlet-api, cometd, http, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty"><link rel="up" href="startup.html" title="Chapter&nbsp;9.&nbsp;Starting Jetty"><link rel="prev" href="startup-base-and-home.html" title="Managing Jetty Base and Jetty Home"><link rel="next" href="startup-modules.html" title="Managing Startup Modules"><link xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" rel="shortcut icon" href="images/favicon.ico"><link rel="stylesheet" href="css/highlighter/foundation.css"><script src="js/highlight.pack.js"></script><script>
hljs.initHighlightingOnLoad();
</script><link type="text/css" rel="stylesheet" href="css/font-awesome/font-awesome.min.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><tr><td style="width: 25%"><a href="http://www.eclipse.org/jetty"><img src="images/jetty-header-logo.png" alt="Jetty Logo"></a><br><span style="font-size: small">
Version: 9.4.29.v20200521</span></td><td style="width: 50%"></td></tr></table><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Managing Server Classpath</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="startup-base-and-home.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;9.&nbsp;Starting Jetty<br><a accesskey="p" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="startup-modules.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr></table><hr></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="jetty-callout"><h5 class="callout"><a href="http://www.webtide.com/">Contact the core Jetty developers at
<span class="website">www.webtide.com</span></a></h5><p>
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
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="startup-classpath"></a>Managing Server Classpath</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="startup-classpath.html#_interrogating_the_server_classpath">Interrogating the Server Classpath</a></span></dt></dl></div><p>Jetty Server Classpath is determined by a combination of factors.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">The java.class.path System Property</span></dt><dd>If you start Jetty with a JVM specified classpath, then Jetty will use the java.class.path System Property to populate the initial classpath.</dd><dt><span class="term">Module specified Libraries</span></dt><dd>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.</dd><dt><span class="term">Command Line Libraries</span></dt><dd>The command line option <code class="literal">--lib=&lt;path&gt;</code> can be used as a final means to add arbitrary entries to the Jetty Server classpath.</dd></dl></div><p>Of special note, there are 2 structural modules defined to ease some of this for you.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">--module=ext</span></dt><dd>The <code class="literal">ext</code> module will enable the <code class="literal">lib/ext/*.jar</code> 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.</dd><dt><span class="term">--module=resources</span></dt><dd>The <code class="literal">resources</code> module will add the <code class="literal">resources/</code> 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: <code class="literal">log4j.properties</code>, <code class="literal">log4j.xml</code>, <code class="literal">logging.properties</code>, and <code class="literal">logback.xml</code>), so this would be the ideal setup for this sort of configuration demand.</dd></dl></div><div class="blockquote"><blockquote class="blockquote"><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="fa fa-asterisk" aria-hidden="true"></i> Note</h3><p>Both the <code class="literal">ext</code> and <code class="literal">resources</code> modules declare relative paths that follow <a class="link" href="startup-base-and-home.html#base-vs-home-resolution">Jetty Base and Jetty Home path resolution rules</a>.</p></div></blockquote></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_interrogating_the_server_classpath"></a>Interrogating the Server Classpath</h3></div></div></div><p>The Jetty <code class="literal">start.jar</code> 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.</p><p>The <code class="literal">--list-classpath</code> command line option is used as such.</p><p>(Demonstrated with the <a class="link" href="startup-base-and-home.html#demo-base" title="Demo-Base in the Jetty Distribution">demo-base from the Jetty Distribution</a>)</p><div class="screenexample"><pre class="screen">[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.4.29.v20200521 | ${jetty.home}/lib/jetty-client-9.4.29.v20200521.jar
1: 1.4.1.v201005082020 | ${jetty.base}/lib/ext/javax.mail.glassfish-1.4.1.v201005082020.jar
2: 9.4.29.v20200521 | ${jetty.base}/lib/ext/test-mock-resources-9.4.29.v20200521.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.4.29.v20200521 | ${jetty.home}/lib/jetty-http-9.4.29.v20200521.jar
7: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-continuation-9.4.29.v20200521.jar
8: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-server-9.4.29.v20200521.jar
9: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-xml-9.4.29.v20200521.jar
10: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-util-9.4.29.v20200521.jar
11: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-io-9.4.29.v20200521.jar
12: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-jaas-9.4.29.v20200521.jar
13: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-jndi-9.4.29.v20200521.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.3 | ${jetty.home}/lib/jndi/javax.transaction-api-1.3.jar
17: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-rewrite-9.4.29.v20200521.jar
18: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-security-9.4.29.v20200521.jar
19: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-servlet-9.4.29.v20200521.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.4.29.v20200521 | ${jetty.home}/lib/jetty-plus-9.4.29.v20200521.jar
28: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-webapp-9.4.29.v20200521.jar
29: 9.4.29.v20200521 | ${jetty.home}/lib/jetty-annotations-9.4.29.v20200521.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.4.29.v20200521 | ${jetty.home}/lib/jetty-deploy-9.4.29.v20200521.jar
34: 1.0 | ${jetty.home}/lib/websocket/javax.websocket-api-1.0.jar
35: 9.4.29.v20200521 | ${jetty.home}/lib/websocket/javax-websocket-client-impl-9.4.29.v20200521.jar
36: 9.4.29.v20200521 | ${jetty.home}/lib/websocket/javax-websocket-server-impl-9.4.29.v20200521.jar
37: 9.4.29.v20200521 | ${jetty.home}/lib/websocket/websocket-api-9.4.29.v20200521.jar
38: 9.4.29.v20200521 | ${jetty.home}/lib/websocket/websocket-client-9.4.29.v20200521.jar
39: 9.4.29.v20200521 | ${jetty.home}/lib/websocket/websocket-common-9.4.29.v20200521.jar
40: 9.4.29.v20200521 | ${jetty.home}/lib/websocket/websocket-server-9.4.29.v20200521.jar
41: 9.4.29.v20200521 | ${jetty.home}/lib/websocket/websocket-servlet-9.4.29.v20200521.jar</pre></div><p>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.</p></div></div><script type="text/javascript">
SyntaxHighlighter.all()
</script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="startup-base-and-home.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="startup.html"><i class="fa fa-chevron-up" aria-hidden="true"></i> Top</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="startup-modules.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Managing Jetty Base and Jetty Home&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></td><td width="40%" align="right" valign="top">&nbsp;Managing Startup Modules</td></tr></table></div><p xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><div class="jetty-callout">
See an error or something missing?
<span class="callout"><a href="http://github.com/eclipse/jetty.project">Contribute to this documentation at
<span class="website"><i class="fa fa-github" aria-hidden="true"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2020-05-21)</i></span></div></p></body></html>