出现这个错的原因是在部署项目的时候,项目中含有websocket的@ServerEndpoint注解的时候,如果项目是springboot项目,去除内置tomcat的时候会把websocket的包也给删除掉,所以需要手动加上.加上这个包,然后再打war包,部署到linux的tomcat下就没问题了.

Error creating bean with name 'serverEndpointExporter' defined in class path

        <!--去除内嵌tomcat-->
       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-websocket -->
        <!--websocket依赖包-->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-websocket</artifactId>
            <version>8.5.23</version>
        </dependency>

 

相关文章: