a) download the jetty distribution matching the jetty distribution with geoserver from https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/
e.g https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.2.13.v20150730/jetty-distribution-9.2.13.v20150730.tar.gz for geoserver 2.13.4
jetty version can be discovered by
/opt/geoserver-2.13.4$ java -jar start.jar --version
WARNING: Module not found [ssl]
Jetty Server Classpath:
-----------------------
Version Information on 14 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: (dir) | ${jetty.base}/resources
1: 3.1.0 | ${jetty.base}/lib/javax.servlet-api-3.1.0.jar
2: 3.1.0.M0 | ${jetty.base}/lib/jetty-schemas-3.1.M0.jar
3: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-http-9.2.13.v20150730.jar
4: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-server-9.2.13.v20150730.jar
5: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-xml-9.2.13.v20150730.jar
6: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-util-9.2.13.v20150730.jar
7: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-io-9.2.13.v20150730.jar
8: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-security-9.2.13.v20150730.jar
9: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-servlet-9.2.13.v20150730.jar
10: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-servlets-9.2.13.v20150730.jar
11: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-webapp-9.2.13.v20150730.jar
12: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-deploy-9.2.13.v20150730.jar
13: 9.2.13.v20150730 | ${jetty.base}/lib/jetty-plus-9.2.13.v20150730.jar
/opt/geoserver-2.13.4$
b) copy modules/plus.mod and modules/jndi.mod to geoserver-${version}/modules path
from the jetty distributable and follow instructions therein, e.g:
```
geoserver-2.13.4$ cat modules/plus.mod
#
# Jetty Plus module
#
[depend]
server
security
jndi
webapp
[lib]
lib/jetty-plus-${jetty.version}.jar
[xml]
etc/jetty-plus.xml
/geoserver-2.13.4$
```
means lib/jetty-plus-${jetty.version}.jar needs to be present aswell as the config
at etc/jetty-plus.xml
and
```
/opt/geoserver-2.13.4$ cat modules/jndi.mod
#
# JNDI Support
#
[depend]
server
[lib]
lib/jetty-jndi-${jetty.version}.jar
lib/jndi/*.jar
/opt/geoserver-2.13.4$
```
needs lib/jetty-jndi-${jetty.version}.jar and all the jar files from lib/jndi
copied from the jetty distribution to geoserver-${version}/lib path
c) add to the end of start.ini the directives for loading plus and jndi modules
```
--module=plus
--module=jndi
```
d) DECLARE JNDI connection by creating webapps/geoserver/WEB-INF/web-env.xml
(or append to existing):
```
jdbc/pgjndi
postgres
postgres
postgres
localhost
5432
```
e) in webapps/geoserver/WEB-INF/web.xml declare
```
jdbc/pgjndi
javax.sql.DataSource
Container
```
f) start geoserver and "Stores" -> "Add new Store" -> "PostgreSQL (JNDI)"
using the jndiReferenceName `java:comp/env/jdbc/pgjndi`
g) yeay!