Working with Tomcat

Important

Use Tomcat 9.x or higher, previous versions do not work with the current versions of Jersey

Use Jersey 2.27 files from org.glassfish.jersey.  There are three dependencies that are required -

<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.27</version>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.27</version>
</dependency>
<!-- uncomment this to get JSON support -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
<version>2.27</version>
</dependency>

The context.xml in a war file is ignored.  In order to created virtual paths, you need to create an xml file (can be given any name) under $CATAINA_BASE/conf/<engine>/<host>/ (so my machine this is - c:/java/apache-tomcat-9.0.7/conf/Catalina/localhost).  I have two file currently dbwstier.xml, and dbank.xml

dbwstier.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="C:\work\software\netbeans\DBankDBTier_ws_exp\target\DBankDBTier_ws_exp" path="/dbwstier"/>

dbank.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="C:\work\software\eclipse_jee\DBankDBTier_ws_exp\target\DBankDBTier-ws-1.0" path="/dbank"/>