java.lang.IllegalStateException: More than one TaskScheduler and/or ScheduledExecutorService exist within the context. Remove all but one of the beans; or implement the SchedulingConfigurer interface and call ScheduledTaskRegistrar#setScheduler explicitly within the configureTasks() callback. Found the following beans: [defaultSockJsTaskScheduler, messageBrokerSockJsTaskScheduler]

Spring JIRA | tomas lin | 3 years ago
  1. 0

    We are trying to incorporate spring websockets into a Spring Boot application with a custom implementation that refreshes the SpringApplication. It seems that the implementation of SockJS instantiates two Task Schedulers: [defaultSockJsTaskScheduler, messageBrokerSockJsTaskScheduler] If spring-websocket is disabled, everything seems to work fine. However, we run into a one TaskScheduler limitation of ScheduledAnnotationBeanPostProcessor whenever we try to refresh once we include the websocket functionality. It would be nice if spring-websockets played nice with SpringApplication.refresh. The error log is attached. 2014-02-28 15:12:37,956 ERROR com.netflix.server.base.BaseServer$UncaughtExceptionHandlerImpl:684 [main] [uncaughtException] from main java.lang.IllegalStateException: More than one TaskScheduler and/or ScheduledExecutorService exist within the context. Remove all but one of the beans; or implement the SchedulingConfigurer interface and call ScheduledTaskRegistrar#setScheduler explicitly within the configureTasks() callback. Found the following beans: [defaultSockJsTaskScheduler, messageBrokerSockJsTaskScheduler] at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:289) at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:72) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:776) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:142) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:616)

    Spring JIRA | 3 years ago | tomas lin
    java.lang.IllegalStateException: More than one TaskScheduler and/or ScheduledExecutorService exist within the context. Remove all but one of the beans; or implement the SchedulingConfigurer interface and call ScheduledTaskRegistrar#setScheduler explicitly within the configureTasks() callback. Found the following beans: [defaultSockJsTaskScheduler, messageBrokerSockJsTaskScheduler]
  2. 0

    We are trying to incorporate spring websockets into a Spring Boot application with a custom implementation that refreshes the SpringApplication. It seems that the implementation of SockJS instantiates two Task Schedulers: [defaultSockJsTaskScheduler, messageBrokerSockJsTaskScheduler] If spring-websocket is disabled, everything seems to work fine. However, we run into a one TaskScheduler limitation of ScheduledAnnotationBeanPostProcessor whenever we try to refresh once we include the websocket functionality. It would be nice if spring-websockets played nice with SpringApplication.refresh. The error log is attached. 2014-02-28 15:12:37,956 ERROR com.netflix.server.base.BaseServer$UncaughtExceptionHandlerImpl:684 [main] [uncaughtException] from main java.lang.IllegalStateException: More than one TaskScheduler and/or ScheduledExecutorService exist within the context. Remove all but one of the beans; or implement the SchedulingConfigurer interface and call ScheduledTaskRegistrar#setScheduler explicitly within the configureTasks() callback. Found the following beans: [defaultSockJsTaskScheduler, messageBrokerSockJsTaskScheduler] at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:289) at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:72) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:776) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:142) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:616)

    Spring JIRA | 3 years ago | tomas lin
    java.lang.IllegalStateException: More than one TaskScheduler and/or ScheduledExecutorService exist within the context. Remove all but one of the beans; or implement the SchedulingConfigurer interface and call ScheduledTaskRegistrar#setScheduler explicitly within the configureTasks() callback. Found the following beans: [defaultSockJsTaskScheduler, messageBrokerSockJsTaskScheduler]
  3. 0

    Why does Spring 4 only allow one TaskScheduler in a context?

    Stack Overflow | 3 years ago | user2112901
    java.lang.IllegalStateException: More than one TaskScheduler and/or ScheduledExecutorService exist within the context. Remove all but one of the beans; or implement the SchedulingConfigurer interface and call ScheduledTaskRegistrar#setScheduler explicitly within the configureTasks() callback. Found the following beans: [commonScheduler, communicationTaskScheduler]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    The application is unable to connect to the database. It could be resolved by configuring access privileges on the database side.
  6. 0
    Execute mvn dependency:tree from your project's root directory.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      More than one TaskScheduler and/or ScheduledExecutorService exist within the context. Remove all but one of the beans; or implement the SchedulingConfigurer interface and call ScheduledTaskRegistrar#setScheduler explicitly within the configureTasks() callback. Found the following beans: [defaultSockJsTaskScheduler, messageBrokerSockJsTaskScheduler]

      at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent()
    2. Spring Context
      AbstractApplicationContext.finishRefresh
      1. org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:289)
      2. org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:72)
      3. org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
      4. org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
      5. org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:776)
      5 frames
    3. Spring Boot
      EmbeddedWebApplicationContext.finishRefresh
      1. org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:142)
      1 frame
    4. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485)
      1 frame
    5. Spring Boot
      SpringApplication.refresh
      1. org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
      2. org.springframework.boot.SpringApplication.refresh(SpringApplication.java:616)
      2 frames