registry icon indicating copy to clipboard operation
registry copied to clipboard

SchemaRegistryClient static block can throw exception causing NoClassDefFound

Open bbende opened this issue 6 years ago • 2 comments

https://github.com/hortonworks/registry/blob/master/schema-registry/client/src/main/java/com/hortonworks/registries/schemaregistry/client/SchemaRegistryClient.java#L160-L175

If this block of code throws an exception besides LoginException then it will cause a failure to initialize the class which will result in a NoClassDefFound error.

Also, this block of code seems to assume that if the system property java.security.auth.login.config is set, then schema registry is kerberized and there will be a Registry entry in the JAAS file.

What if the JVM has java.security.auth.login.config set for interacting with other systems, but Registry is not actually kerberized? We wouldn't want to attempt a login in that case.

bbende avatar Dec 06 '18 15:12 bbende

@bbende Did you run in to a scenario where an exception other than LoginException was thrown? If so, it has to be a bug that needs to be fixed in the code. I could not find a bug. Let me know your scenario where you need to worry about other exception types.

In case, java.security.auth.login.config is set and there is no RegistryClient section it should throw a LoginException while trying to logging in, caught by the block of code you highlighted and subject should be null making RegistryClient non-kerberized. Are you running in to any issues? It should just work fine.

priyank5485 avatar Jan 11 '19 18:01 priyank5485

More than one NiFi user has run into this... in the last case they said they had a typo in their JAAS file:

http://apache-nifi.1125220.n5.nabble.com/nifi-1-7-1-strange-HortonworksSchemaRegistry-error-td25620.html

I don't know what the real exception was that happened since all we could see was the NoClassDefFound error.

bbende avatar Jan 11 '19 18:01 bbende

Closed due to inactivity.

gcsaba2 avatar Oct 05 '22 12:10 gcsaba2