Call to LIST_DOCUMENTS results in "method not found"

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

Hi @anon67142020,

So far we have not considered this use-case for different application contexts but it should not be too hard to only react to the events from our application context. This is very reasonable. Please create A12 ticket withdata services component for this and we will take a look

Cheers,
Tomas

Hi @tomas-thin-gale,
thanks for the quick reply. We do not have access to mgm’s Jira.
Could someone else please create said ticket (@henner-grey-void @denise-narrow-token or @dave-golden-layer maybe)?
Thanks, Alex

Hi @anon67142020,
I have created A12-14112 for this.

Hi @anon67142020,

We will provide fixes for the issues you found in 2023.02 and we port the fix also to the 2022.06-ext (DS 34.2.4) which should be released roughly in a month.