Classpath

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Classpath

tarun3kumar

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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Classpath

Cédric Beust ♔
Can you take a look at:

       at com.mantech.testng.cargo
.TestServerControl.startServer(TestServerControl.java:18)

and see if they're doing something special with the classloading?

It might be worth asking on the Cargo mailing-list too :-)

--
Cedric




On 2/17/07, David Sousa <[hidden email]> wrote:

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







--
Cédric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Classpath

tarun3kumar

Cedric,

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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Classpath

tarun3kumar
In reply to this post by tarun3kumar

It turns out that ant needed to be in the classpath for Cargo to use at runtime.  The test is running as expected.  Thanks.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=65278&messageID=125016#125016


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---