Question

Am kind of stuck in trying to start JBoss automatically from Ant script with the help of Cargo open source project. Am getting this error shown underneath. Many Thanks!

taskdef:

    <taskdef resource="cargo.tasks">
        <classpath>
            <pathelement location="${cargo.core.jar}"/>
            <pathelement location="${cargo.ant.jar}"/>
        </classpath>
    </taskdef>

Jar Used:

 cargo-core-uberjar-1.2.1.jar
 cargo-ant-1.2.1.jar

Ant target:

<!-- Start JBoss -->
<target name="startJboss" depends="prepare">
    <cargo id="mycontainerid" containerId="jboss51x" home="C:/opt/jboss/jboss-4.0.5.GA/bin" action="start" wait="false" />
</target>

Output Error:

Buildfile: D:\opt\trunk\build.xml
startJboss:

BUILD FAILED
D:\opt\trunk\build.xml:51: Could not create type cargo due to java.lang.NoClassDefFoundError: org/apache/commons/discovery/resource/ClassLoaders

Total time: 2 seconds
Was it helpful?

Solution

If you are using JBoss 4.0.5.GA, shouldn't you be using a matching value for containerId instead of jboss51x? (I have not used Cargo in a while, so I may be wrong about this)

The Cargo - Ant support page says Some additional dependencies might also be required for the ANT task. Please see the Installation page for details.; when I go to the Installation, it tells me that you need to satisfy Cargo's base dependencies, which include Commons Discovery (which, your error message tells me, is missing) and Commons Logging. Add these JARs to the classpath for your taskdef and give it another shot.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top