-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DefaultManagedTaskScheduler created manually now throws a NPE if the scheduled executor is not configured #31751
Comments
Not without more information I'm afraid. Could you please provide a sample application that reproduces the problem. |
I had the same problem with version 3.2.0. I suspect that the problem is caused by the websocket (MessageBroker). If I comment the following lines in the WebSocketMessageBrokerConfigurer implementation, the problem is solved. @Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/public", "/private").setHeartbeatValue(new long[] { HEART_BEAT, HEART_BEAT }).setTaskScheduler(new DefaultManagedTaskScheduler());
config.setUserDestinationPrefix("/user");
} In my case, this is shown in the log:
|
The problem in my case is solved by not setting the DefaultManagedTaskScheduler in the MessageBrokerRegistry, but by registering a custom TaskScheduler:
|
This helped, thanks! |
I think this might be a result of #27914. The following code is enough to trigger the exception.
I'm not sure if this is a bug or not. The same code with the previous version of Spring would create a |
@bclozel Could you please transfer this to the Framework issue tracker so that someone from that team can make an assessment? |
This comment was marked as outdated.
This comment was marked as outdated.
@fullopt can you confirm you're also using |
Exactly, I used |
@szolen and @fullopt for the record As for creating the scheduler as a bean, this should have been done in the first place as the context needs that in order to honor the lifecycle, both during the startup phase, and the shutdown phase. Creating such a class manually is not the expected behavior. As such the use cases above will still throw an exception, a different one though now. |
Yes, I thought from the name that this was the default scheduler. However, on the configuration class I used an |
After upgrading from 3.1.5 to 3.2.0 my application fails:
org.springframework.context.ApplicationContextException: Failed to start bean 'simpleBrokerMessageHandler'
The reason:
Can you please help me to fix it?
The text was updated successfully, but these errors were encountered: