You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Franck Routier <Fr...@hospvd.ch> on 2001/12/05 13:46:52 UTC

Lost newbie : cannot get new task to work

Hi list,

I am trying to integrate the xmlc task into my build.xml file but I keep 
getting an error.
The purpose of the xmlc task is to call the xmlc xml compiler that turns 
xml (or html) files into a full java dom. XMLCTask extends MatchingTask.

1) Here is my build.xml file (relevant parts) :

...
<taskdef name="Xmlc" classname="org.enhydra.barracuda.taskdefs.Xmlc" 
classpath="lib/ant-barracuda.jar"/>
...
<target name="compile_xmlc">
<Xmlc includes="**/*.html" compile="no" srcdir="src/xmlc/" verbose="true"/>
</target>
...

2) Here is what ant - debug gives me (well, only the parts I thought were 
relevant) :

...
+Task: taskdef
Class org.enhydra.barracuda.taskdefs.Xmlc loaded from parent loader
+User task: Xmlc org.enhydra.barracuda.taskdefs.Xmlc
...
+Target: compile_xmlc
...
compile_xmlc:

BUILD FAILED

/Users/franckro/devel/bdc/build.xml:201: Could not create task of type:
Xmlc due to java.lang.NoClassDefFoundError
at org.apache.tools.ant.Project.createTask(Project.java:509)
at
org.apache.tools.ant.UnknownElement.makeTask(UnknownElement.java:148)
at
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:8
3)
at org.apache.tools.ant.Task.perform(Task.java:216)
at org.apache.tools.ant.Target.execute(Target.java:184)
at org.apache.tools.ant.Target.performTasks(Target.java:202)
at org.apache.tools.ant.Project.executeTarget(Project.java:601)
at
org.apache.tools.ant.Project.executeTargets(Project.java:560)
at org.apache.tools.ant.Main.runBuild(Main.java:454)
at org.apache.tools.ant.Main.start(Main.java:153)
at org.apache.tools.ant.Main.main(Main.java:176)
--- Nested Exception ---
java.lang.NoClassDefFoundError
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at org.apache.tools.ant.Project.createTask(Project.java:486)
at
org.apache.tools.ant.UnknownElement.makeTask(UnknownElement.java:148)
at
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:8
3)
at org.apache.tools.ant.Task.perform(Task.java:216)
at org.apache.tools.ant.Target.execute(Target.java:184)
at org.apache.tools.ant.Target.performTasks(Target.java:202)
at org.apache.tools.ant.Project.executeTarget(Project.java:601)
at
org.apache.tools.ant.Project.executeTargets(Project.java:560)
at org.apache.tools.ant.Main.runBuild(Main.java:454)
at org.apache.tools.ant.Main.start(Main.java:153)
at org.apache.tools.ant.Main.main(Main.java:176)

Total time: 7 seconds


Thanks for any help,

Franck Routier


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Lost newbie : cannot get new task to work

Posted by Franck Routier <Fr...@hospvd.ch>.
At 14:50 05.12.2001 +0100, you wrote:

>Use a nested classpath element for your taskdef, something like
>
><taskdef name="Xmlc" classname="...">
>   <classpath>
>     <pathelement location="/opt/log4j/log4j.jar" />
>     <pathelement location="/opt/xmlc/xmlc.jar" />
>     <pathelement location="/opt/xmlc/xmlc-ant-task.jar" />
>   </classpath>
></taskdef>
>
>I forgot the real name of that jar, but you'll get the idea.

Ok, I think I get the trick

> > Another point is I noticed that after every + Target, there is one
> > or several +Task.
>
>Don't worry about that.

:-)

Thank you Stefan,

I'll try all that tonight.I can't try now for I'm not in the right place, 
so I cannot tell if my problem is solved, but I definitely thanks you very 
much for your responsivness.

Franck Routier


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Lost newbie : cannot get new task to work

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 05 Dec 2001, Franck Routier <Fr...@hospvd.ch> wrote:

> in fact Xmlc task depends on two jars :
> 
> xmlc.jar (the compiler itself)
> log4j.jar (for logging)
> 
> If I don't put those jars in ANT_HOME/lib, how do I tell my xmlc
> task where to find it ?

Use a nested classpath element for your taskdef, something like

<taskdef name="Xmlc" classname="...">
  <classpath>
    <pathelement location="/opt/log4j/log4j.jar" />
    <pathelement location="/opt/xmlc/xmlc.jar" />
    <pathelement location="/opt/xmlc/xmlc-ant-task.jar" />
  </classpath>
</taskdef>

I forgot the real name of that jar, but you'll get the idea.

> Another point is I noticed that after every + Target, there is one
> or several +Task.

Don't worry about that.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Lost newbie : cannot get new task to work

Posted by Franck Routier <Fr...@hospvd.ch>.
Thanks Stefan,

well,

in fact Xmlc task depends on two jars :

xmlc.jar (the compiler itself)
log4j.jar (for logging)

If I don't put those jars in ANT_HOME/lib, how do I tell my xmlc task where 
to find it ?

Another point is I noticed that after every + Target, there is one or 
several +Task.
But I only have
+Target: compile_xmlc
and no +Task after...


Franck Routier


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Lost newbie : cannot get new task to work

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 05 Dec 2001, Franck Routier <Fr...@hospvd.ch> wrote:

> <taskdef name="Xmlc" classname="org.enhydra.barracuda.taskdefs.Xmlc"
>                      classpath="lib/ant-barracuda.jar"/>

> +Task: taskdef
> Class org.enhydra.barracuda.taskdefs.Xmlc loaded from parent loader

the key here is "from parent loader" - that is the class is on your
system classpath.

> Xmlc due to java.lang.NoClassDefFoundError

It seems to find the task class itself, but fails to load some other
classes that this task depends upon.

Don't put anything into ANT_HOME/lib and try with an empty CLASSPATH
so that you can be sure that org.enhydra.barracuda.taskdefs.Xmlc will
be loaded from the jar file you are pointing taskdef to.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>