I am trying to run a java servlet on an Ubuntu machine. I have copied my project directory and web.xml
file below. I have Java and Tomcat9 installed, and Tomcat seems to be working properly, as the initial splash screen shows up on port 8080
. I have an index.jsp
file in a WebContent
folder which I can access and view just fine at domain:8081/WebContent
(the project has been configured to run on port 8081), so it seems as though my server.xml
file is correctly configured, however I am unable to run my servlets, TrieDriver
and SpellCheckDriver
and get a HTTP Status 404 – Not Found
. In servlet-class
tag in my web.xml
file, I have tried prepending the package name to the servlet class name, as shown in the AutoComplete
servlet definition, and without the package name, as shown in the SpellCheck
servlet definition. I tried multiple combinations to try to access the page, /SpellCheck/SpellCheck
, /spellCheck/SpellCheck
, /SpellCheck
, none of which worked, with combinations of server-class
having the package and without. I tried looking at examples, and it seems as though my format follows what they have, but I can't get it to work. All help is appreciated.
Project Directory:
── SpellCheck
├── WEB-INF
│ ├── classes
│ │ ├── spellCheck
│ │ │ ├── Main.class
│ │ │ ├── SCNode.class
│ │ │ ├── SiteFormat.class
│ │ │ ├── SpellCheck.class
│ │ │ └── SpellCheckDriver.class
│ │ └── trie
│ │ ├── Trie.class
│ │ └── TrieDriver.class
│ ├── src
│ │ ├── spellCheck
│ │ │ ├── Main.java
│ │ │ ├── SCNode.java
│ │ │ ├── SiteFormat.java
│ │ │ ├── SpellCheck.java
│ │ │ └── SpellCheckDriver.java
│ │ └── trie
│ │ ├── Trie.java
│ │ └── TrieDriver.java
│ ├── web.xml
└── WebContent
├── META-INF
│ └── MANIFEST.MF
├── index.jsp
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>AutoComplete</servlet-name>
<servlet-class>trie.TrieDriver</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AutoComplete</servlet-name>
<url-pattern>/AutoComplete</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SpellCheck</servlet-name>
<servlet-class>SpellCheckDriver</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SpellCheck</servlet-name>
<url-pattern>/SpellCheck</url-pattern>
</servlet-mapping>
</web-app>