【问题标题】:A fatal error in Junit with objectify使用 objectify 的 Junit 中的致命错误
【发布时间】:2017-06-01 20:07:48
【问题描述】:

我无法发现为什么我的带有 objectify 的集成测试会崩溃。 逐一执行或调试都没有问题。

那是物化代码。

protected void before() throws Throwable {
    original = ObjectifyService.factory();
    ObjectifyFactory factory = newObjectifyFactory();
    for (Class<?> type : register) {
        factory.register(type);
    }
    ObjectifyService.setFactory(factory);
    closeable = ObjectifyService.begin();
}

protected void after() {
    ObjectifyService.setFactory(original);
    closeable.close();
}

经过一些测试,跑步者停下来,我收到了这条消息。

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000000000003, pid=15104, tid=9848
#
# JRE version: Java(TM) SE Runtime Environment (7.0_80-b15) (build 1.7.0_80-b15)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.80-b11 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  0x0000000000000003
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as: Compiled method (nm)    7403  625     n       java.lang.Class::isInstance (native)  total in heap  [0x0000000002b4bf10,0x0000000002b4c2b8] = 936 relocation     [0x0000000002b4c030,0x0000000002b4c088] = 88  main code [0x0000000002b4c0a0,0x0000000002b4c2b8] = 536 Compiled method (c2)    7404  752             java.lang.invoke.LambdaForm$NamedFunction::invoke_L_L (28 bytes)  total in heap  [0x0000000002c38490,0x0000000002c38778] = 744  relocation     [enter image description here][1][0x0000000002c385b0,0x0000000002c385d0] = 32  main code [0x0000000002c385e0,0x0000000002c38660] = 128  stub code      [0x0000000002c38660,0x0000000002c38698] = 56  oops           [0x0000000002c38698,0x0000000002c386a0] = 8  scopes data    [0x0000000002c386a0,0x0000000002c386e8] = 72  scopes pcs     [0x0000000002c386e8,0x0000000002c38748] = 96  dependencies   [0x0000000002c38748,0x0000000002c38750] = 8  handler table  [0x0000000002c38750,0x0000000002c38768] = 24  nul chk table  [0x0000000002c38768,0x0000000002c38778] = 16

【问题讨论】:

  • 你也可以为“newObjectifyFactory()”添加代码吗?为什么要创建新工厂,将工厂重置为原始工厂的原因是什么?
  • 这里是代码:protected ObjectifyFactory newObjectifyFactory() { return new ObjectifyFactory();但这是我在研究中发现的一个尝试解决问题的示例。在我只是使用 ObjectifyService.register() 之前;'和“ObjectifyService.begin();”。够了,但是报错是一样的。

标签: java google-app-engine junit objectify


【解决方案1】:

您在这里看到的都是 JVM 错误。这不应该是可能的。确保您安装了最新版本的 JDK,如果是这样,您唯一可以真正提出问题的地方是 Oracle :-(

【讨论】:

  • 好的,谢谢,我会尽量理解。现在我放弃了内存存储并将 LocalDatastoreServiceTestConfig 设置为存储在文件中。这解决了问题。
猜你喜欢
  • 2012-06-06
  • 1970-01-01
  • 2016-04-24
  • 2018-05-31
  • 1970-01-01
  • 2014-04-17
  • 2012-05-16
  • 1970-01-01
  • 2015-07-24
相关资源
最近更新 更多