表现:界面上报错:,刚登陆进去就能看到,点击执行也会出现。日志里报:

Traceback (most recent call last):
File "/home/work/hue-3.10.0/desktop/libs/notebook/src/notebook/decorators.py", line 81, in decorator
return func(*args, **kwargs)
File "/home/work/hue-3.10.0/desktop/libs/notebook/src/notebook/api.py", line 124, in execute
history = _historify(notebook, request.user)
File "/home/work/hue-3.10.0/desktop/libs/notebook/src/notebook/api.py", line 319, in _historify
is_history=True
File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/manager.py", line 157, in create
return self.get_queryset().create(**kwargs)
File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/query.py", line 322, in create
obj.save(force_insert=True, using=self.db)
File "/home/work/hue-3.10.0/desktop/core/src/desktop/models.py", line 1138, in save
home_dir = Document2.objects.get_home_directory(self.owner)
File "/home/work/hue-3.10.0/desktop/core/src/desktop/models.py", line 935, in get_home_directory
return self.get(owner=user, parent_directory=None, name=Document2.HOME_DIR, type='directory')
File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/manager.py", line 151, in get
return self.get_queryset().get(*args, **kwargs)
File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/query.py", line 313, in get
(self.model._meta.object_name, num))
MultipleObjectsReturned: get() returned more than one Document2 -- it returned 2!

复现步骤:已账号xxxx登录hue,即可看到异常.

ps: 有人在官网报此问题,http://gethue.com/how-to-fix-the-multipleobjectsreturned-error-in-hue/  但官方没有给出解决方法.

根据stacktrace: File "/home/work/hue-3.10.0/desktop/core/src/desktop/models.py", line 935, in get_home_directory查到代码:
  def get_home_directory(self, user):
try:
return self.get(owner=user, parent_directory=None, name=Document2.HOME_DIR, type='directory')
except Document2.DoesNotExist:
return self.create_user_directories(user)

是class Document2Manager的方法,怀疑是用户表中存的用户记录多了一条,所以查到两个home directory,查了auth_user表和useradmin_userprofile表,都正常。后又查表desktop_document2,按self.get()中的查询条件果然查到两行:

查别的正常账号,只有一条,解决方法应该是删掉多余的数据即可。
由于此表有个自连接的外键:CONSTRAINT `parent_directory_id_refs_id_4fe2babf` FOREIGN KEY (`parent_directory_id`) REFERENCES `desktop_document2` (`id`), 应先删除衍生数据,再删除根数据:
delete from desktop_document2 where parent_directory_id=7;
delete from desktop_document2 where id=7;
之后测试,果然解决。
为何会产生两条数据,原因未知。

解决HUE报错MultipleObjectsReturned: get() returned more than one Document2 -- it returned 2!的更多相关文章

  1. 解决hue报错:timed out (code THRIFTSOCKET): None

    报错栈: [/Jun/ :: +] decorators ERROR error running <function execute at 0x7fba2804ecf8> Tracebac ...

  2. Idea使用记录--添加Problems&&解决Autowired报错could not autowire

    今天在使用Idea的时候,发现Idea在整个每次找到错误代码非常不方便(Idea如果类中有错误,没有打开过类并不会提示,比如构建工程后缺少jar包问题).我想快速看到工程哪里出问题类似于eclipse ...

  3. [转]解决Maven报错"Plugin execution not covered by lifecycle configuration"

    [转]解决Maven报错"Plugin execution not covered by lifecycle configuration" 导入Myabtis源码后,POM文件会报 ...

  4. 解决MySQL报错ERROR 2002 (HY000)【转】

    今天在为新的业务线搭架数据库后,在启动的时候报错 root@qsbilldatahis-db01:/usr/local/mysql/bin# ./mysql ERROR 2002 (HY000): C ...

  5. vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题

    vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题 今天下载了一个开源项目一直运行不了,折腾了半天才找到问题所在,config ...

  6. 解决 php 报错 open_basedir restriction in effect或者nginx提示No input file specified怎么办

    解决 php 报错 open_basedir restriction in effect或者nginx提示No input file specified怎么办 问题是出现在了PHP.INI上面了 ,原 ...

  7. 解决MySQL报错:1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'informat

    解决MySQL报错:1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'informat ...

  8. eclips中maven解决jsp报错的问题

    加入如下的pom依赖: <!-- 解决jsp报错的依赖包第一个 --> <dependency> <groupId>javax.servlet</groupI ...

  9. 不修改系统日期和时间格式,解决Delphi报错提示 '****-**-**'is not a valid date and time

    假如操作系统的日期格式不是yyyy-MM-dd格式,而是用strtodate('2014-10-01')) 来转换的话,程序会提示爆粗 '****-**-**'is not a valid date ...

随机推荐

  1. 【前端笔记】浅谈js继承

    我们先想想我们用js最后要怎样实现面向对象的编程.事实上我们必须用上原型链这种东西. 我们的父类superType有属性和方法,并且一些能被子类subType继承,一些能被覆盖,但是丝毫不会影响到父类 ...

  2. 应用nslookup命令查看A记录、MX记录、CNAME记录和NS记录

    https://blog.csdn.net/qq_38058202/article/details/80468688

  3. 大理石在哪儿(UVa10474)

    题目具体描述见:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=835&a ...

  4. 快速搭建sonar代码质量管理平台

    安装 下载,直接解压http://www.sonarqube.org/downloads/ 添加mysql驱动至\extensions\jdbc-driver\mysql\ 创建mysql数据库和用户 ...

  5. mogodb(1) 简介

    1 引言 NoSQL,全称是“Not Only Sql”,指的是非关系型的数据库.这类数据库主要有这些特点:非关系型的.分布式.开源的.水平可扩展的.原始目的是为了大规模web应用,这场全新的数据库革 ...

  6. 初拾Java(问题一:404错误,页面找不到)

    做测试尤其是想走自动化测试之路的人,怎么可以不会码代码?!怒了... 再次开始拾起Java,坚持坚持!!! 刚写了一个JSP页面,想在Myeclipse里面跑来试试,结果搞了半天出现以下错误: 试着去 ...

  7. java变量的命名使用规则

    1.环境变量通常是指在操作系统中,用来指定操作系统运行时需要的一些参数 2.变量名以字母.下划线或者美元符(4上面的¥)开头,不能以数字开头,后面跟字母.下划线.美元符.数字,变量名对大小写敏感,无长 ...

  8. FutureTask简单实战

    FutureTask是什么? 线程池的实现核心之一是FutureTask.在提交任务时,用户实现的Callable实例task会被包装为FutureTask实例ftask:提交后任务异步执行,无需用户 ...

  9. YanghuiTriangle

    Demand 1 用实现循环队列 2 参考PPT用循环队列打印杨辉三角 3 用JDB或IDEA单步跟踪排队情况,画出队列变化图,包含自己的学号信息 4 把代码推送到代码托管平台 5 把完成过程写一篇博 ...

  10. 精通android体系架构、mvc、常见的设计模式、控制反转(ioc)

    1.请看某个著名的it公司一则招聘信息的其中一条要求:“熟悉android系统架构及相关技术,1年以上实际android平台开发经验:”,里面非常明确的说道要求熟练android系统架构,这从某种程度 ...