JVM crashing when using any other Hibernate inheri

2020-06-23 05:41发布

Ok, this is probably a longshot but here goes.

In Java (JRE 1.6.0_26-b03) I have two classes, SuperControl and its subclass SubControl. They both need to be persistent objects and I'm using Hibernate Annotations to achieve this. I have approximately 210 classes that are being persisted correctly. Except one isn't.

My problem is that SubControl refuses to inherit in any way besides SINGLE_TABLE. When I say "refuses", I mean that the entire JRE crashes.

This is a bit problematic because I'd really prefer SuperControl to be a mapped superclass of SubControl. SuperControl can also be a persistent entity in its own right. The strange thing is that I have an exactly parallel hierarchy in my code elsewhere that works correctly.

This is what I want:

@Entity
@MappedSuperclass
public class SuperControl extends ItsSuperClass {
  // ...
}

@Entity
public class SubControl extends SuperControl {
  // ...
}

but it bombs out with the error

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (c1_Optimizer.cpp:271), pid=5456, tid=1260
#  guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
#
# JRE version: 6.0_26-b03
# Java VM: Java HotSpot(TM) Client VM (20.1-b02 mixed mode, sharing windows-x86 )
# An error report file with more information is saved as:
# C:\eclipse\hs_err_pid5456.log

Without supplying any inheritance hint, Hibernate defaults to SINGLE_TABLE (which I can tell thanks to the creation of a DTYPE column). I can explicitly specify this without the JVM crashing.

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class SuperControl extends ItsSuperClass {
  // ...
}

@Entity
public class SubControl extends SuperControl {
  // ...
}

The worst part is that if I remove the SubControl class ENTIRELY, or even just its mapping in the hibernate.cfg.xml file, the JVM still crashes. This leads me to believe that there's some kind of hidden linkage between SuperControl and SubControl. Maybe something cached in Eclipse or the like. I've restarted Eclipse, done several clean-and-builds, and even restarted my machine, and the problem's still there.

Any ideas? I've been working on this for hours and have gotten nowhere.

Thanks!

2条回答
神经病院院长
2楼-- · 2020-06-23 06:36

Try Java 1.6.0_20, and check if that works. You have found a JVM bug, and going back 6 minor versions might be enought to get this running.

You are lucky in the way that this bug is reproducable, so create a minimal testcase and post it to the Oracle bug database.

查看更多
仙女界的扛把子
3楼-- · 2020-06-23 06:36

This looks like a bug 7042153, aka 2210012 reported in early May.

Note the workaround offered by one user: using the "-server" JVM option fixed it for them.

查看更多
登录 后发表回答