[J2eeunit-dev] ClassCastException from ant task
Brought to you by:
vmassol
From: Jason G. <jas...@lo...> - 2001-03-24 04:39:46
|
Suggestions appreciated on this one - I'm pretty stumped. This is my first attempt to use J2EEUnit, and I'm unable to kick off a first test via ant. I get the following exception: ------------------------ java.lang.ClassCastException: j2eeunit.ant.StopServerTask at j2eeunit.ant.RunServerTestsTask.callStop(RunServerTestsTask.java:89) at j2eeunit.ant.RunServerTestsTask.execute(RunServerTestsTask.java:62) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:124) at org.apache.tools.ant.Target.execute(Target.java:153) at org.apache.tools.ant.Project.runTarget(Project.java:898) at org.apache.tools.ant.Project.executeTarget(Project.java:536) at org.apache.tools.ant.Project.executeTargets(Project.java:510) at org.apache.tools.ant.Main.runBuild(Main.java:421) at org.apache.tools.ant.Main.main(Main.java:149) ------------------------ This exception occurs at the line indicated with a '(2)' below (from RunServerTestTask but with some of my own debugging). ------------------------ private void callStop() { if (m_StopTarget != null) { Task t=project.createTask("stopserver"); (1) System.out.println("Stop task class name is: "+t.getClass().getName()); j2eeunit.ant.StopServerTask task; (2) task = (j2eeunit.ant.StopServerTask)t; ... } } ------------------------ Statement (1) prints out the expected 'j2eeunit.ant.StopServerTask', so I'm a little mystified. I suspected that this must be due to an inconsistent ANT version (since StopServerTask derives from Task), but a recompilation against my local ANT produces the same result. I've noticed the following in the j2eeUnit release notes, and suspect that it may be relevant to my problem: "Moved to Ant 1.4alpha, 19th february 2001 (there were problems with version 1.3beta2 regarding JUnit and the Execute task)." Any thoughts - based on later release comments, it should work with ant 1.3? Jason. PS: I'm using ant: 1.3 ant-options: 1.3 servlet: 2.2 tomcat: 4.0 j2eeunit: 22-0.8.1 |