java.lang.IllegalStateException:已经安装了InitialContextProperties

问题描述 投票:0回答:2

我正在尝试使用TestNG和Eclipse运行单元测试(右键单击单元测试 - >运行为TestNg测试)。在初始阶段,测试立即失败。我认为这与testng正在加载两个不同的数据源有关,但我不知道如何解决这个问题。这是堆栈跟踪:

May 15, 2015 11:52:32 AM  org.jboss.seam.microcontainer.TransactionManagerFactory getTransactionManager
INFO: starting JTA transaction manager
May 15, 2015 11:52:32 AM org.jboss.seam.microcontainer.DataSourceFactory getDataSource
INFO: starting Datasource at JNDI name: java:/datasource1
May 15, 2015 11:52:32 AM org.jboss.seam.microcontainer.DataSourceFactory getDataSource
INFO: starting Datasource at JNDI name: java:/DefaultDS
FAILED CONFIGURATION: @BeforeClass init
java.lang.RuntimeException: java.lang.IllegalStateException: Already installed InitialContextProperties
at com.pinncorp.mock.SeamTest.startJbossEmbeddedIfNecessary(SeamTest.java:223)
at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:915)
at com.pinncorp.mock.SeamTest.init(SeamTest.java:133)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:17

提前致谢...

unit-testing java-ee jboss testng seam
2个回答
1
投票

我建议请清除所有构建路径和testng库,清理你的项目并重新开始,它肯定会工作。如果不是在不同的工作空间中完全尝试。


0
投票

我收到以下错误:

java.lang.IllegalStateException:jboss.web.deployment:war = / my_app已经安装

这与你的不一样,但非常相似。

我做的是在我的服务器(JBOSS)的.ear文件夹中放置两个/deploy文件。更具体地说,我通过在其名称后附加“_backup”重命名现有的.ear,然后我粘贴了新的.ear。解决方案是在deploy文件夹中只保留一个.ear文件。

这可能不是您的问题的解决方案,但我认为它可能会帮助其他人谷歌相同的错误。

© www.soinside.com 2019 - 2024. All rights reserved.