在NetBeans中运行H2单元测试时出现StackOverflowError

时间:2012-06-20 12:16:29

标签: java database unit-testing junit h2

当我在使用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)

...等

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

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

1 个答案:

答案 0 :(得分:2)

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