在尝试使用Arquillian运行我的测试时,我得到了这个很好的例外:
Internal Error occured.
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:160)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:111)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:97)
at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:93)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:156)
... 14 more
Caused by: java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.core.impl.ManagerImpl
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:160)
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:111)
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:97)
at org.jboss.arquillian.core.spi.ManagerBuilder.create(ManagerBuilder.java:77)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:55)
... 19 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:156)
... 23 more
Caused by: java.lang.RuntimeException: Could not create and process manager
at org.jboss.arquillian.core.impl.ManagerImpl.<init>(ManagerImpl.java:104)
... 28 more
Caused by: java.lang.IllegalArgumentException: Attempted to register the same Observer: org.jboss.as.arquillian.container.ServerSetupObserver multiple times, please check classpath for conflicting jar versions
at org.jboss.arquillian.core.impl.ManagerImpl$2.observer(ManagerImpl.java:323)
at org.jboss.arquillian.core.impl.loadable.LoadableExtensionLoader$1.observer(LoadableExtensionLoader.java:100)
at org.jboss.as.arquillian.container.CommonContainerExtension.register(CommonContainerExtension.java:41)
at org.jboss.as.arquillian.container.remote.RemoteContainerExtension.register(RemoteContainerExtension.java:33)
at org.jboss.arquillian.core.impl.loadable.LoadableExtensionLoader.load(LoadableExtensionLoader.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at org.jboss.arquillian.core.impl.ManagerImpl.fireProcessing(ManagerImpl.java:316)
at org.jboss.arquillian.core.impl.ManagerImpl.<init>(ManagerImpl.java:98)
... 28 more
我知道other questions并且ServerSetupObserver
可能存在于我的类路径中的多个版本中。我的情况不同的是,如果我从一个蚂蚁目标运行我的测试,那么它们就完全没问题了,我从IntelliJ运行测试时只会遇到这个错误。
问题是:我如何确定IntelliJ在类路径上放置ServerSetupObserver
类的确切位置和/或如何从那里删除它? (或者这里还有什么问题?)
答案 0 :(得分:0)
不是真正的答案,但我的解决方法:
我需要从所有模块中删除所有依赖项,并再次添加所需的依赖项。对于这样大小的项目,这可能会更加麻烦,但幸运的是,该项目还有使用Eclipse的人,他们的类路径也没问题,所以我可以使用Eclipse Dependency Sync插件来恢复我的依赖关系它们。