Caused by: org.datanucleus.store.rdbms.exceptions.MissingTableException: Required table m

最近需要提取一些数据,故开始使用hive,本机搭建了一个hive客户端环境,但是始终有问题,在本机装好了mysql以后,老是报

 

 

Java代码   收藏代码
  1. Caused by: org.datanucleus.store.rdbms.exceptions.MissingTableException: Required table missing : "`DBS`" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.autoCreateTables"  
  2.         at org.datanucleus.store.rdbms.table.AbstractTable.exists(AbstractTable.java:455)  
  3.         at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.performTablesValidation(RDBMSStoreManager.java:2689)  
  4.         at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.addClassTablesAndValidate(RDBMSStoreManager.java:2503)  
  5.         at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run(RDBMSStoreManager.java:2148)  
  6.         at org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:113)  
  7.         at org.datanucleus.store.rdbms.RDBMSStoreManager.addClasses(RDBMSStoreManager.java:986)  
  8.         at org.datanucleus.store.rdbms.RDBMSStoreManager.addClasses(RDBMSStoreManager.java:952)  
  9.         at org.datanucleus.store.AbstractStoreManager.addClass(AbstractStoreManager.java:919)  
  10.         at org.datanucleus.store.mapped.MappedStoreManager.getDatastoreClass(MappedStoreManager.java:356)  
  11.         at org.datanucleus.store.rdbms.query.legacy.ExtentHelper.getExtent(ExtentHelper.java:48)  
  12.         at org.datanucleus.store.rdbms.RDBMSStoreManager.getExtent(RDBMSStoreManager.java:1332)  
  13.         at org.datanucleus.ObjectManagerImpl.getExtent(ObjectManagerImpl.java:4149)  

 

 

依据堆栈提示,然后下得jar文件主要是看  AbstractTable.exists(AbstractTable.java:455) 

 

 

Java代码   收藏代码
  1. if ((type == null) || ((allowDDLOutput()) && (this.storeMgr.getDdlWriter() != null) && (this.storeMgr.getCompleteDDL())))  
  2.    {  
  3.      if (!auto_create)  
  4.      {  
  5.        this.existsInDatastore = Boolean.FALSE;  
  6.        throw new MissingTableException(getCatalogName(), getSchemaName(), toString());  
  7.      }  

 

  455 行 便是 异常抛出之地。

 依据 hive错误提示

 

 "datanucleus.autoCreateTables" = true

  配置了hive-site.xml不行,故结合上面的代码看,猜测是autoCreate没有传递进去,故开始跟踪这个值的设置的地方,最终跟踪到org.datanucleus.store.mapped.MappedStoreManager,其中有一段很关键的代码如下

 

 

Java代码   收藏代码
  1. if ((this.readOnlyDatastore) || (this.fixedDatastore))  
  2.    {  
  3.      this.autoCreateTables = false;  
  4.      this.autoCreateColumns = false;  
  5.      this.autoCreateConstraints = false;  
  6.    }  
  7.    else  
  8.    {  
  9.      boolean autoCreateSchema = conf.getBooleanProperty("datanucleus.autoCreateSchema");  
  10.      if (autoCreateSchema)  
  11.      {  
  12.        this.autoCreateTables = true;  
  13.        this.autoCreateColumns = true;  
  14.        this.autoCreateConstraints = true;  
  15.      }  
  16.      else  
  17.      {  
  18.        this.autoCreateColumns = conf.getBooleanProperty("datanucleus.autoCreateColumns");  
  19.        this.autoCreateTables = conf.getBooleanProperty("datanucleus.autoCreateTables");  
  20.        this.autoCreateConstraints = conf.getBooleanProperty("datanucleus.autoCreateConstraints");  
  21.      }  
  22.    }  

 

   看来关键是 this.readOnlyDatastore        this.fixedDatastore 这2个字段

 

  而且autoCreateSchema 这个设置为true 就可以决定了其他的设置,所以其他设置在此都无效了。

 

  继续追踪org.datanucleus.store.AbstractStoreManager 发现了这2个字段的设置代码

 

 

 

Java代码   收藏代码
  1. this.readOnlyDatastore = conf.getBooleanProperty("datanucleus.readOnlyDatastore");  
Java代码   收藏代码
  1. this.fixedDatastore = conf.getBooleanProperty("datanucleus.fixedDatastore");  
 

  原来问题再这里,再次修改hive-site.xml文件,ok,错误没有了。



<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at


       http://www.apache.org/licenses/LICENSE-2.0


   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->


<configuration>
<property> 
   <name>javax.jdo.option.ConnectionURL</name> 
   <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value> 
</property> 
 
<property> 
   <name>javax.jdo.option.ConnectionDriverName</name> 
   <value>com.mysql.jdbc.Driver</value> 
</property>
<property> 
   <name>javax.jdo.option.ConnectionUserName</name> 
   <value>hive</value> 
</property> 
<property> 
   <name>javax.jdo.option.ConnectionPassword</name> 
   <value>hive</value> 
</property> 
 
<property> 
   <name>hive.hwi.listen.port</name> 
   <value>9999</value> 
   <description>This is the port the Hive Web Interface will listen on </description> 
</property> 
<property> 
   <name>datanucleus.autoCreateSchema</name> 
   <value>true</value> 
</property> 
<property> 
   <name>datanucleus.autoCreateTables</name> 
   <value>true</value> 
</property> 
 
<property> 
   <name>datanucleus.fixedDatastore</name> 
   <value>false</value> 
</property> 


</configuration>

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值