0

当我在使用 H2 数据库的 NetBeans 中运行或调试单元测试时,我得到一个 StackOverflowError:

...

Caused by: java.lang.StackOverflowError
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.h2.command.Command.executeUpdate(Command.java:230)
    at org.h2.command.CommandList.update(CommandList.java:44)
    at org.h2.command.CommandList.executeRemaining(CommandList.java:39)
    at org.h2.command.CommandList.update(CommandList.java:45)
    at org.h2.command.CommandList.executeRemaining(CommandList.java:39)
    at org.h2.command.CommandList.update(CommandList.java:45)
    at org.h2.command.CommandList.executeRemaining(CommandList.java:39)
    at org.h2.command.CommandList.update(CommandList.java:45)
    at org.h2.command.CommandList.executeRemaining(CommandList.java:39)
    at org.h2.command.CommandList.update(CommandList.java:45)
    at org.h2.command.CommandList.executeRemaining(CommandList.java:39)
    at org.h2.command.CommandList.update(CommandList.java:45)
    at org.h2.command.CommandList.executeRemaining(CommandList.java:39)
    at org.h2.command.CommandList.update(CommandList.java:45)
    at org.h2.command.CommandList.executeRemaining(CommandList.java:39)

... ETC

当我从 ant 运行完整的单元测试时,我没有问题。从 IntelliJ 运行单个单元测试也可以正常工作。

帮助表示赞赏。请不要回答“切换到 IntelliJ”之类的问题,我想继续使用我最喜欢的 IDE。

4

1 回答 1

2

通过增加JVM的堆栈大小来解决。在文件->项目属性->运行中,我将带有 -Xss 的 VM 选项设置为更大的值。

于 2012-06-21T14:06:05.270 回答