Skip to content

[ISSUE 6408] Fix NumberFormatException#8143

Merged
codelipenghui merged 6 commits intoapache:masterfrom
315157973:exception
Oct 12, 2020
Merged

[ISSUE 6408] Fix NumberFormatException#8143
codelipenghui merged 6 commits intoapache:masterfrom
315157973:exception

Conversation

@315157973
Copy link
Contributor

Fixes #6408

Motivation

1)ExecutionException cannot be cast to org.apache.pulsar.client.admin.PulsarAdminException
2)Client cannot recognize multiple addresses

Modifications

support multiple addresses

Verifying this change

PulsarFunctionPublishTest#testMultipleAddress

@315157973
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@315157973
Copy link
Contributor Author

/pulsarbot run-failure-checks

@315157973
Copy link
Contributor Author

/pulsarbot run-failure-checks

@315157973
Copy link
Contributor Author

/pulsarbot run-failure-checks

3 similar comments
@315157973
Copy link
Contributor Author

/pulsarbot run-failure-checks

@315157973
Copy link
Contributor Author

/pulsarbot run-failure-checks

@315157973
Copy link
Contributor Author

/pulsarbot run-failure-checks

@rdehouss
Copy link

rdehouss commented Oct 1, 2020

@315157973, waiting that this is reviewed and accepted, could you provide the "patched" jar files so that I can try to see if it helps?
I'm kinda stuck trying to create a function in my cluster with these "cannot be cast to org.apache.pulsar.client.admin.PulsarAdminException"
That would help me a lot, thanks!

@315157973
Copy link
Contributor Author

@315157973, waiting that this is reviewed and accepted, could you provide the "patched" jar files so that I can try to see if it helps?
I'm kinda stuck trying to create a function in my cluster with these "cannot be cast to org.apache.pulsar.client.admin.PulsarAdminException"
That would help me a lot, thanks!

Only 3 files have been modified, you can copy them directly to your local.
If you want to reproduce the above problem, roll back lines 194-198 of PulsarAdmin.java, and then execute the unit test PulsarFunctionPublishTest#testMultipleAddress.

@rdehouss
Copy link

rdehouss commented Oct 1, 2020

I use pulsar in the docker and the jar files present contains only .class files so I cannot even update the files directly in the jar files.

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

Copy link
Contributor

@jianyun8023 jianyun8023 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I saw here seems to be that the NumberFormatException is run out correctly, and it does not solve the problem that Pulsar Function does not support multi-service Url.

Comment on lines +194 to 199
ServiceURI serviceUri = ServiceURI.create(serviceUrl);
root = client.target(String.format("%s://%s"
, serviceUri.getServiceScheme()
, serviceUri.getServiceHosts()[ThreadLocalRandom.current()
.nextInt(serviceUri.getServiceHosts().length)]));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a little doubt. Is this fixed the problem that the pulsar function does not support multi-service URLs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a little doubt. Is this fixed the problem that the pulsar function does not support multi-service URLs?

Yes, when we create a Function, the Client initiates a request. Since multi-service URLs are not supported here, a NumberFormatException will be thrown.
When you restore this code, then update the jar to the lib, create a Function with cli, you can reproduce the previous bug.

@codelipenghui codelipenghui merged commit a6908b8 into apache:master Oct 12, 2020
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Nov 13, 2020
Fixes apache#6408

### Motivation
1)ExecutionException cannot be cast to org.apache.pulsar.client.admin.PulsarAdminException
2)Client cannot recognize multiple addresses

### Modifications
support multiple addresses
@315157973 315157973 deleted the exception branch November 28, 2020 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not able to create a Pulsar function

6 participants

Comments