gpt4 book ai didi

java - springboot 2.0.5集成websocket错误

转载 作者:太空宇宙 更新时间:2023-11-04 10:10:29 24 4
gpt4 key购买 nike

enter image description here

enter image description here

控制台错误:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 11:36:58 spring-boot [main] ERROR o.s.boot.SpringApplication - Application run failed java.lang.IllegalStateException: Failed to register @ServerEndpoint class: class com.simple.springbootbasic.basic.websocket.WebSocketServer$$EnhancerBySpringCGLIB$$50508009 at org.springframework.web.socket.server.standard.ServerEndpointExporter.registerEndpoint(ServerEndpointExporter.java:158) at org.springframework.web.socket.server.standard.ServerEndpointExporter.registerEndpoints(ServerEndpointExporter.java:133) at org.springframework.web.socket.server.standard.ServerEndpointExporter.afterSingletonsInstantiated(ServerEndpointExporter.java:111) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) at com.simple.springbootbasic.Application.main(Application.java:19) Caused by: javax.websocket.DeploymentException: Cannot deploy POJO class [com.simple.springbootbasic.basic.websocket.WebSocketServer$$EnhancerBySpringCGLIB$$50508009] as it is not annotated with @ServerEndpoint at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:203) at org.springframework.web.socket.server.standard.ServerEndpointExporter.registerEndpoint(ServerEndpointExporter.java:155) ... 12 common frames omitted 11:36:58 spring-boot [main] INFO o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@72ea6193: startup date [Thu Sep 20 11:36:53 CST 2018]; root of context hierarchy 11:36:58 spring-boot [main] INFO o.s.j.e.a.AnnotationMBeanExporter - Unregistering JMX-exposed beans on shutdown 11:36:58 spring-boot [main] INFO c.alibaba.druid.pool.DruidDataSource - {dataSource-1} closed Disconnected from the target VM, address: '127.0.0.1:2440', transport: 'socket'

进程已完成,退出代码为 1

最佳答案

我不知道您的项目包含什么,但当我有两个都注释为 @ServerEndpoint 的类时,我在自己的项目中遇到了相同的错误。每个项目应该只有一个端点,因此如果您的项目包含两个都带有 @ServerEndpoint 注解的类,只需从其中一个类中删除 @ServerEndpoint 注解即可。

关于java - springboot 2.0.5集成websocket错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52417255/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com