java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException
at org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory.<init>(DefaultConfigurationFactory.java:47)
at com.mantech.testng.cargo.TestServerControl.startServer(TestServerControl.java:18)
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:585)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:645)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:385)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:141)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:158)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
at org.testng.TestRunner.runWorkers(TestRunner.java:673)
at org.testng.TestRunner.privateRun(TestRunner.java:620)
at org.testng.TestRunner.run(TestRunner.java:480)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:278)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:273)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:253)
at org.testng.SuiteRunner.run(SuiteRunner.java:168)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:987)
at org.testng.TestNG.runSuitesLocally(TestNG.java:951)
at org.testng.TestNG.run(TestNG.java:719)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)
The Cargo jar is in my classpath in the target. I have tried adding a package tag to the testng.xml file, but that did not resolve the problem.
Can somebody please tell me how to set up the run target to find the Cargo classes?
Thanks,
Dave
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=65278&messageID=124994#124994
I have been trying to run a simple test that uses Cargo to start a server in a @BeforeClass method. I am using TestNG 5.5 and Eclipse 3.2 with the TestNG plugin. The target is set to use a suite XML file. When I execute the run target in eclipse, I get the follow error:
java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException
at org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory.<init>(DefaultConfigurationFactory.java:47)
at com.mantech.testng.cargo.TestServerControl.startServer(TestServerControl.java :18)
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:585)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:645)
at org.testng.internal.Invoker.invokeConfigurationMethod (Invoker.java:385)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:141)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods (TestMethodWorker.java:158)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
at org.testng.TestRunner.runWorkers(TestRunner.java:673)
at org.testng.TestRunner.privateRun (TestRunner.java:620)
at org.testng.TestRunner.run(TestRunner.java:480)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:278)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:273)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:253)
at org.testng.SuiteRunner.run(SuiteRunner.java:168)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:987)
at org.testng.TestNG.runSuitesLocally(TestNG.java:951)
at org.testng.TestNG.run(TestNG.java:719)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
at org.testng.remote.RemoteTestNG.main (RemoteTestNG.java:122)
The Cargo jar is in my classpath in the target. I have tried adding a package tag to the testng.xml file, but that did not resolve the problem.
Can somebody please tell me how to set up the run target to find the Cargo classes?
Thanks,
Dave
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=65278&messageID=124994#124994
Thanks for replying so quickly. TestServerControl.startServer() is the method that I wrote. My test class is TestServerControl. Here is the startServer method:
@BeforeClass
public void startServer()
{
ConfigurationFactory configurationFactory =
new DefaultConfigurationFactory();
LocalConfiguration configuration = (LocalConfiguration) configurationFactory.createConfiguration(
"oc4j9x", ContainerType.INSTALLED, ConfigurationType.STANDALONE);
_container = (InstalledLocalContainer) new DefaultContainerFactory().createContainer(
"oc4j9x", ContainerType.INSTALLED, configuration);
_container.setHome("C:/oracle/oc4j");
_container.start();
}
It's nothing fancy and compiles fine in eclipse. For some reason, the run target in eclipse can not find the DefaultConfigurationFactory class.
Dave
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=65278&messageID=125012#125012