• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ant websphere wsstartserver

 
Ranch Hand
Posts: 34
Mac IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Coderanchers,
I am having problem executing following target, error message says: unable to execute the command, with no reason why. Can anyone please help me regarding this error. Below is the ant code:
<taskdef name="wsStartServer" classname="com.ibm.websphere.ant.tasks.StartServer" classpathref="was.runtime"/>
<target name="start">
<wsStartServer server="${was.server.name}"
noWait="false"
quiet="false"
logFile="C:/Work/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1/startServer.log"
replaceLog="true"
trace="true"
username="websphere"
password="websphere"
wasHome="${was.home}"
failonerror="true"/>
</target>
 
Mujahed Syed
Ranch Hand
Posts: 34
Mac IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have got solution to this problem,

Solution: normal ant will not work you have to execute your build.xml file with ws_ant.bat located in %WAS_HOME%/bin, so the command is:

ws_ant.bat -f %WORKSPACE%/build.xml

Hope this helps
 
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good that this is working for you. Just to share I use normal ant from Apache successfully with both WAS 6.1 and 7.0. I use it fairly extensively for start, stop, install, uninstall etc.

Typical IBM recommendation is to always use their custom changes
 
Mujahed Syed
Ranch Hand
Posts: 34
Mac IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you do that? do you have example build.xml that you can share please.
 
Deepak Pant
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is how I start the WAS Server.

 
Mujahed Syed
Ranch Hand
Posts: 34
Mac IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Things aren't that easy as you have posted. Initally I did went that way, and yes I do agree that it will work. But it will work for stopserver, startserver, listapplications, and also undeploy but things get complicated when you use that kind of command to deploy a project for instance:</br> My deploy command was like this:
<target name="install-app">
<exec executable="${was.home}/bin/wsadmin.bat" logError="true" outputproperty="websphere.install.output" failonerror="true">
<arg line="-conntype ${ws.conn.type}" />
<arg line="-host ${ws.host.name}" />
<arg line="-port ${ws.port.name}" />
<arg line="-username ${ws.user.name}" />
<arg line="-password ${ws.password.name}" />
<arg line="-c"/>
<arg value="-MapResRefToEJB [[ DictionaryWeb "" BankServiceWeb.war,WEB-INF/web.xml jdbc/BankServiceDB javax.sql.DataSource jdbc/BankServiceDB "" "" "" ]]"/>
<arg line="-c" />
<arg value="-MapWebModToVH [[ DictionaryWeb BankServiceWeb.war,WEB-INF/web.xml default_host ]]]' )"/>
<arg line="-c" />
<arg value="${ws.install.command} ${build.ear.dir}/BankService.ear {-appname ${app.deployed.name} -server ${was.server.name} -contextroot ${app.contextroot.name}}" />
<arg line="-c" />
<arg value="${ws.save.command}" />
<arg line="-c" />
<arg value="${ws.setManager.command}" />
<arg line="-c" />
<arg value="${ws.startapp.command} ${app.deployed.name}" />
<arg line="-c" />
<arg value="${ws.save.command}" />
</exec>
<echo message="${websphere.install.output}" />
</target>

I think I know what you are thinking now.. this is over complicated. As for example ant will not accept """" in your value arg!
<arg value="-MapResRefToEJB [[ DictionaryWeb "" BankServiceWeb.war,WEB-INF/web.xml jdbc/BankServiceDB javax.sql.DataSource jdbc/BankServiceDB "" "" "" ]]"/>
So there is no way out, even if you use ant escape characters.
 
Deepak Pant
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is how I would suggest you organize your script:

1. Create path id which points to WebSphere libraries.


2. Create a variable in property file which contains all the application install options.


3. Create an ANT task which uses the previous two things for install app to WebSphere.
 
Mujahed Syed
Ranch Hand
Posts: 34
Mac IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Normal ant won't do that. You have to execute from bin dir of was_home
 
Deepak Pant
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See as I told you earlier, I use normal ant version 1.8.2 to compile, deploy and perform various functions in WebSphere 7.0.0.x. Before moving to WAS 7, I was using ant 7.x with WebSphere 6.x

If ws_ant works for you and you are happy with it then we don't need to carry this thread further.
 
Mujahed Syed
Ranch Hand
Posts: 34
Mac IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Just to share I use normal ant from Apache successfully with both WAS 6.1 and 7.0. I use it fairly extensively for start, stop, install, uninstall etc.


If you would had place a full stop and avoided that "etc" then yes I would have agreed with you deepak.
But yes thanks for sharing your thoughts.. To confirm NORMAL ANT is not profile aware, so you have to use ant provided by WAS 7.
Yes we can end this thread now.
Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic