admin 管理员组

文章数量: 1086019

I'm having this exception calling @query in mongoDB reactive in webflux springboot 3.3.4 when a table result of first query is empty calling other repository to search in other table that have the record searched.

return productRepository
    .findBySearchKey(code, channel, touchpoint)
    .doOnNext(AEMProductData -> log.debug("{} product on Products in MongoDB: {}", logHash, AEMProductData.toString()))
    .map(aemProductEntity -> {
    DozerBeanMapper mapper = new DozerBeanMapper();
    BaseProductsResponse response = mapper.map(aemProductEntity, AEMProductResponse.class);
    
                            return response;
                })
                .switchIfEmpty(aemProductRepository
                                .findBySearchKey(code, channel, touchpoint)
                                .doOnNext(aemProductEntity -> log.debug("{} product on AEMProducts on MongoDB: {}", logHash, aemProductEntity.toString()))
                                .map(aemProductEntity -> {
                                    DozerBeanMapper mapper = new DozerBeanMapper();
                                    BaseProductsResponse response = mapper.map(aemProductEntity, AEMProductResponse.class);
                                    
                                    return response;
                                })
                );

In the switchEmpty generate exception in jdk.internal.reflect in method public Object invoke(Object obj, Object[] args) throws InvocationTargetException { we are using JDK21.0.6:

.switchIfEmpty(aemProductRepository
                                .findBySearchKey(code, channel, touchpoint)
                                .doOnNext(aemProductEntity -> log.debug("{} product on AEMProducts on MongoDB: {}", logHash, aemProductEntity.toString()))
                                .map(aemProductEntity -> {
                                    DozerBeanMapper mapper = new DozerBeanMapper();
                                    BaseProductsResponse response = mapper.map(aemProductEntity, AEMProductResponse.class);

Somebody can tell us what happening? We are using lombok hibernate and Mongo Reactive Repository and Springboot 3.3.4 with Webflux.

本文标签:

Error[2]: Invalid argument supplied for foreach(), File: /www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm, Line: 58
File: /www/wwwroot/roclinux.cn/tmp/route_read.php, Line: 205, include(/www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm)
File: /www/wwwroot/roclinux.cn/tmp/index.inc.php, Line: 129, include(/www/wwwroot/roclinux.cn/tmp/route_read.php)
File: /www/wwwroot/roclinux.cn/index.php, Line: 29, include(/www/wwwroot/roclinux.cn/tmp/index.inc.php)