title: Caused by: javax.websocket.DeploymentException: The path [websocket] is not valid
body: <pre><code> **16-Jul-2016 15:50:39.774 SEVERE [localhost-startStop-1]  
   org.apache.catalina.core.StandardContext.startInternal Error during ServletContainerInitializer processing
      javax.servlet.ServletException: javax.websocket.DeploymentException: The path [websocket] is not valid.
          at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:123)
          at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5292)
          at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
          at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
          at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092)
          at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
  Caused by: javax.websocket.DeploymentException: The path [websocket] is not valid.
          at org.apache.tomcat.websocket.server.UriTemplate.&lt;init&gt;(UriTemplate.java:48)
          at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:200)
          at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:279)
          at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:120)
      ... 12 more**
  </code></pre>
  
  <p>the code of websocket(java):</p>
  
  <pre><code>**import java.io.IOException;
  import javax.websocket.ClientEndpoint;
  import javax.websocket.OnError;
  import javax.websocket.OnMessage;
  import javax.websocket.OnOpen;
  import javax.websocket.OnClose;
  import javax.websocket.Session; 
  import javax.websocket.server.ServerEndpoint;
  import java.util.concurrent.CopyOnWriteArraySet;
  import java.util.concurrent.atomic.AtomicInteger;
  import java.util.*;
  @ServerEndpoint("webDemo/chat")
  public class ChatEntpoint{
      private static final String GUEST_PREFIX = "访客";
      private static final AtomicInteger connectionIds = new AtomicInteger(0);
      private static final Set&lt;ChatEntpoint&gt; clientSet = new      CopyOnWriteArraySet&lt;&gt;();
      private final String nickname;
      private Session session;
      public ChatEntpoint(){
          nickname = GUEST_PREFIX + connectionIds.getAndIncrement();
      }
      @OnOpen
      public void start(Session session){
          this.session = session;
          clientSet.add(this);
          String message = String.format("【%s %s】",nickname,"加入了聊天室！");
          broadcast(message);
      }
      @OnClose
      public void end(){
          clientSet.remove(this);
          String message = String.format("【%s %s】",nickname,"离开了聊天室！");
          broadcast(message);
      }
      @OnMessage
      public void incoming(String message){
          String filteredMessage = String.format("【%s %s】",nickname,filter(message));
          broadcast(filteredMessage);
      }
      @OnError
      public void OnError(Throwable t) throws Throwable{
           System.out.println("WebSocket服务器端错误" + t);
      }
      private static void broadcast(String msg){
          for(ChatEntpoint client:clientSet){
              try{
                  synchronized(client){
                      client.session.getBasicRemote().sendText(msg);
                  }
              }
              catch(IOException e){
                  System.out.println("聊天错误，向客户端"+client+"发送消息出现错误!");
                  clientSet.remove(client);
                  try{
                      client.session.close();
                  }
                  catch(IOException e1){}
                  String message = String.format("【%s %s】",client.nickname,"已经被断开了连接!");
                  broadcast(message);             
              }
          } 
      }
      private static String filter(String message){
          if(message == null){
              return null;
          }
          char content[] = new char[message.length()];
          message.getChars(0,message.length(),content,0);
          StringBuilder result = new StringBuilder(content.length + 50);
          for(int i=0;i&lt;content.length;i++){
              switch(content[i]){
                  case '&lt;':
                      result.append("&amp;lt;");
                      break;
                  case '&gt;':
                      result.append("&amp;gt;");
                      break;
                  case '&amp;':
                      result.append("&amp;amp;");
                      break;
                  case '"':
                      result.append("&amp;quot;");
                      break;
                  default:
                      result.append(content[i]);
               }   
          }
          return (result.toString());
      }
   }**
  </code></pre>
  
  <p>I try to build a real-time synchronization web-site.I have download the tomcat 8.0, and building the websocket server in java.when l running the web,the browser error 404.The log is written:</p>
  
  <p>I am searching for a long time on net.But no use.Please help or try to give some ideas how to archive this.</p>
  
  <p>computer configuration:
  windows-7 64
  i5-3230M
  RAM 4G</p>