org.ow2.jonas.ant.JonasHotDeploymentTool invalid argument -n <serverName>
Hello,
I was writing ant build to compile and deploy a war. The deploy task looks like this :
<target name="deploy-war" depends="create-war" >
<serverdeploy action="deploy" source="${dest.dir}/${simu.war.name}">
<jonas jonasRoot="${env.JONAS_ROOT}"
jonasBase="${env.JONAS_BASE}"/>
</serverdeploy>
</target>
I defined the task serverdeploy like this :
<taskdef name="serverdeploy" classname="org.ow2.jonas.ant.ServerDeploy" classpath="${env.JONAS_ROOT}/lib/common/ow_jonas_ant.jar" />
Executing the task ends with :
deploy-war:
[JOnAS/Deploy] Deploying ''...
[JOnAS/Deploy] Bad option: -n
[JOnAS/Deploy] usage : jonas admin
[JOnAS/Deploy] if no option(except -n), mode is interactive.
[JOnAS/Deploy] list of available options:
[JOnAS/Deploy] -n name : to identify an JOnAS Server
[JOnAS/Deploy] -username username : user name to use when connecting
[JOnAS/Deploy] -password password : password to use when connecting
[JOnAS/Deploy] -registry : to define registry address
[JOnAS/Deploy] -protocol : to define protocol
[JOnAS/Deploy] -start : starts the current JOnAS server.
[JOnAS/Deploy] -stop : stops the current JOnAS server.
[JOnAS/Deploy] -l : lists beans currently in the JOnAS Server.
[JOnAS/Deploy] -lmodules : lists J2EEModules currently in the JOnAS Server.
[JOnAS/Deploy] -lapps : lists J2EEApplications currently in the JOnAS Server.
[JOnAS/Deploy] -j : lists registered JNDI names.
[JOnAS/Deploy] -e : lists JOnAS properties currently used by the JOnAS Server.
[JOnAS/Deploy] -a fileName : dynamically adds : - beans from fileName in a new container
[JOnAS/Deploy] : - servlets from a WAR file
[JOnAS/Deploy] : - j2ee application from an EAR file
[JOnAS/Deploy] : - resource adapter from a RAR file
[JOnAS/Deploy] -r fileName : dynamically remove : - beans from container fileName
[JOnAS/Deploy] : - servlets of a WAR file
[JOnAS/Deploy] : - j2ee application of an EAR file
[JOnAS/Deploy] : - resource adapter from a RAR file
[JOnAS/Deploy] -sync: synchronize all entities
[JOnAS/Deploy] -passivate: passivate all entities
[JOnAS/Deploy] -gc: run the garbage collector
[JOnAS/Deploy] -tt timeout: set default transaction timeout
[JOnAS/Deploy] -target target: set target for commands (default is local server)
[JOnAS/Deploy] -start: Start servers designed by '-target' arg
[JOnAS/Deploy] -stop: Stop servers designed by '-target' arg
[JOnAS/Deploy] -start [-standby] -target target: Start servers designed by '-target' arg
[JOnAS/Deploy] -stop [-standby] -target target: Stop servers designed by '-target' arg
[JOnAS/Deploy] -ping [-timeout ] [-state ]: ping server for milliseconds
[JOnAS/Deploy] until it reaches state
[JOnAS/Deploy] Default timeout is 2 minutes = 120 seconds = 120000 milliseconds
[JOnAS/Deploy] -t list monolog topics
[JOnAS/Deploy] --debug-level topic : set DEBUG for a monolog topic
[JOnAS/Deploy] -q : quiet mode, no processing header information.
[JOnAS/Deploy] -v | --verbose : Verbose mode (Show stack traces).
[JOnAS/Deploy] -h : help message.
[JOnAS/Deploy] -? : help message.
It seems that the class JonasHotDeploymentTool declares the server name (default at 'jonas') on lines 141 and 142 : bootstrapTask.createArg().setValue("-n"); bootstrapTask.createArg().setValue(getServerName()); bootstrapTask.executeJava();
and then calls (via the Java class) the class org.ow2.jonas.commands.admin.ClientAdmin which doesn't seem to know about the "-n" argument and thus ends with the error above. (see class ClientAdmin, lines 377, 378).
I tested my analysis by deleted lines 141 and 142 in class JonasHotDeploymentTool and then the deployment works great for my need. The proper fix is probably to be found in the ClientAdmin class.