SJSAS 8.1 and the "sun appserv deploy" Ant task
Afternoon all,
I'm currently trying to get cactus working with cruisecontrol as part of an automated build (we're developing in netbeans 5.0 & commiting to cvsnt). As part of this I need to use the sun-appserv-deploy and sun-appserv-undeploy ant tasks to start/stop the server automatically for the running of unit tests.
My biggest problem is I'm no guru with either Ant or the classpath :-/ The relevant part of my Ant build is as follows
<target name="sun-taskdef" depends="compile-test">
<taskdef name="sun-appserv-deploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.DeployTask">
<classpath>
<pathelement location="${sun.appserver.antjar}" />
<pathelement location="${admin.cli.jar}" />
</classpath>
</taskdef>
<taskdef name="sun-appserv-undeploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.UndeployTask">
<classpath>
<pathelement location="${sun.appserver.antjar}" />
<pathelement location="${admin.cli.jar}" />
</classpath>
</taskdef>
</target>
<target name="deploy-sun-test" depends="sun-taskdef">
<sun-appserv-deploy file="${dist.dir}\\test-cactus.war"
contextroot="/CactusTest"
name="CactusTestWAR"
force="true"
precompilejsp="false"
verify="false"
upload="true"
user="admin"
passwordfile="powertec"
host="localhost"
port="4848"
asinstalldir="C:/Sun/AppServer" />
</target>
<target name="undeploy-sun-test">
<sun-appserv-undeploy name="CactusTestWAR"
user="admin"
passwordfile="powertec"
host="localhost"
port="4848" />
</target>
<target name="test" depends="default,sun-taskdef">
<cactifywar destfile="${dist.dir}\\test-cactus.war" srcfile="${dist.dir}\\CactusTest.war" />
<delete file="*.cactus.log"/>
<cactus haltonfailure="yes" showoutput="yes" printsummary="on" warfile="${dist.dir}\\test-cactus.war">
<cactusproperty server="false" propertiesFile="src//conf//cactus.client.log4j.properties"/>
<cactusproperty server="true" propertiesFile="src//conf//cactus.server.log4j.properties"/>
<classpath refid="classpath"/>
<containerset>
<generic name="Sun Appserver 8.1 Q2" port="8080">
<startup target="deploy-sun-test"/>
<shutdown target="undeploy-sun-test"/>
</generic>
</containerset>
</cactus>
<delete file="${dist.dir}\\test-cactus.war"/>
</target>
And the specific error I'm getting is :-
[sun-appserv-deploy] Executing: deploy --user admin --passwordfile"whatpassword?" --host localhost --port 4848 --force=true
--enabled=true --name CactusTestWAR --verify=false --precompilejsp=false --upload=true --contextroot /CactusTest"C:\Do
cuments and Settings\davidl\My Documents\J2EE projects\CactusTest\dist\test-cactus.war"
[cactus] Exiting C:\Documents and Settings\davidl\My Documents\J2EE projects\CactusTest\build.xml.
[cactus] Exception in thread"Thread-5" C:\Documents and Settings\davidl\My Documents\J2EE projects\CactusTest\build.
xml:68: The following error occurredwhile executingthis line:
[cactus] C:\Documents and Settings\davidl\My Documents\J2EE projects\CactusTest\build.xml:53: A Sun Java System Appli
cation Server 8 admin CLIclass could not be found (com.sun.enterprise.cli.framework.InputsAndOutputs). Use the asinsta
lldir attribute, set the asinstall.dir property, or add the appropriate JARs to the classpath.
[cactus]at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:539)
[cactus]at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:384)
[cactus]at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
[cactus]at org.apache.cactus.integration.ant.container.GenericContainer$Hook.execute(GenericContainer.java:110)
[cactus]at org.apache.cactus.integration.ant.container.GenericContainer.startUp(GenericContainer.java:285)
[cactus]at org.apache.cactus.integration.ant.container.ContainerRunner$1.run(ContainerRunner.java:140)
[cactus]at java.lang.Thread.run(Thread.java:595)
[cactus] Caused by: C:\Documents and Settings\davidl\My Documents\J2EE projects\CactusTest\build.xml:53: A Sun Java S
ystem Application Server 8 admin CLIclass could not be found (com.sun.enterprise.cli.framework.InputsAndOutputs). Use
the asinstalldir attribute, set the asinstall.dir property, or add the appropriate JARs to the classpath.
[cactus]at org.apache.tools.ant.taskdefs.optional.sun.appserv.AppServerAdmin.execAdminCommand(AppServerAdmin.jav
a:514)
[cactus]at org.apache.tools.ant.taskdefs.optional.sun.appserv.ComponentAdmin.execute(ComponentAdmin.java:250)
[cactus]at org.apache.tools.ant.taskdefs.optional.sun.appserv.AppServerAdmin.execute(AppServerAdmin.java:404)
[cactus]at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[cactus]at org.apache.tools.ant.Task.perform(Task.java:364)
[cactus]at org.apache.tools.ant.Target.execute(Target.java:341)
[cactus]at org.apache.tools.ant.Target.performTasks(Target.java:369)
[cactus]at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[cactus]at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
[cactus]at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[cactus]at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
[cactus]... 5 more
[cactus] Nested Exception
[cactus] C:\Documents and Settings\davidl\My Documents\J2EE projects\CactusTest\build.xml:53: A Sun Java System Appli
cation Server 8 admin CLIclass could not be found (com.sun.enterprise.cli.framework.InputsAndOutputs). Use the asinsta
lldir attribute, set the asinstall.dir property, or add the appropriate JARs to the classpath.
[cactus]at org.apache.tools.ant.taskdefs.optional.sun.appserv.AppServerAdmin.execAdminCommand(AppServerAdmin.jav
a:514)
[cactus]at org.apache.tools.ant.taskdefs.optional.sun.appserv.ComponentAdmin.execute(ComponentAdmin.java:250)
[cactus]at org.apache.tools.ant.taskdefs.optional.sun.appserv.AppServerAdmin.execute(AppServerAdmin.java:404)
[cactus]at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[cactus]at org.apache.tools.ant.Task.perform(Task.java:364)
[cactus]at org.apache.tools.ant.Target.execute(Target.java:341)
[cactus]at org.apache.tools.ant.Target.performTasks(Target.java:369)
[cactus]at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[cactus]at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
[cactus]at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[cactus]at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
[cactus]at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
[cactus]at org.apache.cactus.integration.ant.container.GenericContainer$Hook.execute(GenericContainer.java:110)
[cactus]at org.apache.cactus.integration.ant.container.GenericContainer.startUp(GenericContainer.java:285)
[cactus]at org.apache.cactus.integration.ant.container.ContainerRunner$1.run(ContainerRunner.java:140)
[cactus]at java.lang.Thread.run(Thread.java:595)
I can see that I need to either set asinstalldir in the task, set the asinstall.dir property or make sure the relevant jar's are the classpath and obviously I'm trying to get the correct jar's into the classpath (having unsuccessfully tried the previous two options, even with hard-coded values).
I've also read that it is preferrable to use asant to call these ant tasks, but this is an option I do not have as I am constrained to using normal ant with cruisecontrol.
Any help or advice anyone can provide would be greatly appreciated as I'm proper banging my head against a brickwall here and there's sod all on t'internet from what I can find ;-(
Cheers
Dave Lush

