[ https://issues.apache.org/jira/browse/GEODE-10038?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Kevo reassigned GEODE-10038: ---------------------------------- Assignee: (was: Mario Kevo) > Trying to access the QueryService results in NPE on server restart from > deployed Jar > ------------------------------------------------------------------------------------ > > Key: GEODE-10038 > URL: https://issues.apache.org/jira/browse/GEODE-10038 > Project: Geode > Issue Type: Bug > Components: functions > Affects Versions: 1.12.8, 1.13.7, 1.14.3, 1.15.0 > Reporter: Udo Kohlmeyer > Priority: Major > > After deploying a jar which contains a Function, restarting the server causes > an NPE. > Using the Function definition of: > {code:java} > public class CustomFunction implements Function { > private GemFireCache cache; > private QueryService queryService; > public CustomFunction() { > this.cache = CacheFactory.getAnyInstance(); > this.queryService = cache.getQueryService(); > } > {code} > Due to the startup flow > https://github.com/apache/geode/blob/develop/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java#L1404 > the registration of Functions are initialized from cluster configuration > [here|https://github.com/apache/geode/blob/develop/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java#L1419]. > There is a dependency on the `QueryService` to be available at Function > construction time, but given that the services are only initialized > [here|https://github.com/apache/geode/blob/develop/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java#L1435], > the call to the `cache.getQueryService` fails with an NPE > [here|https://github.com/apache/geode/blob/develop/geode-core/src/main/java/org/apache/geode/cache/query/internal/DefaultQueryService.java#L116-L117] -- This message was sent by Atlassian Jira (v8.20.10#820010)