You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Chris Huisman <ch...@taylor.com> on 2004/07/28 00:57:57 UTC

problem with cactifywar

Hello,

When using Eclipse 3.0, ant 1.6.1 and cactus 1.6.1 I get the following 
error when trying to use the cactifywar task:

D:\chuisman\dev\egon\build-cactus.xml:21: taskdef A class needed by 
class org.apache.cactus.integration.ant.CactifyWarTask cannot be found: 
org/apache/commons/logging/Log

I also get the following warning in eclipse: A class needed by class 
org.apache.Cactus.integration.ant.CactusTask cannot be found: 
junit/framework/TestListener

I have created an ant task in eclips 
(Window->preferences->ant->Runtime-Tasks) called cactus.ejb which points 
to the CactusTask class. If I remove this task I get the following error:

taskdef A class needed by class 
org.apache.cactus.integration.ant.CactusTask cannot be found: 
junit/framework/TestListener

Same one as the warning in eclipse.

If i run it from the command line with the verbose option set I get the 
following error:

[ant] Entering D:\chuisman\dev\egon\build-cactus.xml...
Build sequence for target `ear.cactify' is [ear.cactify]
Complete build sequence is [ear.cactify, test, ]

ear.cactify:
[ant] Exiting D:\chuisman\dev\egon\build-cactus.xml.
[antcall] Exiting D:\chuisman\dev\egon\build.xml.
[antcall] Exiting D:\chuisman\dev\egon\build.xml.

BUILD FAILED
D:\chuisman\dev\egon\build.xml:74: Following error occured while 
executing this
line
D:\chuisman\dev\egon\build.xml:474: Following error occured while 
executing this
line
D:\chuisman\dev\egon\build.xml:481: Following error occured while 
executing this
line
D:\chuisman\dev\egon\build-cactus.xml:32: Could not create task or type 
of type:
cactifywar.

Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'cactifywar'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and optional.jar is absent
Fix: look for optional.jar in ANT_HOME/lib, download if needed
- The task was not built into optional.jar as dependent
libraries were not found at build time.
Fix: look in the JAR to verify, then rebuild with the needed
libraries, or download a release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task
and needs to be declared using <taskdef>.

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
tHelper.java:574)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:422)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:144)

at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
at org.apache.tools.ant.Task.perform(Task.java:401)
at org.apache.tools.ant.Target.execute(Target.java:338)
at org.apache.tools.ant.Target.performTasks(Target.java:365)
at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
at org.apache.tools.ant.Main.runBuild(Main.java:669)
at org.apache.tools.ant.Main.startAnt(Main.java:220)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)

The ant code is:

<target name="ear.cactify" >
<taskdef resource="cactus.tasks">
<classpath>
<pathelement location="${cactus.ant.jar}"/>
<pathelement location="${cactus.jar}"/>
<pathelement location="${logging.jar}"/>
<pathelement location="${aspectjrt.jar}"/>
<pathelement location="${httpclient.jar}"/>
</classpath>
</taskdef>

<cactifywar version="2.3" destfile="${dist.dir}/${war.test.name}"
mergewebxml="${conf.dir}/cactus/web.xml">
<classes dir="${build.class.dir}" includes="**/cactus/**/*.class" />
</cactifywar>

<ear update="true" destfile="${dist.dir}/${ear.name}"
appxml="${conf.dir}/cactus/application.xml">
<fileset dir="${dist.dir}">
<include name="${war.test.name}"/>
</fileset>
</ear>

</target>

Can anyone tell me what I am doing wrong?

Does it have something to do with: 
http://www.mail-archive.com/cactus-user@jakarta.apache.org/msg05506.html

and if so can you explain how to set up ant task more completely?

Thank you,

Chris.

RE: problem with cactifywar

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Chris,

> -----Original Message-----
> From: Chris Huisman [mailto:chuisman@taylor.com]
> Sent: mercredi 28 juillet 2004 00:58
> To: cactus-user@jakarta.apache.org
> Subject: problem with cactifywar
> 
> Hello,
> 
> When using Eclipse 3.0, ant 1.6.1 and cactus 1.6.1 I get the following
> error when trying to use the cactifywar task:
> 
> D:\chuisman\dev\egon\build-cactus.xml:21: taskdef A class needed by
> class org.apache.cactus.integration.ant.CactifyWarTask cannot be found:
> org/apache/commons/logging/Log

Yes, you need the commons logging jar in your CP. As well as lots of other
jars (please check the cactus web site for the full list).

> 
> I also get the following warning in eclipse: A class needed by class
> org.apache.Cactus.integration.ant.CactusTask cannot be found:
> junit/framework/TestListener

Same as above. You also need JUnit in your CP.

> 
> I have created an ant task in eclips
> (Window->preferences->ant->Runtime-Tasks) called cactus.ejb which points
> to the CactusTask class. If I remove this task I get the following error:
> 
> taskdef A class needed by class
> org.apache.cactus.integration.ant.CactusTask cannot be found:
> junit/framework/TestListener

Yes, in Eclipse this step is required. You simply need to add all the jars
against this taskdef. Same as you would do in Ant code.

> 
> Same one as the warning in eclipse.
> 
> If i run it from the command line with the verbose option set I get the
> following error:
> 
> [ant] Entering D:\chuisman\dev\egon\build-cactus.xml...
> Build sequence for target `ear.cactify' is [ear.cactify]
> Complete build sequence is [ear.cactify, test, ]
> 
> ear.cactify:
> [ant] Exiting D:\chuisman\dev\egon\build-cactus.xml.
> [antcall] Exiting D:\chuisman\dev\egon\build.xml.
> [antcall] Exiting D:\chuisman\dev\egon\build.xml.
> 
> BUILD FAILED
> D:\chuisman\dev\egon\build.xml:74: Following error occured while
> executing this
> line
> D:\chuisman\dev\egon\build.xml:474: Following error occured while
> executing this
> line
> D:\chuisman\dev\egon\build.xml:481: Following error occured while
> executing this
> line
> D:\chuisman\dev\egon\build-cactus.xml:32: Could not create task or type
> of type:
> cactifywar.
> 
> Ant could not find the task or a class this task relies upon.

[snip]

> 
> The ant code is:
> 
> <target name="ear.cactify" >
> <taskdef resource="cactus.tasks">
> <classpath>
> <pathelement location="${cactus.ant.jar}"/>
> <pathelement location="${cactus.jar}"/>
> <pathelement location="${logging.jar}"/>
> <pathelement location="${aspectjrt.jar}"/>
> <pathelement location="${httpclient.jar}"/>
> </classpath>
> </taskdef>
> 

[snip]

> 
> Can anyone tell me what I am doing wrong?
> 

Probably some properties are not pointing to the right location where the
jars are located. Run Ant in debug mode (-debug) and check the output.

> Does it have something to do with:
> http://www.mail-archive.com/cactus-user@jakarta.apache.org/msg05506.html
> 
> and if so can you explain how to set up ant task more completely?

See the doc on the Cactus web site + check the examples you get when you
download Cactus. They should work fine and you can work from there.

Thanks
-Vincent

PS: In the end I took some of my holiday tome to answer you quickly... ;-)