com.gemstone.gemfire.cache.execute.FunctionException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Encountered a {{NullPointerException}} in the {{DefaultFunctionArgumentResolver}} class when executing a GemFire Function declared without arguments and not explicitly passing any arguments (as any dev would expect). {code:java} com.gemstone.gemfire.cache.execute.FunctionException: java.lang.NullPointerException at com.gemstone.gemfire.internal.cache.execute.LocalResultCollectorImpl.setException(LocalResultCollectorImpl.java:189) at com.gemstone.gemfire.internal.cache.execute.DistributedRegionFunctionResultSender.setException(DistributedRegionFunctionResultSender.java:228) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.handleException(AbstractExecution.java:607) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:378) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution$2.run(AbstractExecution.java:316) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at com.gemstone.gemfire.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:692) at com.gemstone.gemfire.distributed.internal.DistributionManager$8$1.run(DistributionManager.java:1116) at java.lang.Thread.run(Thread.java:695) Caused by: java.lang.NullPointerException at org.springframework.data.gemfire.function.DefaultFunctionArgumentResolver.resolveFunctionArguments(DefaultFunctionArgumentResolver.java:30) at org.springframework.data.gemfire.function.FunctionContextInjectingArgumentResolver.resolveFunctionArguments(FunctionContextInjectingArgumentResolver.java:86) at org.springframework.data.gemfire.function.PojoFunctionWrapper.execute(PojoFunctionWrapper.java:107) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:352) ... 6 more {code} The workaround to avoiding this NPE is simple, a developer just needs to pass an empty Object array to the Execution.withArgs(..) method like so... {code:java} FunctionService.onRegion(appData).withArgs(new Object[0]); {code} Unfortunately, GemFire's FunctionContext implementing class returns NULL instead of an empty Object array (as it should) when no arguments were specified, or rather when the Function takes no arguments.
    via by John Blum,
  • Encountered a {{NullPointerException}} in the {{DefaultFunctionArgumentResolver}} class when executing a GemFire Function declared without arguments and not explicitly passing any arguments (as any dev would expect). {code:java} com.gemstone.gemfire.cache.execute.FunctionException: java.lang.NullPointerException at com.gemstone.gemfire.internal.cache.execute.LocalResultCollectorImpl.setException(LocalResultCollectorImpl.java:189) at com.gemstone.gemfire.internal.cache.execute.DistributedRegionFunctionResultSender.setException(DistributedRegionFunctionResultSender.java:228) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.handleException(AbstractExecution.java:607) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:378) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution$2.run(AbstractExecution.java:316) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at com.gemstone.gemfire.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:692) at com.gemstone.gemfire.distributed.internal.DistributionManager$8$1.run(DistributionManager.java:1116) at java.lang.Thread.run(Thread.java:695) Caused by: java.lang.NullPointerException at org.springframework.data.gemfire.function.DefaultFunctionArgumentResolver.resolveFunctionArguments(DefaultFunctionArgumentResolver.java:30) at org.springframework.data.gemfire.function.FunctionContextInjectingArgumentResolver.resolveFunctionArguments(FunctionContextInjectingArgumentResolver.java:86) at org.springframework.data.gemfire.function.PojoFunctionWrapper.execute(PojoFunctionWrapper.java:107) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:352) ... 6 more {code} The workaround to avoiding this NPE is simple, a developer just needs to pass an empty Object array to the Execution.withArgs(..) method like so... {code:java} FunctionService.onRegion(appData).withArgs(new Object[0]); {code} Unfortunately, GemFire's FunctionContext implementing class returns NULL instead of an empty Object array (as it should) when no arguments were specified, or rather when the Function takes no arguments.
    via by John Blum,
  • I have a case that my gemfire function should not have any arguments. Although according to the gemfire API it is perfectly fine to define functions without arguments, when I tried my function I got a NPE back. To reproduce it you can define a simple function like: @GemfireFunction(hasResult=true) public void test(){ logger.info("test() is called!"); } And call it from gfsh : gfsh>execute function --id=test And you would see the following Exception in the server log: [severe 2014/01/06 13:30:02.683 EST server1 <Function Execution Processor2> tid=0x40] UnExpected exception during function execution local member java.lang.NullPointerException at org.springframework.data.gemfire.function.DefaultFunctionArgumentResolver.resolveFunctionArguments(DefaultFunctionArgumentResolver.java:30) at org.springframework.data.gemfire.function.FunctionContextInjectingArgumentResolver.resolveFunctionArguments(FunctionContextInjectingArgumentResolver.java:86) at org.springframework.data.gemfire.function.PojoFunctionWrapper.execute(PojoFunctionWrapper.java:107) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:352) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution$2.run(AbstractExecution.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at com.gemstone.gemfire.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:692) at com.gemstone.gemfire.distributed.internal.DistributionManager$8$1.run(DistributionManager.java:1116) at java.lang.Thread.run(Thread.java:744)
    via by Abtin Afshar,
  • I have a case that my gemfire function should not have any arguments. Although according to the gemfire API it is perfectly fine to define functions without arguments, when I tried my function I got a NPE back. To reproduce it you can define a simple function like: @GemfireFunction(hasResult=true) public void test(){ logger.info("test() is called!"); } And call it from gfsh : gfsh>execute function --id=test And you would see the following Exception in the server log: [severe 2014/01/06 13:30:02.683 EST server1 <Function Execution Processor2> tid=0x40] UnExpected exception during function execution local member java.lang.NullPointerException at org.springframework.data.gemfire.function.DefaultFunctionArgumentResolver.resolveFunctionArguments(DefaultFunctionArgumentResolver.java:30) at org.springframework.data.gemfire.function.FunctionContextInjectingArgumentResolver.resolveFunctionArguments(FunctionContextInjectingArgumentResolver.java:86) at org.springframework.data.gemfire.function.PojoFunctionWrapper.execute(PojoFunctionWrapper.java:107) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:352) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution$2.run(AbstractExecution.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at com.gemstone.gemfire.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:692) at com.gemstone.gemfire.distributed.internal.DistributionManager$8$1.run(DistributionManager.java:1116) at java.lang.Thread.run(Thread.java:744)
    via by Abtin Afshar,
    • com.gemstone.gemfire.cache.execute.FunctionException: java.lang.NullPointerException at com.gemstone.gemfire.internal.cache.execute.LocalResultCollectorImpl.setException(LocalResultCollectorImpl.java:189) at com.gemstone.gemfire.internal.cache.execute.DistributedRegionFunctionResultSender.setException(DistributedRegionFunctionResultSender.java:228) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.handleException(AbstractExecution.java:607) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:378) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution$2.run(AbstractExecution.java:316) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at com.gemstone.gemfire.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:692) at com.gemstone.gemfire.distributed.internal.DistributionManager$8$1.run(DistributionManager.java:1116) at java.lang.Thread.run(Thread.java:695) Caused by: java.lang.NullPointerException at org.springframework.data.gemfire.function.DefaultFunctionArgumentResolver.resolveFunctionArguments(DefaultFunctionArgumentResolver.java:30) at org.springframework.data.gemfire.function.FunctionContextInjectingArgumentResolver.resolveFunctionArguments(FunctionContextInjectingArgumentResolver.java:86) at org.springframework.data.gemfire.function.PojoFunctionWrapper.execute(PojoFunctionWrapper.java:107) at com.gemstone.gemfire.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:352) ... 6 more
    No Bugmate found.