Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in DefaultClientFactory.newClient #3867

Closed
mauhiz opened this issue Oct 11, 2021 · 0 comments · Fixed by #3868
Closed

NPE in DefaultClientFactory.newClient #3867

mauhiz opened this issue Oct 11, 2021 · 0 comments · Fixed by #3868
Labels
Milestone

Comments

@mauhiz
Copy link
Contributor

mauhiz commented Oct 11, 2021

Version : 1.11

Caused by: java.lang.NullPointerException
        at com.linecorp.armeria.client.DefaultClientFactory.newClient(DefaultClientFactory.java:174)
        at com.linecorp.armeria.client.ClientBuilder.build(ClientBuilder.java:112)

I'm seeing this NPE trying to connect to the scheme gproto+h2c. It works locally and fails only on a uber jar.
Definitely something is missing or mis-configured, but the error is just too cryptic...

Investigation results

The actual factory is a UnaryGrpcClientFactory (added in #3773) and its condition to accept a clientType is clientType == UnaryGrpcClient.class. Why is the other factory (GrpcClientFactory) not present?

It's reference via a ServiceLoader config file, which is present in the uber jar;
Actually both service loader config files are present (duplicate entries).
Fixing the jar building process to merge the service properties into a single com.linecorp.armeria.client.ClientFactoryProvider jar entry fixed the concrete issue.

Finally

mauhiz added a commit to mauhiz/armeria that referenced this issue Oct 11, 2021
mauhiz added a commit to mauhiz/armeria that referenced this issue Oct 11, 2021
mauhiz added a commit to mauhiz/armeria that referenced this issue Oct 12, 2021
mauhiz added a commit to mauhiz/armeria that referenced this issue Oct 14, 2021
trustin pushed a commit that referenced this issue Oct 14, 2021
Motivation:

As described in #3867 , the error when a suitable ClientFactory could not be found is confusing.

Modifications:

- add a nice error message to help debugging.

Result:

- Closes #3867
- User (me) happiness increases.
@trustin trustin added the defect label Oct 14, 2021
@trustin trustin added this to the 1.13.0 milestone Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants