Here is my environment : hive2.2+hadoop2.7.3  on server node25, 
my client use hive-jdbc-2.1.1+spring-jdbc-4.2.8.RELEASE 
my jdbc info:
spring.datasource.url=jdbc:hive2://192.168.156.25:10000/default
spring.datasource.username=hive
spring.datasource.password=hive
 In Junit ,I issue a single query test ??select * from mytest limit 5??, most 
time it result in exception:
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[na:1.8.0_121]
    at 
java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
 ~[na:1.8.0_121]
    at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) 
~[na:1.8.0_121]
    at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
 ~[na:1.8.0_121]
    at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) 
~[na:1.8.0_121]
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) 
~[na:1.8.0_121]
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 
~[na:1.8.0_121]
    at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_121]
    at org.apache.thrift.transport.TSocket.open(TSocket.java:221) 
~[libthrift-0.9.3.jar:0.9.3]
 it success very occassionally, but it has no problem using beeline .

I saw hiveserver2's debug info:
2017-03-28T15:00:24,380  INFO [HiveServer2-Handler-Pool: Thread-77] 
thrift.ThriftCLIService: Client protocol version: HIVE_CLI_SERVICE_PROTOCOL_V9
2017-03-28T15:00:24,415  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.SessionState: Created HDFS directory: 
/tmp/hive/hive/21f6c7fb-765a-45d6-8539-954334dd785c
2017-03-28T15:00:24,422  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.SessionState: Created local directory: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/scratchdir/21f6c7fb-765a-45d6-8539-954334dd785c
2017-03-28T15:00:24,427  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.SessionState: Created HDFS directory: 
/tmp/hive/hive/21f6c7fb-765a-45d6-8539-954334dd785c/_tmp_space.db
2017-03-28T15:00:24,428  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.HiveSessionImpl: Operation log session directory is created: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/apache-hive-2.2.0-SNAPSHOT-bin/bin/${system:java.io.tmpdir}/${system:user.name}/operation_logs/21f6c7fb-765a-45d6-8539-954334dd785c
2017-03-28T15:00:24,428  INFO [HiveServer2-Handler-Pool: Thread-77] 
service.CompositeService: Session opened, SessionHandle 
[21f6c7fb-765a-45d6-8539-954334dd785c], current sessions:1
2017-03-28T15:00:25,668  INFO [HiveServer2-Handler-Pool: Thread-80] 
thrift.ThriftCLIService: Client protocol version: HIVE_CLI_SERVICE_PROTOCOL_V9
2017-03-28T15:00:25,691  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.SessionState: Created HDFS directory: 
/tmp/hive/hive/ffefbd59-3d34-4ce7-8c42-a150f74920a7
2017-03-28T15:00:25,698  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.SessionState: Created local directory: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/scratchdir/ffefbd59-3d34-4ce7-8c42-a150f74920a7
2017-03-28T15:00:25,708  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.SessionState: Created HDFS directory: 
/tmp/hive/hive/ffefbd59-3d34-4ce7-8c42-a150f74920a7/_tmp_space.db
2017-03-28T15:00:25,709  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.HiveSessionImpl: Operation log session directory is created: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/apache-hive-2.2.0-SNAPSHOT-bin/bin/${system:java.io.tmpdir}/${system:user.name}/operation_logs/ffefbd59-3d34-4ce7-8c42-a150f74920a7
2017-03-28T15:00:25,709  INFO [HiveServer2-Handler-Pool: Thread-80] 
service.CompositeService: Session opened, SessionHandle 
[ffefbd59-3d34-4ce7-8c42-a150f74920a7], current sessions:2
2017-03-28T15:00:26,968  INFO [HiveServer2-Handler-Pool: Thread-83] 
thrift.ThriftCLIService: Client protocol version: HIVE_CLI_SERVICE_PROTOCOL_V9
2017-03-28T15:00:26,990  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.SessionState: Created HDFS directory: 
/tmp/hive/hive/abdb3f41-ee98-41cd-9eac-9e6361e0a30d
2017-03-28T15:00:27,000  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.SessionState: Created local directory: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/scratchdir/abdb3f41-ee98-41cd-9eac-9e6361e0a30d
2017-03-28T15:00:27,008  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.SessionState: Created HDFS directory: 
/tmp/hive/hive/abdb3f41-ee98-41cd-9eac-9e6361e0a30d/_tmp_space.db
2017-03-28T15:00:27,009  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.HiveSessionImpl: Operation log session directory is created: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/apache-hive-2.2.0-SNAPSHOT-bin/bin/${system:java.io.tmpdir}/${system:user.name}/operation_logs/abdb3f41-ee98-41cd-9eac-9e6361e0a30d
2017-03-28T15:00:27,009  INFO [HiveServer2-Handler-Pool: Thread-83] 
service.CompositeService: Session opened, SessionHandle 
[abdb3f41-ee98-41cd-9eac-9e6361e0a30d], current sessions:3
2017-03-28T15:00:28,268  INFO [HiveServer2-Handler-Pool: Thread-86] 
thrift.ThriftCLIService: Client protocol version: HIVE_CLI_SERVICE_PROTOCOL_V9
2017-03-28T15:00:28,289  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.SessionState: Created HDFS directory: 
/tmp/hive/hive/24dd0e62-d11d-4fdb-a308-6c9853074304
2017-03-28T15:00:28,297  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.SessionState: Created local directory: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/scratchdir/24dd0e62-d11d-4fdb-a308-6c9853074304
2017-03-28T15:00:28,307  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.SessionState: Created HDFS directory: 
/tmp/hive/hive/24dd0e62-d11d-4fdb-a308-6c9853074304/_tmp_space.db
2017-03-28T15:00:28,308  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.HiveSessionImpl: Operation log session directory is created: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/apache-hive-2.2.0-SNAPSHOT-bin/bin/${system:java.io.tmpdir}/${system:user.name}/operation_logs/24dd0e62-d11d-4fdb-a308-6c9853074304
2017-03-28T15:00:28,308  INFO [HiveServer2-Handler-Pool: Thread-86] 
service.CompositeService: Session opened, SessionHandle 
[24dd0e62-d11d-4fdb-a308-6c9853074304], current sessions:4
2017-03-28T15:00:49,623  INFO [HiveServer2-Handler-Pool: Thread-77] 
service.CompositeService: Session closed, SessionHandle 
[21f6c7fb-765a-45d6-8539-954334dd785c], current sessions:3
2017-03-28T15:00:49,623  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.SessionState: Updating thread name to 
21f6c7fb-765a-45d6-8539-954334dd785c HiveServer2-Handler-Pool: Thread-77
2017-03-28T15:00:49,624  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.SessionState: Resetting thread name to  HiveServer2-Handler-Pool: 
Thread-77
2017-03-28T15:00:49,624  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.SessionState: Updating thread name to 
21f6c7fb-765a-45d6-8539-954334dd785c HiveServer2-Handler-Pool: Thread-77
2017-03-28T15:00:49,624  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.HiveSessionImpl: Operation log session directory is deleted: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/apache-hive-2.2.0-SNAPSHOT-bin/bin/${system:java.io.tmpdir}/${system:user.name}/operation_logs/21f6c7fb-765a-45d6-8539-954334dd785c
2017-03-28T15:00:49,625  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.SessionState: Resetting thread name to  HiveServer2-Handler-Pool: 
Thread-77
2017-03-28T15:00:49,636  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.SessionState: Deleted directory: 
/tmp/hive/hive/21f6c7fb-765a-45d6-8539-954334dd785c on fs with scheme hdfs
2017-03-28T15:00:49,637  INFO [HiveServer2-Handler-Pool: Thread-77] 
session.SessionState: Deleted directory: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/scratchdir/21f6c7fb-765a-45d6-8539-954334dd785c
 on fs with scheme file
2017-03-28T15:00:50,183  INFO [HiveServer2-Handler-Pool: Thread-80] 
service.CompositeService: Session closed, SessionHandle 
[ffefbd59-3d34-4ce7-8c42-a150f74920a7], current sessions:2
2017-03-28T15:00:50,184  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.SessionState: Updating thread name to 
ffefbd59-3d34-4ce7-8c42-a150f74920a7 HiveServer2-Handler-Pool: Thread-80
2017-03-28T15:00:50,184  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.SessionState: Resetting thread name to  HiveServer2-Handler-Pool: 
Thread-80
2017-03-28T15:00:50,184  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.SessionState: Updating thread name to 
ffefbd59-3d34-4ce7-8c42-a150f74920a7 HiveServer2-Handler-Pool: Thread-80
2017-03-28T15:00:50,185  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.HiveSessionImpl: Operation log session directory is deleted: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/apache-hive-2.2.0-SNAPSHOT-bin/bin/${system:java.io.tmpdir}/${system:user.name}/operation_logs/ffefbd59-3d34-4ce7-8c42-a150f74920a7
2017-03-28T15:00:50,185  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.SessionState: Resetting thread name to  HiveServer2-Handler-Pool: 
Thread-80
2017-03-28T15:00:50,193  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.SessionState: Deleted directory: 
/tmp/hive/hive/ffefbd59-3d34-4ce7-8c42-a150f74920a7 on fs with scheme hdfs
2017-03-28T15:00:50,194  INFO [HiveServer2-Handler-Pool: Thread-80] 
session.SessionState: Deleted directory: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/scratchdir/ffefbd59-3d34-4ce7-8c42-a150f74920a7
 on fs with scheme file
2017-03-28T15:00:50,779  INFO [HiveServer2-Handler-Pool: Thread-83] 
service.CompositeService: Session closed, SessionHandle 
[abdb3f41-ee98-41cd-9eac-9e6361e0a30d], current sessions:1
2017-03-28T15:00:50,780  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.SessionState: Updating thread name to 
abdb3f41-ee98-41cd-9eac-9e6361e0a30d HiveServer2-Handler-Pool: Thread-83
2017-03-28T15:00:50,780  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.SessionState: Resetting thread name to  HiveServer2-Handler-Pool: 
Thread-83
2017-03-28T15:00:50,780  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.SessionState: Updating thread name to 
abdb3f41-ee98-41cd-9eac-9e6361e0a30d HiveServer2-Handler-Pool: Thread-83
2017-03-28T15:00:50,781  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.HiveSessionImpl: Operation log session directory is deleted: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/apache-hive-2.2.0-SNAPSHOT-bin/bin/${system:java.io.tmpdir}/${system:user.name}/operation_logs/abdb3f41-ee98-41cd-9eac-9e6361e0a30d
2017-03-28T15:00:50,781  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.SessionState: Resetting thread name to  HiveServer2-Handler-Pool: 
Thread-83
2017-03-28T15:00:50,792  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.SessionState: Deleted directory: 
/tmp/hive/hive/abdb3f41-ee98-41cd-9eac-9e6361e0a30d on fs with scheme hdfs
2017-03-28T15:00:50,793  INFO [HiveServer2-Handler-Pool: Thread-83] 
session.SessionState: Deleted directory: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/scratchdir/abdb3f41-ee98-41cd-9eac-9e6361e0a30d
 on fs with scheme file
2017-03-28T15:00:51,384  INFO [HiveServer2-Handler-Pool: Thread-86] 
service.CompositeService: Session closed, SessionHandle 
[24dd0e62-d11d-4fdb-a308-6c9853074304], current sessions:0
2017-03-28T15:00:51,384  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.SessionState: Updating thread name to 
24dd0e62-d11d-4fdb-a308-6c9853074304 HiveServer2-Handler-Pool: Thread-86
2017-03-28T15:00:51,385  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.SessionState: Resetting thread name to  HiveServer2-Handler-Pool: 
Thread-86
2017-03-28T15:00:51,385  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.SessionState: Updating thread name to 
24dd0e62-d11d-4fdb-a308-6c9853074304 HiveServer2-Handler-Pool: Thread-86
2017-03-28T15:00:51,385  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.HiveSessionImpl: Operation log session directory is deleted: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/apache-hive-2.2.0-SNAPSHOT-bin/bin/${system:java.io.tmpdir}/${system:user.name}/operation_logs/24dd0e62-d11d-4fdb-a308-6c9853074304
2017-03-28T15:00:51,386  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.SessionState: Resetting thread name to  HiveServer2-Handler-Pool: 
Thread-86
2017-03-28T15:00:51,397  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.SessionState: Deleted directory: 
/tmp/hive/hive/24dd0e62-d11d-4fdb-a308-6c9853074304 on fs with scheme hdfs
2017-03-28T15:00:51,397  INFO [HiveServer2-Handler-Pool: Thread-86] 
session.SessionState: Deleted directory: 
/root/yuxh/app/apache-hive-2.2.0-SNAPSHOT-bin/scratchdir/24dd0e62-d11d-4fdb-a308-6c9853074304
 on fs with scheme file

Reply via email to