• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Could not create task of type: echo"

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to use the Timer task in my Ant script. If I comment out the timer task, it runs properly and displays Hello World. Is there something I need to do in the classpath to append it to my current one?

When I run it, I get:
Buildfile: <workspace>\Play\play.xml

test:
[timer] System reports java version 1.3.1
[timer] Using standard timer resolution
[timer] started
[timer] BUILD FAILED: <workspace>\Play\play.xml:16: Could not create task of type: echo
Total time: 265 milliseconds


My build file:
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I went into the source code and added some logging. In the addTask(Task) method, I logged the type of the task:
org.apache.tools.ant.UnknownElement@9670967

and a stack trace to see where it was in the call hierarchy:
[timer] java.lang.Exception
[timer] at java.lang.Throwable.<init>(Throwable.java)
[timer] at de.jeckle.AntExtension.Timer.addTask(Timer.java:98)
[timer] at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:329)
[timer] at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:176)
[timer] at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:152)
[timer] at org.apache.tools.ant.Task.perform(Task.java:363)
[timer] at org.apache.tools.ant.Target.execute(Target.java:301)
[timer] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[timer] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[timer] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:571)
[timer] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:367)
[timer] at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:199)
[timer] at java.lang.reflect.Method.invoke(Method.java)
[timer] at org.eclipse.ant.core.AntRunner.run(AntRunner.java:335)
[timer] at org.eclipse.ui.externaltools.internal.ant.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:172)
[timer] at java.lang.Thread.run(Thread.java:801)
[timer] adding task:
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've explored a bit more and it looks like a classpath issue. But how could Ant not be in the classpath of Ant? Where are you supposed to set it?
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never set up my classpath the way you've done it. What I do is set the classpath outside build.xml (unless the task such as javac has a classpath attribute) and then run the target. If you place att.jar on the classpath this way and it still fails, then I'm baffled.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roger,
I was trying to run it from within Eclipse to facilitate testing and didn't want to mess with the classpath. I'll give your approach a try. The real build isn't running in Eclipse anyway.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set up a configuration in eclipse and then place the JAR file on the classpath. I've often run Ant scripts like this.
 
Michael Duffy
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
I'm trying to use the Timer task in my Ant script. If I comment out the timer task, it runs properly and displays Hello World. Is there something I need to do in the classpath to append it to my current one?

When I run it, I get:



Look at the Ant task docs again. It's not <echo>Hello World</echo>; it should be <echo message="Hello World"/> if you're using the Ant echo task.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,
When I run the same build script without the timer task, it works fine. So Ant is allowing <echo>Message</echo>
 
Michael Duffy
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
Michael,
When I run the same build script without the timer task, it works fine. So Ant is allowing <echo>Message</echo>


When I didn't see the <timer> task in my Ant 1.6.5 docs, I asked Google to look for it. It found this site:

http://www.jeckle.de/freeStuff/AntTimerTask/

Maybe the latest news they refer to apply.
 
Ryan Zezeski
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[/qb]<hr></blockquote>

is "<workspace>" the actual name of your directory? That is confusing me.

Otherwise, does ant append or insert to the CLASSPATH? If it appens maybe your CLASSPATH is malformed?

EDIT: Just remembered you cannot even create a dir with the <,> characters in windows and i'm pretty sure you can't on UNIX/Linux either. This would tell me that you are using <workspace> to reference a property or something? If so it should be ${workspace}.
[ February 04, 2006: Message edited by: Ryan Zezeski ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,
I didn't see that before. It could well be the problem they are alluding to. I'll try downloading a different task to see if it is my environment or the Timer task.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ryan Zezeski:
[CODE]is "<workspace>" the actual name of your directory? That is confusing me.

No. Pretend I have the full path to the directory there. I edited it out before posting because I didn't want any non-public information on the web.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it! You need to put the following at the beginnng of the addTask method. Luckily this task is open source. I made the change, re-jar'd it up and it worked. It seems this is a classloader problem.



Source of solution:
http://lists.canoo.com/pipermail/webtest/2004q1/001389.html
[ February 07, 2006: Message edited by: Jeanne Boyarsky ]
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne & Michael,

How did you successfully place the "<" and ">" insider your posting's UBB [ CODE ]?

I have tried everything and it still gives me this:

"Sorry, your post appears to have an illegal HTML tag. Often this is because the post contains a "<" character instead of the equivalent HTML escape sequence "& lt;"

You can fix this by replacing every < in your post with "& lt;" (without the internal space). Sometimes the problem is that you're using a specific method name which our system thinks is part of an attempt to insert some evil JavaScript exploit into our pages. The most common is "get Cookie()" - just replace this phrase with something else like getKookie(). Sorry for the inconvenience; this is the best we can do for now. It's all Mapraputa's fault.

The specific error message is: ONERROR

� Please use your browser's back button to return. "


Many, many thanks!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34668
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unnsse,
I escaped it using HTML escape sequences. So &lt; = < and &gt; = > For just a few special characters, I do it by hand. For a lot, I use Eric's tool at the top of the HTML forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic