Author |
Message
|
er_pankajgupta84 |
Posted: Mon Apr 13, 2009 7:22 am Post subject: ANT Scripts for creating / deployin bar files. |
|
|
 Master
Joined: 14 Nov 2008 Posts: 203 Location: charlotte,NC, USA
|
Hi
This is the first time i am trying to use ANT scripts... i went thru few manuals and created 2 scripts. One for Creating a bar file and other for deploying it but none of them is working.
Here is the problem:
Ant script (.xml) file for creating a bar:
<project name="project" default="run">
<target name="run" description="">
<property name="toolkit.home" value="C:\WINDOWS\IBM\WMBT610" />
<property name="ant.bars.basedir" value="C:\WINDOWS\IBM\apache-ant-1.7.1" />
<property name="workspaces.dir" value="C:\WINDOWS\IBM\WorkSpaces\poc" />
<property name="bar.name" value="C:\WINDOWS\IBM\WorkSpaces\poc\Servers\Temp2.bar" />
<antcall target="mqsicreatebar.buildbar" />
</target>
<!--
Target to build the broker archive using mqsicreatebar
-->
<target name="mqsicreatebar.buildbar">
<echo message="Building Broker Archive file: ${bar.name} " />
<exec executable="${toolkit.home}\eclipse\mqsicreatebar.exe" spawn="false">
<arg value="-data" />
<arg value="${workspaces.dir}" />
<arg value="-b" />
<arg value="${bar.name}" />
<arg value="-p" />
<arg value="Temp_Message_Flow" />
<arg value="-o" />
<arg value="Temp_Message_Flow\Temp.msgflow" />
</exec>
<echo message="Completed building Broker Archive file - ${bar.name} " />
</target>
</project>
When i run this file from cmd using : ant -buildfile AntScript.xml
Then it displays BUILD Successful message as shown below:
C:\WINDOWS\IBM\apache-ant-1.7.1\bin>ant -buildfile AntScript.xml
Buildfile: AntScript.xml
run:
mqsicreatebar.buildbar:
[echo] Building Broker Archive file: C:\WINDOWS\IBM\WorkSpaces\poc\Servers\
Temp2.bar
[exec] Result: 2
[echo] Completed building Broker Archive file - C:\WINDOWS\IBM\WorkSpaces\p
oc\Servers\Temp2.bar
BUILD SUCCESSFUL
Total time: 1 minute 18 seconds
But when i open the created bar file i don't see any flow in it. Also the file of that bar file is just 1 kb. I am not able to get where i am doing wrong.
Another problem:
I created the following script for deploying an already created bar file
<project name="project" default="run">
<target name="run" description="">
<property name="mqsi.dir" value="C:\WINDOWS\IBM\MQSI\6.1\bin" />
<property name="bar" value="C:\WINDOWS\IBM\WorkSpaces\poc\Servers\Temp.bar" />
<property name="ipaddress" value="localhost" />
<property name="port" value="1417" />
<property name="queuemgr" value="QM3" />
<property name="broker" value="BRK3" />
<property name="exegroup" value="Default" />
<antcall target="mqsideploy.deploybar" />
</target>
<!--
Target to build the broker archive using mqsicreatebar
-->
<target name="mqsideploy.deploybar">
<!-- <exec executable="${mqsi.dir}\mqsideploy.bat" spawn="false"> -->
<exec executable="${mqsi.dir}\mqsideploy.bat" failonerror="true" logError="true" vmlauncher="false" append="true">
<arg value="-i" />
<arg value="${ipaddress}" />
<arg value="-p" />
<arg value="${port}" />
<arg value="-q" />
<arg value="${queuemgr}" />
<arg value="-b" />
<arg value="${broker}" />
<arg value="-e" />
<arg value="${exegroup}" />
<arg value="-a" />
<arg value="${bar}" />
</exec>
</target>
</project>
when i run it i got following message:
C:\WINDOWS\IBM\apache-ant-1.7.1\bin>ant -buildfile AntDeploy.xml
Buildfile: AntDeploy.xml
run:
mqsideploy.deploybar:
BUILD SUCCESSFUL
Total time: 0 seconds
But nothing got deployed...
Any pointers would be helpful. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Apr 13, 2009 8:00 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It sounds like you don't have the right things in the right workspace. |
|
Back to top |
|
 |
joebuckeye |
Posted: Mon Apr 13, 2009 8:39 am Post subject: Re: ANT Scripts for creating / deployin bar files. |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH
|
er_pankajgupta84 wrote: |
<exec executable="${toolkit.home}\eclipse\mqsicreatebar.exe" spawn="false">
|
Everything looks good to me as far as how your script is put together with one difference from how ours works.
We have these attributes vmlauncher="false" failonerror="true" as part of the <exec> task (in addition to the spawn="false" you have).
You may actually be having errors but the <exec> task was able to successfully run the mqsicreatebar command so it reports a success. Putting failonerror="true" causes the <exec> task to report a failure because the executable it is running failed. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Mon Apr 13, 2009 10:06 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
If you manually (outside of ant) run the command that is generated by the exec task, this reports errors that you may not see when running the task from ant.
This has helped me in the past. |
|
Back to top |
|
 |
muthu_tek |
Posted: Fri Apr 23, 2010 10:45 pm Post subject: |
|
|
Apprentice
Joined: 21 Jan 2010 Posts: 36 Location: Coimbatore,India
|
Hi all,
I have tried to deploy the bar file using ant scripts. I have tried the script below
File Name is broker.xml
<?xml version="1.0"?>
<project name="My_Project" default="run">
<target name="run" description="">
<property name="mqsi.home" value="C:\Program Files\IBM\MQSI\6.1\bin"/>
<property name="bar.name" value="F:\workspace\ANTSCRIPT\FEE.bar" />
<property name="ipaddress" value="localhost" />
<property name="port" value="2416" />
<property name="queuemgr" value="QUEUE_MANAGER" />
<property name="broker" value="DEFAULT_BROKER" />
<property name="exegroup" value="Default" />
<antcall target="mqsideploy.deploybar" />
</target>
<target name="mqsideploy.deploybar">
<exec executable="${mqsi.home}\mqsideploy.bat" spawn="false" vmlauncher="false" failonerror="true">
<arg value="-i" />
<arg value="${ipaddress}" />
<arg value="-p" />
<arg value="${port}" />
<arg value="-q" />
<arg value="${queuemgr}" />
<arg value="-b" />
<arg value="${broker}" />
<arg value="-e" />
<arg value="${exegroup}" />
<arg value="-a" />
<arg value="${bar.name}" />
</exec>
<echo message="Deploying Broker Archive file - ${bar.name} " />
</target>
</project>
C:\WINDOWS\IBM\apache-ant-1.7.1\bin>ant -buildfile broker.xml
Buildfile: broker.xml
run:
mqsideploy.deploybar:
[exec] The system cannot find the path specified.
[echo] Deploying Broker Archive file - F:\workspace\ANTSCRIPT\FEE.bar
BUILD SUCCESSFUL
Total time: 531 milliseconds
I am getting message like "The system cannot find the path specified."
So I could not deploy the bar file in broker.
Am I missing anything ?
Note :
My bar file location and Message Broker location are configuring properly.
Thanks in advance.  |
|
Back to top |
|
 |
krypton |
Posted: Sun Apr 25, 2010 1:29 am Post subject: |
|
|
 Disciple
Joined: 14 Mar 2010 Posts: 186
|
Quote: |
I have tried to deploy the bar file using ant scripts. I have tried the script below
File Name is broker.xml
<?xml version="1.0"?>
<project name="My_Project" default="run">
<target name="run" description="">
<property name="mqsi.home" value="C:\Program Files\IBM\MQSI\6.1\bin"/>
<property name="bar.name" value="F:\workspace\ANTSCRIPT\FEE.bar" />
<property name="ipaddress" value="localhost" />
<property name="port" value="2416" />
<property name="queuemgr" value="QUEUE_MANAGER" />
<property name="broker" value="DEFAULT_BROKER" />
<property name="exegroup" value="Default" />
<antcall target="mqsideploy.deploybar" />
</target>
<target name="mqsideploy.deploybar">
<exec executable="${mqsi.home}\mqsideploy.bat" spawn="false" vmlauncher="false" failonerror="true">
<arg value="-i" />
<arg value="${ipaddress}" />
<arg value="-p" />
<arg value="${port}" />
<arg value="-q" />
<arg value="${queuemgr}" />
<arg value="-b" />
<arg value="${broker}" />
<arg value="-e" />
<arg value="${exegroup}" />
<arg value="-a" />
<arg value="${bar.name}" />
</exec>
<echo message="Deploying Broker Archive file - ${bar.name} " />
</target>
</project>
C:\WINDOWS\IBM\apache-ant-1.7.1\bin>ant -buildfile broker.xml
Buildfile: broker.xml
run:
mqsideploy.deploybar:
[exec] The system cannot find the path specified.
[echo] Deploying Broker Archive file - F:\workspace\ANTSCRIPT\FEE.bar
BUILD SUCCESSFUL
Total time: 531 milliseconds
I am getting message like "The system cannot find the path specified."
So I could not deploy the bar file in broker.
Am I missing anything ?
Note :
My bar file location and Message Broker location are configuring properly. |
where does have you specified the Message Flow project name and the Message flow name?? _________________ Dreams are not something which you watch when you are asleep,it is something which doesn't let you sleep. |
|
Back to top |
|
 |
muthu_tek |
Posted: Sun Apr 25, 2010 9:03 pm Post subject: |
|
|
Apprentice
Joined: 21 Jan 2010 Posts: 36 Location: Coimbatore,India
|
krypton
Quote: |
where does have you specified the Message Flow project name and the Message flow name?? |
Actually I have created bar file using your expectation ( Message Flow Project and Message Flow).Now I am trying to deploy the bar file.There we should not mentioned these attribute right.
Thanks for your input.Good day |
|
Back to top |
|
 |
krypton |
Posted: Mon Apr 26, 2010 2:03 am Post subject: |
|
|
 Disciple
Joined: 14 Mar 2010 Posts: 186
|
Quote: |
F:\workspace\ANTSCRIPT\FEE.bar |
Please check ur location again, from the error it seems that the command is not able to find that particular bar file, although there cud be other reasons for this error, but I can think of this one only.
Sorry can not be of much help.
Gud Luck and have fun! _________________ Dreams are not something which you watch when you are asleep,it is something which doesn't let you sleep. |
|
Back to top |
|
 |
muthu_tek |
Posted: Mon Apr 26, 2010 2:39 am Post subject: |
|
|
Apprentice
Joined: 21 Jan 2010 Posts: 36 Location: Coimbatore,India
|
Quote: |
Sorry can not be of much help.
|
Don't feel sorry dear.I have checked the bar file location also.Its located in proper location.Anyway thanks dear.I will try and update .
Good day
- Marimuthu Udayakumar |
|
Back to top |
|
 |
hallmark |
Posted: Thu Apr 29, 2010 2:16 am Post subject: |
|
|
 Voyager
Joined: 10 Mar 2005 Posts: 76
|
@WMBDEV1
Re output, I have found if you wrap the mqsicreatebar.exe command in a perl script you get a bit more output if and when it fails. It performs more slowly and obviously requires the addition of perl...but quite handy if one is hacking around with refactoring workspaces  _________________ Rob |
|
Back to top |
|
 |
veverman |
Posted: Wed Dec 01, 2010 6:34 pm Post subject: |
|
|
Newbie
Joined: 01 Dec 2010 Posts: 2
|
You must have 1 posts before you can post URL's/Links. |
|
Back to top |
|
 |
veverman |
Posted: Wed Dec 01, 2010 6:35 pm Post subject: ANT Scripts for creating / deploying bar files |
|
|
Newbie
Joined: 01 Dec 2010 Posts: 2
|
I got the same error muthu_tek did. Here is how I fix the problem. First, the bar file argument of command mqsideploy.bat is "-bar barfilename". It is not "-a barfilename". "-a barfilename" is used for mqsideploy.exe. The second problem is that when mqsideploy.bat is called from an ant file, the environment variables have not been initiated. I created a mymqsideploy.bat by copying and pasting the original mqsideploy.bat and then I added the following one line of script into mymqsideploy.bat - "CALL C:\Progra~1\IBM\MQSI\6.1\bin\mqsiprofile.cmd"
#############################################
Here is the mymqsideploy.bat
#############################################
@echo off
setlocal
CALL C:\Progra~1\IBM\MQSI\6.1\bin\mqsiprofile.cmd
set PRODUCT_PATH=%~dp0..
if %1""=="" goto noparam
SET parm8=%8
SET parm9=%9
SHIFT /8
SET parm10=%9
SHIFT /8
SET parm11=%9
SHIFT /8
SET parm12=%9
SHIFT /8
SET parm13=%9
SHIFT /8
SET parm14=%9
SHIFT /8
SET parm15=%9
SHIFT /8
SET parm16=%9
SHIFT /8
SET parm17=%9
SHIFT /8
SET parm18=%9
SHIFT /8
SET parm19=%9
SHIFT /8
SET parm20=%9
"%MQSI_JREPATH%\bin\java" com.ibm.broker.config.util.Deploy %1 %2 %3 %4 %5 %6 %7 %parm8% %parm9% %parm10% %parm11% %parm12% %parm13% %parm14% %parm15% %parm16% %parm17% %parm18% %parm19% %parm20%
goto end
:noparam
"%MQSI_JREPATH%\bin\java" com.ibm.broker.config.util.Deploy -?
:end
endlocal
#############################################
Here is the ant script build.xml
#############################################
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="run" basedir=".">
<target name="run" description="">
<property name="mqsi.home" value="C:\Progra~1\IBM\MQSI\6.1" />
<property name="bar.name" value="${basedir}\ccSample.bar" />
<property name="ipaddress" value="localhost" />
<property name="port" value="3414" />
<property name="queuemgr" value="QMWMB61" />
<property name="broker" value="QMWMB61BRK" />
<property name="exegroup" value="EG01" />
<antcall target="mqsideploy.deploybar" />
</target>
<target name="mqsideploy.deploybar">
<echo message="${mqsi.home}\bin\mqsideploy.bat"></echo>
<exec executable="${mqsi.home}\bin\mymqsideploy.bat"
spawn="false"
logError="true"
vmlauncher="false"
failonerror="true"
append="true">
<arg value="-i" />
<arg value="${ipaddress}" />
<arg value="-p" />
<arg value="${port}" />
<arg value="-q" />
<arg value="${queuemgr}" />
<arg value="-b" />
<arg value="${broker}" />
<arg value="-e" />
<arg value="${exegroup}" />
<arg value="-bar" />
<arg path="${bar.name}" />
</exec>
<echo message="Deploying Broker Archive file - ${bar.name} " />
</target>
</project> |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Dec 01, 2010 11:07 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
As you are a newbie here there are a few points about posting that may help you in future
1) Use Code tags around things like your ant script and error messages. It is a lot easier to read them that way.
2) Don't reopen old posts. Post anew and reference the old one using the URL tags. IT is often the case that the problem may on the surface appear to be the same as the old one but there is some other cause.
Thanks _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
mqxplorer |
Posted: Mon Aug 29, 2011 1:17 pm Post subject: |
|
|
 Master
Joined: 22 Jun 2009 Posts: 206
|
Hi veverman,
Your mymqsideploy.cmd worked for me. Thanks for sharing this info. Setting this profile will work for deploying the bar file in higher evnvironments also...Is that correct? What I understood from this is we are just setting up the profile on your local machine and as you have the connection details for the environemnet you are connecting to from your machine remotley so the deployment should work...Am I correct?
mqxplorer |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Aug 30, 2011 4:26 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
If you are going to use Ant to build the bar file, why not use Ant to deploy the bar file? Ant works cross-platform, DOS batch files do not. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|