我在春季启动时创建了一个网络套接字,并将其部署到Cloud Foundry中。 在localhost中,它运行良好,但是在Cloud Foundry中,它说与stompEndPoint的连接丢失
无法加载资源:服务器响应状态为404(未找到) stomp.min.js:8 正在打开Web套接字... abstract-xhr.js:132 GET https://“ CF APP URL” / websocket-example / info?t = 1536076909829 404(未找到) 哎呀!断开与https://“ CF APP URL” / websocket-example
的连接代码如下:
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer{
private static final Logger LOG = (Logger) LoggerFactory.getLogger(WebSocketConfig.class);
@Override
public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {
try {
stompEndpointRegistry
.addEndpoint("/websocket-example")
.setAllowedOrigins("*")
.withSockJS();
}catch(Exception e) {
LOG.error("WebSocketConfig in Exception : {}. Caused by: ", e.getMessage(), e);
}
}
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/topic");
registry.setApplicationDestinationPrefixes("/app");
}
此错误的可能原因是什么?