HBase 集成 Phoenix 错误 TableExistsException): SYSTEM.MUTEX
运行环境
在以下环境下测试均出现这个错误:
- apache-phoenix-4.10.0-HBase-1.2-client.jar + apache-hbase-1.2.5 + apache-spark-2.3.0(apache-spark-2.3.1)
- apache-phoenix-4.10.0-HBase-1.1-client.jar + apache-hbase-1.2.5 + apache-spark-2.3.0(apache-spark-2.3.1)
- apache-phoenix-4.11.0-HBase-1.2-client.jar + apache-hbase-1.2.5 + apache-spark-2.3.0(apache-spark-2.3.1)
- apache-phoenix-4.14.1-HBase-1.2-client.jar + apache-hbase-1.2.5 + apache-spark-2.3.0(apache-spark-2.3.1)
- apache-phoenix-4.10.0-HBase-1.2-client.jar + apache-hbase-1.1.1 (Aliyun Emr 3.12)
错误现象
java.sql.SQLException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hbase.TableExistsException): SYSTEM.MUTEX
at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2465)
at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2382)
at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:76)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:2382)
at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:255)
at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:149)
at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.xxx.xxx.spark.example.util.db.JdbcUnits.getConnection(JdbcUnits.scala:38)
at com.xxx.xxx.spark.example.util.db.JdbcUnits.query(JdbcUnits.scala:84)
at com.xxx.xxx.spark.example.elecharge.ElecPriceConfigService$.calAmmeter(ElecPriceConfigService.scala:340)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler$$anonfun$getSomeTimeElecAmount$1.apply(ElecCalcHandler.scala:80)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler$$anonfun$getSomeTimeElecAmount$1.apply(ElecCalcHandler.scala:79)
at scala.collection.immutable.List.foreach(List.scala:381)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler.getSomeTimeElecAmount(ElecCalcHandler.scala:79)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler.querySometimePowerAmount(ElecCalcHandler.scala:73)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler.calPeakAmount(ElecCalcHandler.scala:174)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis$.calculator(ElechargeAnalysis.scala:105)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis$$anonfun$main$1.apply(ElechargeAnalysis.scala:78)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis$$anonfun$main$1.apply(ElechargeAnalysis.scala:64)
at scala.collection.immutable.List.foreach(List.scala:381)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis$.main(ElechargeAnalysis.scala:64)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis.main(ElechargeAnalysis.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:879)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:197)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:227)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:136)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hbase.TableExistsException): SYSTEM.MUTEX
at org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.prepareCreate(CreateTableProcedure.java:285)
at org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.executeFromState(CreateTableProcedure.java:106)
at org.apache.hadoop.hbase.master.procedure.CreateTableProcedure.executeFromState(CreateTableProcedure.java:58)
at org.apache.hadoop.hbase.procedure2.StateMachineProcedure.execute(StateMachineProcedure.java:119)
at org.apache.hadoop.hbase.procedure2.Procedure.doExecute(Procedure.java:498)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.execProcedure(ProcedureExecutor.java:1147)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.execLoop(ProcedureExecutor.java:942)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.execLoop(ProcedureExecutor.java:895)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.access$400(ProcedureExecutor.java:77)
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor$2.run(ProcedureExecutor.java:497)
()
java.lang.IllegalStateException: Phoenix driver closed because server is shutting down
at org.apache.phoenix.jdbc.PhoenixDriver.throwDriverClosedException(PhoenixDriver.java:290)
at org.apache.phoenix.jdbc.PhoenixDriver.checkClosed(PhoenixDriver.java:285)
at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:220)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.xxx.xxx.spark.example.util.db.JdbcUnits.getConnection(JdbcUnits.scala:38)
at com.xxx.xxx.spark.example.util.db.JdbcUnits.query(JdbcUnits.scala:84)
at com.xxx.xxx.spark.example.elecharge.ElecPriceConfigService$.calAmmeter(ElecPriceConfigService.scala:340)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler$$anonfun$getSomeTimeElecAmount$1.apply(ElecCalcHandler.scala:80)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler$$anonfun$getSomeTimeElecAmount$1.apply(ElecCalcHandler.scala:79)
at scala.collection.immutable.List.foreach(List.scala:381)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler.getSomeTimeElecAmount(ElecCalcHandler.scala:79)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler.querySometimePowerAmount(ElecCalcHandler.scala:73)
at com.xxx.xxx.spark.example.elecharge.ElecCalcHandler.calPeakAmount(ElecCalcHandler.scala:174)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis$.calculator(ElechargeAnalysis.scala:105)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis$$anonfun$main$1.apply(ElechargeAnalysis.scala:78)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis$$anonfun$main$1.apply(ElechargeAnalysis.scala:64)
at scala.collection.immutable.List.foreach(List.scala:381)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis$.main(ElechargeAnalysis.scala:64)
at com.xxx.xxx.spark.example.elecharge.ElechargeAnalysis.main(ElechargeAnalysis.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:879)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:197)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:227)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:136)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
解决方案
最终尝试改变环境为:apache-phoenix-4.8.2-HBase-1.2-client.jar + apache-hbase-1.2.5 + apache-spark-2.3.0(apache-spark-2.3.1)
测试通过.