简体   繁体   中英

StackOverflowError when running H2 unit test in NetBeans

When I run or debug a unit test within NetBeans which uses the H2 database I get a 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

When I run the complete set of unit test from ant I have no problem. Also running the single unit test from IntelliJ works fine.

Help is appreciated. Please refrain from answers like "switch to IntelliJ", I'd like to keep using my favorite IDE.

Solved by increasing the stack size of the JVM. In the File->Project properties->Run I set the VM Options with -Xss to a bigger value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM