通过命令行启动java测试
我创建了 runner.bat 来启动一个 java 测试 它包含:java路径,类路径org.junit.runner.JUnitCore package.class 当我启动它时:
失败测试运行:1,失败:1
Exception in thread "Thread-0" java.lang.IllegalStateException: Shutdown in progress
at java.lang.ApplicationShutdownHooks.add(Unknown Source)
at java.lang.Runtime.addShutdownHook(Unknown Source)
at com.sun.imageio.stream.StreamCloser$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.imageio.stream.StreamCloser.addToQueue(Unknown Source)
at javax.imageio.stream.FileCacheImageInputStream.<init>(Unknown Source)
at com.sun.imageio.spi.InputStreamImageInputStreamSpi.createInputStreamInstance(Unknown Source)
at javax.imageio.ImageIO.createImageInputStream(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at com.polyspace.util.guicomponent.CompositePanel.setBufferedImage(Unknown Source)
at com.polyspace.util.guicomponent.CompositePanel.<init>(Unknown Source)
I created runner.bat to launch one java test
it contains : path to java,classpath org.junit.runner.JUnitCore package.class
when I launch it :
FAILURES Tests run: 1, Failures: 1
Exception in thread "Thread-0" java.lang.IllegalStateException: Shutdown in progress
at java.lang.ApplicationShutdownHooks.add(Unknown Source)
at java.lang.Runtime.addShutdownHook(Unknown Source)
at com.sun.imageio.stream.StreamCloser$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.imageio.stream.StreamCloser.addToQueue(Unknown Source)
at javax.imageio.stream.FileCacheImageInputStream.<init>(Unknown Source)
at com.sun.imageio.spi.InputStreamImageInputStreamSpi.createInputStreamInstance(Unknown Source)
at javax.imageio.ImageIO.createImageInputStream(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at com.polyspace.util.guicomponent.CompositePanel.setBufferedImage(Unknown Source)
at com.polyspace.util.guicomponent.CompositePanel.<init>(Unknown Source)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果调用该方法时 JVM 已经关闭,则 Runtime.addShutdownHooks() 将抛出 IllegalStateException。
是否有什么原因导致您的测试在 CompositePanel 构建完成之前结束? (例如,在单独的线程中运行的东西。)
Runtime.addShutdownHooks() will throw an IllegalStateException if the JVM is already shutting down when the method is called.
Could something be causing your test to end before the construction of your CompositePanel has completed? (e.g. something running in a separate thread.)