我是靠谱客的博主 高高砖头,这篇文章主要介绍Error creating bean with name 'serverEndpointExporter' defined in class path,现在分享给大家,希望可以做个参考。

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

        <!--去除内嵌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>

如果打包就报错的话,把pom里的test依赖删掉,把测试类也删掉

或者在测试类里加个这东西就可以了

最后

以上就是高高砖头最近收集整理的关于Error creating bean with name 'serverEndpointExporter' defined in class path的全部内容,更多相关Error内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(46)

评论列表共有 0 条评论

立即
投稿
返回
顶部