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

validate group and password in Hibernate integration module #7978

Closed
gAmUssA opened this issue Apr 19, 2016 · 2 comments

Comments

Projects
None yet
4 participants
@gAmUssA
Copy link

commented Apr 19, 2016

Hazelcast Hibernate module
User didn't specify

<property name="hibernate.cache.hazelcast.native_client_group">dev</property>
<property name="hibernate.cache.hazelcast.native_client_password">dev-pass</property>

NPE thrown during establisging a connection to the cluster

[4/18/16 15:29:46:289 EDT] 0000008d ClusterListen 3 
com.hazelcast.client.spi.impl.ClusterListenerSupport Trying to connect to 
Address[172.27.34.221]:5701 
[4/18/16 15:29:46:297 EDT] 0000008d ClientConnect W 
com.hazelcast.client.connection.nio.ClientConnection Connection 
[/172.27.34.221:5701] lost. Reason: java.lang.NullPointerException[null] 
[4/18/16 15:29:46:297 EDT] 0000008d ClusterListen 3 
com.hazelcast.client.spi.impl.ClusterListenerSupport Exception during 
initial connection to /172.27.34.221:5701 
java.lang.NullPointerException 
at 
com.hazelcast.client.impl.protocol.util.ParameterUtil.calculateDataSize(ParameterUtil.java:31) 
at 
com.hazelcast.client.impl.protocol.codec.ClientAuthenticationCodec$RequestParameters.calculateDataSize(ClientAuthenticationCodec.java:37) 
at 
com.hazelcast.client.impl.protocol.codec.ClientAuthenticationCodec.encodeRequest(ClientAuthenticationCodec.java:62) 
at 
com.hazelcast.client.spi.impl.ClusterListenerSupport$ManagerAuthenticator.authenticate(ClusterListenerSupport.java:127) 
at 
com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.authenticate(ClientConnectionManagerImpl.java:249) 
@kobalski

This comment has been minimized.

Copy link
Contributor

commented Apr 19, 2016

@gAmUssA An extra validation is not required in this case. Because if group name and password is not provided in hibernate config, default values in client config are used which are dev and dev-pass. See the code : https://github.com/hazelcast/hazelcast-hibernate/blob/master/hazelcast-hibernate4/src/main/java/com/hazelcast/hibernate/instance/HazelcastClientLoader.java#L64

Also client config does not allow null values and does its validation correctly. I checked out user's configuration even though they do not provide
<property name="hibernate.cache.hazelcast.native_client_group">dev</property>
<property name="hibernate.cache.hazelcast.native_client_password">dev-pass</property>
in their hibernate config xml, they provide
<property name="cache.hazelcast.configuration_file_path"> /hazelcast-client.xml</property>
property which loads client config from an external xml file and if you check that you can see the group name and password are set in there.

I do not know the reason of NPE right now (maybe client/member version mismatch) , I can say group name and password are not required fields in hibernate config if not provided default values are used. So we do not need extra validation.

@emre-aydin emre-aydin self-assigned this Dec 15, 2016

@emre-aydin emre-aydin added this to the 3.8 milestone Dec 15, 2016

@emre-aydin

This comment has been minimized.

Copy link
Contributor

commented Dec 15, 2016

Closing this as the reported problem does not occur.

@emre-aydin emre-aydin closed this Dec 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.