nlu90 opened a new issue #11416: URL: https://github.com/apache/pulsar/issues/11416
**Describe the bug** In Standalone puslar cluster with functions_worker.yaml config `exposeAdminClientEnabled ` set to true, the `context. getPulsarAdmin` results in exception. The function worker config: ``` 12:17:32.511 [main] INFO org.apache.pulsar.functions.worker.PulsarWorkerService - Worker Configs: { ... "functionRuntimeFactoryClassName" : "org.apache.pulsar.functions.runtime.process.ProcessRuntimeFactory", "functionRuntimeFactoryConfigs" : { "logDirectory" : "logs/", "javaInstanceJarLocation" : null, "pythonInstanceLocation" : null, "extraFunctionDependenciesDir" : null }, ... "exposeAdminClientEnabled" : true, ... } ``` The submitted function instance config: ``` 12:31:29.940 [main] INFO org.apache.pulsar.functions.runtime.thread.ThreadRuntime - ThreadContainer starting function with instance config InstanceConfig(instanceId=0, functionId=c5d55f78-f348-416a-8d17-f28282e01d46, functionVersion=8a0bfd6b-a50b-4ff5-8225-ee2665cf8347, functionDetails=tenant: "public" namespace: "default" name: "Fun1" className: "com.mycompany.app.Fun1" autoAck: true parallelism: 1 source { typeClassName: "java.lang.String" inputSpecs { key: "public/default/fun-test" value { } } cleanupSubscription: true } sink { typeClassName: "java.lang.Void" forwardSourceMessageProperty: true } resources { cpu: 1.0 ram: 1073741824 disk: 10737418240 } componentType: FUNCTION , maxBufferedTuples=1024, functionAuthenticationSpec=null, port=63952, clusterName=standalone, maxPendingAsyncRequests=1000, exposePulsarAdminClientEnabled=false, metricsPort=63953) ``` The exception reported in function: ``` 12:40:19.045 [public/default/Fun1-0] WARN org.apache.pulsar.functions.instance.JavaInstanceRunnable - Encountered exception when processing message PulsarRecord(topicName=Optional[persistent://public/default/fun-test], partition=0, +++message=Optional[org.apache.pulsar.client.impl.MessageImpl@59891d01], schema=org.apache.pulsar.client.impl.schema.StringSchema@3d30f554, failFunction=org.apache.pulsar.functions.source.PulsarSource$$Lambda$132/1682734103@52404c29, ackFunction=org. +++apache.pulsar.functions.source.PulsarSource$$Lambda$131/512461256@3c125f38) java.lang.IllegalStateException: PulsarAdmin is not enabled in function worker at org.apache.pulsar.functions.instance.ContextImpl.getPulsarAdmin(ContextImpl.java:347) ~[org.apache.pulsar-pulsar-functions-instance-2.8.0.jar:?] at com.mycompany.app.Fun1.process(Fun1.java:30) ~[?:?] at com.mycompany.app.Fun1.process(Fun1.java:13) ~[?:?] at org.apache.pulsar.functions.instance.JavaInstance.handleMessage(JavaInstance.java:95) ~[org.apache.pulsar-pulsar-functions-instance-2.8.0.jar:?] at org.apache.pulsar.functions.instance.JavaInstanceRunnable.run(JavaInstanceRunnable.java:271) [org.apache.pulsar-pulsar-functions-instance-2.8.0.jar:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241] ``` **To Reproduce** Steps to reproduce the behavior: 1. Set `exposeAdminClientEnabled ` to true for functions_worker.yaml 2. launch the pulsar standalone cluster 3. prepare a function that calls `context. getPulsarAdmin` in the `process` body. **Expected behavior** context should return the pulsar admin correctly -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org