daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 2019-01-24 12:33:59.163 ERROR 26516 --- [nio-8080-exec-6] o.a.catalina.connector.CoyoteAdapter     : Exception while processing an asynchronous request
  2.  
  3. java.lang.IllegalStateException: Calling [asyncError()] is not valid for a request with Async state [MUST_DISPATCH]
  4.     at org.apache.coyote.AsyncStateMachine.asyncError(AsyncStateMachine.java:440) ~[tomcat-embed-core-9.0.14.jar:9.0.14]
  5.     at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:512) [tomcat-embed-core-9.0.14.jar:9.0.14]
  6.     at org.apache.coyote.Request.action(Request.java:430) ~[tomcat-embed-core-9.0.14.jar:9.0.14]
  7.     at org.apache.catalina.core.AsyncContextImpl.setErrorState(AsyncContextImpl.java:382) ~[tomcat-embed-core-9.0.14.jar:9.0.14]
  8.     at org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:239) ~[tomcat-embed-core-9.0.14.jar:9.0.14]
  9.     at org.apache.coyote.AbstractProcessor.dispatch(AbstractProcessor.java:241) [tomcat-embed-core-9.0.14.jar:9.0.14]
  10.     at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53) [tomcat-embed-core-9.0.14.jar:9.0.14]
  11.     at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.14.jar:9.0.14]
  12.     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417) [tomcat-embed-core-9.0.14.jar:9.0.14]
  13.     at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.14.jar:9.0.14]
  14.     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_162]
  15.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_162]
  16.     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.14.jar:9.0.14]
  17.     at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
  18.    
  19. @Scheduled(fixedDelay = 2000L)
  20.       public void sendEvent()  {
  21.            TextMessage message = null;
  22.            try {
  23.                message = messageBlockingQueue.take();
  24.            } catch (InterruptedException e) {
  25.                e.printStackTrace();
  26.            }
  27.            for(SseEmitter sseEmitter:emitterMap.values()) {
  28.                TextMessage finalMessage = message;
  29.                    try {
  30.                        sseEmitter.send(finalMessage.getText());
  31.                    }  catch (IOException e) {
  32.                        sseEmitter.completeWithError(e);
  33.                    } catch (JMSException e) {
  34.                        e.printStackTrace();
  35.                    }
  36.             }
  37.         }
  38.    
  39. @CrossOrigin(allowCredentials = "true")
  40. @RequestMapping(value = "/event", method = RequestMethod.GET)
  41. public SseEmitter getEvent(HttpServletRequest request){
  42.     HttpSession session = request.getSession();
  43.     if(eventService.getEmitterMap().containsKey(session)){
  44.         System.out.println("existing sub found:"+session.getId());
  45.         return eventService.getEmitterMap().get(session);
  46.     }else{
  47.         final SseEmitter emitter = new SseEmitter(84000000000L);
  48.         eventService.register(session,emitter);
  49.         System.out.println("created new sub:"+session.getId());
  50.         return emitter;
  51.     }
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top