Issue
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:
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
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>
Answered By - Mehdi Rahimi
Answer Checked By - Timothy Miller (JavaFixing Admin)