'Error 404 Not Found when I am using Tomcat WAR file

I am working on a project in Tomcat. I am using Java EE and recently added a WebSocket to a project and created a simple chat with it. Locally everything worked fine but when I created the WAR file and launched the application with it, the WebSocket part of the project causes the following error:

enter image description here

I am using 9.0.38 Tomcat version.

Apart from this one problem, the whole app works fine.

Do you have an idea how to fix it?



Solution 1:[1]

What's look like your Websocket dependency in your pom.xml file?

The scope of WebSocket dependency must be provided if already isn't:

<!-- https://mvnrepository.com/artifact/javax.websocket/javax.websocket-api -->
<dependency>
    <groupId>javax.websocket</groupId>
    <artifactId>javax.websocket-api</artifactId>
    <version>1.1</version>
    <scope>provided</scope>
</dependency>

Solution 2:[2]

I used dependency javax.websocket, but it turned out that the problem was only with my Mozilla Firefox browser. If someone also had this problem, I recommend checking it on Chrome or Edge because it worked for me.

I still don't know what the problem with Firefox is, but in my case I don't have to solve it - it's important that it works on other browsers.

Thank you Mehdi Rahimi for your help.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Septi9