After creation of a separate spring application context, calls to LIST_DOCUMENTS - and to all other Rpc-Operations - result in a “method not found” error.
There is a bug in JsonRpcBatchOperationDispatcher#handleContextRefresh: it does not check if the ApplicationContext of the bean and the ApplicationContext of the event are the same:
@EventListener public void handleContextRefresh(ContextRefreshedEvent event) {
// missing: if (applicationContext.equals(event.getApplicationContext())) {
operations = event.getApplicationContext().getBeansWithAnnotation(RemoteOperation.class).values()
...
Hence handleContextRefresh is triggered from other ApplicationContexts as well.
This is not an academical problem, as there are frameworks which create their own contexts, e.g.
Spring Cloud LoadBalancer.
If this happens, then ‘operations’ become null and all Rpc-Operations disappear.
This situation has been properly adressed elsewhere in the code, e.g. in DataServicesCoreStartupListener#onApplicationEvent:
public void onApplicationEvent(ContextRefreshedEvent event) {
if (applicationContext.equals(event.getApplicationContext())) {
...
Would you please provide a fix or a workaround? Thx.
dataservices.version: 34.2.3