wood burning stoves 2.0*
The moose likes Websphere and the fly likes ant websphere wsstartserver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "ant websphere wsstartserver" Watch "ant websphere wsstartserver" New topic
Author

ant websphere wsstartserver

Mujahed Syed
Ranch Hand

Joined: May 18, 2010
Posts: 32

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>


SCJP, OCWCD
Mujahed Syed
Ranch Hand

Joined: May 18, 2010
Posts: 32

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
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
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

Joined: May 18, 2010
Posts: 32

How did you do that? do you have example build.xml that you can share please.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
This is how I start the WAS Server.

Mujahed Syed
Ranch Hand

Joined: May 18, 2010
Posts: 32

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

Joined: Feb 13, 2004
Posts: 443
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

Joined: May 18, 2010
Posts: 32

Hey Normal ant won't do that. You have to execute from bin dir of was_home
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
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

Joined: May 18, 2010
Posts: 32

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
 
 
subject: ant websphere wsstartserver
 
Similar Threads
ear task issue
Deploy EJB in Ant
Validate JSP
some way to resolve this with ant or other tool
wsStartServer ANT task