apache / apache/pulsar

Pulsar Function's cannot reference classes inside NAR file when running Pulsar in standalone mode

Open
#13,128 3 comments 0 reactions 0 assignees View on GitHub
lifecycle/stale Stale type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

**Describe the bug**
If you are running Apache Pulsar in standalone mode, either via a docker image, minikube, or locally and submit a Pulsar Function that references a class that is included in a separate jar file inside the META-INF/bundled-dependencies folder of the NAR file you will get a java.lang.TypeNotPresentException

**To Reproduce**
Steps to reproduce the behavior:
1. Start Pulsar in standalone mode following the instructions here: https://pulsar.apache.org/docs/en/standalone-docker/
2. Download the following NAR [file](https://github.com/david-streamlio/GottaEat/releases/download/v.0.0.1/order-validation-service-1.0.0.nar) and copy it to the /tmp folder inside the docker container using "docker cp"
3. Down the attached function config file and rename it to order-validation-service-config.yml
4. Copy the order-validation-service-config.yml file to the /tmp folder inside the docker container using "docker cp" (https://docs.docker.com/engine/reference/commandline/cp/)
5. Create the Function using the following command:

`/pulsar/bin/pulsar-admin functions create --jar /tmp/order-validation-service-1.0.0.nar --function-config-file /tmp/order-validation-service-config.yml`

6. See error

`ERROR org.apache.pulsar.functions.worker.rest.api.FunctionsImpl - Invalid register Function request @ /gottaeat/services/order-validation-service

java.lang.TypeNotPresentException: Type com.gottaeat.domain.order.FoodOrder not present`

7. Note that the missing class, com.gottaeat.domain.order.FoodOrder, is inside the META-INF/bundled-dependencies/domain-schema-1.0.0.jar artifact inside the NAR

**Expected behavior**
The Pulsar Function should be created and the call to create should complete successfully.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: iOS

[order-validation-service-config.yml.txt](https://github.com/apache/pulsar/files/7651462/order-validation-service-config.yml.txt)

**Additional context**
This had previously worked in prior versions. The

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure in standalone mode with the supplied order-validation-service-1.0.0.nar and order-validation-service-config.yml, using the documented pulsar-admin functions create command. Trace the java.lang.TypeNotPresentException for FoodOrder and its loading from META-INF/bundled-dependencies/domain-schema-1.0.0.jar. Done means the function creation completes successfully when the referenced class is packaged in the NAR.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.