I had a copy of testng.jar in jre/lib/ext to avoid setting classpath.
The TestNGAntTask was getting loaded from there and that was causing the
problem. I removed it and now the test is working ok.
- Sony
Sherry Shen wrote:
>
> I ran through this deployment test smoothly since my environment has
> the set up from running other glassfish tests, e.g.
> * APS_HOME, S1AS_HOME, JAVA_HOME, ANT_HOME in environment
> * ${APS_HOME}/configure.properties with port or password
> as explained in
> https://glassfish.dev.java.net/public/GuidelinesandConventions.html#Quicklook_Tests
>
>
> Sherry
>
> On 5/8/2006 8:07 AM, Tim Quinn wrote:
>
>> Sony,
>>
>> For the moment, try setting S1AS_HOME to point to your GlassFish
>> publish directory. I accidentally omitted that set-up step from the
>> instructions I published last week. Thanks for catching my error.
>>
>>
>> - Tim
>>
>> Sony Manuel wrote:
>>
>>> Tim Quinn wrote:
>>>
>>>> GlassFish quality community:
>>>>
>>>> Some new files are now available from the GlassFish repository - a
>>>> very early implementation of using TestNG to drive developer
>>>> tests. The particular example just checked in runs a test in the
>>>> deployment section.
>>>>
>>>> If you are interested in looking at what we've done, running it, or
>>>> commenting on it, please do the following:
>>>>
>>>> 1. Check out the GlassFish workspace including the appserv-tests
>>>> section - or update your workspace if you already have one.
>>>>
>>>> 2. Visit http://www.testng.org to download TestNG. Part of what
>>>> you get will be the testng jar file such as testng-4.7-jdk15.jar.
>>>> Copy this file to
>>>>
>>>> ${your-GlassFish-workspace}/appserv-tests/lib/testng.jar
>>>>
>>>> Please note that you'll need to change the name to testng.jar (no
>>>> version information embedded in the name) when you copy the jar
>>>> file. This is just to save setting an additional environment
>>>> variable.
>>>>
>>>> Also, note that eventually we hope to NOT require you to download
>>>> TestNG separately, but for now this is the fastest way to get the
>>>> work going.
>>>>
>>>> 3. Make sure to define the environment variable APS_HOME to point
>>>> to ${your-GlassFish-workspace}/appserv-tests.
>>>>
>>>>
>>>> 4. Because we are still very early in this work, there is one
>>>> deployment devtest that is currently TestNG-enabled:
>>>> appserv-tests/devtests/deployment/ejb30/ear/session. More tests -
>>>> and not just deployment ones - will follow soon.
>>>>
>>>> To use TestNG to run the test, cd to
>>>> appserv-tests/devtests/deployment/ejb30/ear/session and run ant
>>>> like this:
>>>>
>>>> ant -f ${APS_HOME}/devtests/deployment/build-ng.xml
>>>>
>>> I am getting an error while running this. Ant fails while trying to
>>> load testng task. I tried changing taskdef as mentioned in testng
>>> docs. Still getting the same problem.
>>>
>>> <taskdef resource="testngtasks" classpathref="cp"/>
>>>
>>> sony_at_linux:~/workspace/glassfish/appserv-tests/devtests/deployment/ejb30/ear/session>
>>> ant -f
>>> /export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/build-ng.xml
>>> -v
>>> Apache Ant version 1.6.5 compiled on June 2 2005
>>> Buildfile:
>>> /export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/build-ng.xml
>>>
>>> Detected Java version: 1.5 in:
>>> /export/home/sony/builds/as/9.0/b40/jdk/jre
>>> Detected OS: Linux
>>> parsing buildfile
>>> /export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/build-ng.xml
>>> with URI =
>>> file:///export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/build-ng.xml
>>>
>>> Project base dir set to:
>>> /export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment
>>> [property] Loading Environment envng.
>>> Property ${envng.S1AS_HOME} has not been set
>>> Build sequence for target(s) `run-test' is [compile-tests, run-test]
>>> Complete build sequence is [compile-tests, run-test, test, ]
>>>
>>> compile-tests:
>>> [javac] SessionTest.java added as SessionTest.class doesn't exist.
>>> [javac] DeploymentTest.java added as DeploymentTest.class doesn't
>>> exist.
>>> [javac] Compiling 2 source files to
>>> /export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/build
>>>
>>> [javac] Using modern compiler
>>> dropping
>>> /export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/${envng.S1AS_HOME}/lib/ant/lib/ant.jar
>>> from path as it doesn't exist
>>> [javac] Compilation arguments:
>>> [javac] '-d'
>>> [javac]
>>> '/export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/build'
>>>
>>> [javac] '-classpath'
>>> [javac]
>>> '/export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/build:/export/home/sony/workspace/glassfish/appserv-tests/lib/testng.jar:/export/home/sony/builds/as/9.0/b40/jdk/lib/tools.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-launcher.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-jai.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-antlr.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-starteam.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-icontract.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-jdepend.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-apache-oro.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-trax.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-apache-regexp.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-jmf.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-jsch.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-apache-bsf.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-netrexx.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-swing.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/xercesImpl.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-apache-bcel.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-stylebook.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-javamail.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-junit.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-xalan1.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-commons-net.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-commons-logging.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-weblogic.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-apache-log4j.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/xml-apis.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-vaj.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-xslp.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-nodeps.jar:/export/home/sony/builds/as/9.0/b40/lib/ant/lib/ant-apache-resolver.jar'
>>>
>>> [javac] '-sourcepath'
>>> [javac]
>>> '/export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/ejb30/ear/session:/export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment'
>>>
>>> [javac] '-g'
>>> [javac]
>>> [javac] The ' characters around the executable and arguments are
>>> [javac] not part of the command.
>>> [javac] Files to be compiled:
>>> [javac]
>>> /export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/ejb30/ear/session/SessionTest.java
>>>
>>> [javac]
>>> /export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/DeploymentTest.java
>>>
>>>
>>> run-test:
>>> [pathconvert] Set property test.path =
>>> /export/home/sony/workspace/glassfish/appserv-tests/lib/testng.jar:/export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/build:/export/home/sony/builds/as/9.0/b40/jdk/lib/tools.jar:/export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/${envng.S1AS_HOME}/lib/ant/lib/ant.jar
>>>
>>>
>>> BUILD FAILED
>>> /export/home/sony/workspace/glassfish/appserv-tests/devtests/deployment/build-ng.xml:128:
>>> taskdef A class needed by class org.testng.TestNGAntTask cannot be
>>> found: org/apache/tools/ant/Task
>>> at
>>> org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:487)
>>> at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:183)
>>> at
>>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>>> at org.apache.tools.ant.Task.perform(Task.java:364)
>>> at org.apache.tools.ant.Target.execute(Target.java:341)
>>> at org.apache.tools.ant.Target.performTasks(Target.java:369)
>>> at
>>> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>>> at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
>>> at
>>> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
>>>
>>> at
>>> org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>>> at org.apache.tools.ant.Main.runBuild(Main.java:668)
>>> at org.apache.tools.ant.Main.startAnt(Main.java:187)
>>> at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
>>> at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
>>> Caused by: java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
>>> at java.lang.ClassLoader.defineClass1(Native Method)
>>> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>>> at
>>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>>> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>>> at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>> at
>>> org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1197)
>>>
>>> at
>>> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:973)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Class.java:242)
>>> at
>>> org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:457)
>>> ... 13 more
>>> --- Nested Exception ---
>>> java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
>>> at java.lang.ClassLoader.defineClass1(Native Method)
>>> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>>> at
>>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>>> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>>> at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>> at
>>> org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1197)
>>>
>>> at
>>> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:973)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Class.java:242)
>>> at
>>> org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:457)
>>> at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:183)
>>> at
>>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>>> at org.apache.tools.ant.Task.perform(Task.java:364)
>>> at org.apache.tools.ant.Target.execute(Target.java:341)
>>> at org.apache.tools.ant.Target.performTasks(Target.java:369)
>>> at
>>> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>>> at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
>>> at
>>> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
>>>
>>> at
>>> org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>>> at org.apache.tools.ant.Main.runBuild(Main.java:668)
>>> at org.apache.tools.ant.Main.startAnt(Main.java:187)
>>> at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
>>> at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
>>>
>>> Total time: 2 seconds
>>> sony_at_linux:~/workspace/glassfish/appserv-tests/devtests/deployment/ejb30/ear/session>
>>>
>>>
>>> - Sony
>>>
>>>
>>
>