I'm following spring tutorial . In that it control tomcat with ant tasks. Earlier I face few problems because of tomcat 7 manager app is different from previous versions. But I was able to fix them. Now ant listtask is working fine. But others are not. For an example ant starttask returns this error.
start-webapp:
BUILD FAILED
C:\Users\rsenarath\workspace\myspringapp\build.xml:108: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/text/start?path=%2Fmyspringapp
But when I copy the url(http://localhost:8080/manager/text/start?path=%2Fmyspringapp) on the browser it asks for username password and it replies as without a problem as follows.
OK - Started application at context path /myspringapp
Can some one help me with this. My build.properties is as below
appserver.name=tomcat
appserver.home=C:/Users/rsenarath/apache-tomcat-7.0.34
appserver.lib=${appserver.home}/lib
appserver.bin=${appserver.home}/bin
deploy.path=${appserver.home}/webapps
tomcat.manager.url=http://localhost:8080/manager/text
tomcat.manager.username=tomcat
tomcat.manager.password=s3cret
and ans tasks are as below
<path id="catalina-ant-classpath">
<fileset dir="${appserver.lib}">
<include name="catalina-ant.jar"/>
<include name="tomcat-coyote.jar"/>
<include name="tomcat-util.jar"/>
</fileset>
<fileset dir="${appserver.home}/bin">
<include name="tomcat-juli.jar"/>
</fileset>
</path>
<taskdef name="catalina-deploy" classname="org.apache.catalina.ant.DeployTask" classpathref="catalina-ant-classpath"/>
<taskdef name="catalina-list" classname="org.apache.catalina.ant.ListTask" classpathref="catalina-ant-classpath"/>
<taskdef name="catalina-reload" classname="org.apache.catalina.ant.ReloadTask" classpathref="catalina-ant-classpath"/>
<taskdef name="catalina-resources" classname="org.apache.catalina.ant.ResourcesTask" classpathref="catalina-ant-classpath"/>
<taskdef name="catalina-start" classname="org.apache.catalina.ant.StartTask" classpathref="catalina-ant-classpath"/>
<taskdef name="catalina-stop" classname="org.apache.catalina.ant.StopTask" classpathref="catalina-ant-classpath"/>
<taskdef name="catalina-undeploy" classname="org.apache.catalina.ant.UndeployTask" classpathref="catalina-ant-classpath"/>
<target name = "stop-webapp">
<catalina-stop url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="/${name}"
failonerror="false"/>
</target>
<target name = "start-webapp">
<catalina-start url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="/${name}"/>
</target>
<target name="list-webapp" description="List Tomcat applications">
<catalina-list url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"/>
</target>
In your start-webapp and stop-webapp targets you use these variables for user/pass:
tomcat.username
tomcat.password
But in your config data you set these:
tomcat.manager.username
tomcat.manager.password
The username and password are therefore probably not set when you run the start-webapp target, hence the 401. Perhaps you could update the variable names in the start and stop targets to match the config.
Related
I have two files test-200-12-30-2990 and test-project-200-12-30-2990 I am unziping it to corresponding folders. Second task is not working. I want to select the file 'test-200-12-30-2990'
Below is the ant build.xml. I am using maven ant plugin inside pom
<mkdir dir="/testdir"/>
<unzip dest="src/main/resources/testdir">
<fileset dir="src/main/resources">
<include name="**/test-project*.zip"/>
</fileset>
</unzip>
</target>
<mkdir dir="/test-projectdir"/>
<unzip dest="src/main/resources/test-projectdir">
<fileset dir="src/main/resources">
<include name="**/test[1-9].zip"/>
</fileset>
</unzip>
</target>
I'm not quite sure how inclusion might work in Maven, but maybe we could solve this problem with a simple expression that you already have, something maybe similar to:
test-[0-9-]+
Then, the include might look like:
test-[0-9-]+\.zip
**/test-[0-9-]+\.zip
If escaping . might be unnecessary, then we can just use:
**/test-[0-9-]+.zip
DEMO
Reference
Include xml files in maven project
I am looking for the weblogic.wsee.tools.anttasks.WsdlcTask for gradle. All I could find so far was an example for Ant.
Importing the ant script with ant.importBuild "wsdlc_build.xml" works perfectly fine in my gradle build script, but I would prefer writing the task in gradle. Has someone already found a solution for this?
My ant script:
<project name="WebServices" basedir=".">
<property name="build.wls.home" value="C:\User\wls\"/>
<path id="weblogic.tools.path">
<fileset dir="${build.wls.home}/wlserver/server/lib">
<include name="weblogic.jar" />
</fileset>
</path>
<taskdef name="wsdlc" classname="weblogic.wsee.tools.anttasks.WsdlcTask" classpathref="weblogic.tools.path"/>
<target name="build_opera">
<wsdlc failOnError="true"
srcWsdl="WebContent/WEB-INF/wsdls/OperaService.wsdl"
destImplDir="src"
destJwsDir="WebContent/WEB-INF/lib"
packageName="server.opera.webservice.service"
verbose="on" debug="on"
type="JAXWS">
</wsdlc>
</target>
<target name="build_nez">
<wsdlc
failOnError="true"
srcWsdl="WebContent/WEB-INF/wsdls/NezService.wsdl"
destImplDir="src"
destJwsDir="WebContent/WEB-INF/lib"
packageName="server.nez.webservice.service"
srcPortName="NezSoapPort"
type="JAXWS">
</wsdlc>
</target>
<target name="build_nezp">
<wsdlc
failOnError="true"
srcWsdl="WebContent/WEB-INF/wsdls/NezpService.wsdl"
destImplDir="src"
destJwsDir="WebContent/WEB-INF/lib"
packageName="server.nezp.webservice.service"
srcPortName="NezPSoapPort"
type="JAXWS">
</wsdlc>
</target>
i am trying to do the spring tutorials from the spring website. one of the tutorials include bulding an ant build file which when i build I keep getting this error
BUILD FAILED
build.xml:146: You must not specify nested elements when using refid
When i click on the error it seems to be pointing at this location
<target name="tests" depends="build,buildtests" description="Run tests">
<junit printsummary="on"
fork="false"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<classpath refid="master-classpath"/>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset refid="master-classpath">
<include name="**/*Tests.*"/>
</fileset>
</batchtest>
</junit>
<fail if="tests.failed">
tests.failed=${tests.failed}
***********************************************************
***********************************************************
**** One or more tests failed! Check the output ... ****
***********************************************************
***********************************************************
</fail>
</target>
any clues why this error is generated?
I figured out the solution.
<batchtest>
<fileset dir="master-classpath">
<include name="**/*Tests.*"/>
</fileset>
</batchtest>
I originally used refid="master-classpath", which is wrong.
Hi All,
I am trying to run wsInstallApp task to deploy my war file into
websphere.
I am getting the error "Unable to parse setupCmdLine:
null\bin\setupCmdLine.bat (The system cannot find the path specified.)"
<property name="ear.file" value="../archive/DocProcessing.war" />
There is no attribute for war
Here is the code SNIPPET:
<target name="init">
<path id="lib.ref">
<fileset dir="${env.classpath.WAS_HOME}\lib">
<include name="*.*jar" />
</fileset>
<fileset dir="${env.classpath.WAS_HOME}\bin">
<include name="*.*bat" />
</fileset>
<fileset dir="${env.classpath.WAS_HOME}\plugins">
<include name="*.*jar" />
</fileset>
<fileset dir="${env.classpath.WAS_HOME}\java\lib">
<include name="*.*jar" />
</fileset>
<fileset dir="${env.classpath.WAS_HOME}\deploytool\itp\plugins">
<include name="*.*jar" />
</fileset>
<fileset dir="${env.classpath.WAS_HOME}">
<include name="*.*jar" />
</fileset>
</path>
<taskdef name="wsStartServer" classpathref="lib.ref"
classname="com.ibm.websphere.ant.tasks.StartServer" />
<taskdef name="wsInstallApp" classpathref="lib.ref"
classname="com.ibm.websphere.ant.tasks.InstallApplication" />
</target>
<target name="StartServer" depends="init">
<exec dir="${env.classpath.WAS_HOME}\bin" executable="cmd">
<arg line="/c startServer.bat server1 -profileName AppSrv01" />
</exec>
</target>
<target name="installEar" depends="StartServer">
<echo message="EAR File located: ${ear.file}" />
<wsInstallApp ear="${ear.file}" wasHome="${env.classpath.WAS_HOME}"
conntype="${remoteConnType}" host="${remoteHostName}" user="${remoteUserId}"
password="${remotePassword}" />
</target>
properties set are:
<property name="remoteHostName" value="localhost" />
<property name="remoteConnType" value="SOAP" />
<property name="remotePort" value="8880" />
<property name="remoteUserId" value="wasadmin" />
<property name="remotePassword" value="wasadmin" />
path set for wasHome ="C:\Program Files\IBM\WebSphere\AppServer"
I could
not findout what is wrong in this .Though i am new to websphere i am
trying to find out the solution to install application and start
application using ant script .Please kindly provide me the solution to
get it set right .
Thanx in advance
You have to set 'user.install.root' property, here is an example:
<property name="user.install.root" value="${env.classpath.WAS_HOME}/profiles/was60profile1" />
Yes, we needed to add the following:
<property name="user.install.root" value="${was.path}/profiles/AppSrv01" />
where was.path would be the location where your was application is installed.
I had this error today. And found the answer!!!
Add profileName="[name of the profile]", in my case profileName="wp_profile", And it works!
This process most probably runs ws_ant.bat which in turn calls setupcmdline to initialise all the variables. In my installation the line is like this:
#echo off
#setlocal
call "%~dp0setupCmdLine.bat" %*
Could it be something to do with your server/RAD configuration being invalid, or the project not having a default server assigned to it?
What happens when you run it outside of RAD through the command line, does it still fail in the same way?
More information from IBM Support here:
http://www-01.ibm.com/support/docview.wss?rs=180&uid=swg1PK23265
is it possible to make nant run a publish on mvc project or a good old web application project
and after the publish make nant FTP the files to the web server
UPDATE: found the solution to the ftp problem
Nant ftp task thanks Paco
what i mean by publich
is there a command line application or nant task that can public like visual studio publish...
The visual studio publish command rebuilds your solution and then copies the files in the solution directory to a new directory. I use the following target to do almost the same:
<target name="copyToPublish">
<delete dir="${dir.publish}" />
<mkdir dir="${dir.publish}" />
<mkdir dir="${dir.publish}\wwwroot"/>
<copy todir="${dir.publish}\wwwroot" includeemptydirs="false">
<fileset basedir="${website.dir}">
<exclude name="**/*.cs"/>
<exclude name="**/*.pdb"/>
<exclude name="**/*.csproj*"/>
<exclude name="**/obj/**"/>
<include name="**/*.*"/>
</fileset>
</copy>
<mkdir dir="${dir.publish}\database"/>
<copy todir="${dir.publish}\database" includeemptydirs="false">
<fileset basedir="${dir.databasescripts}">
<include name="**/*.sql" />
</fileset>
</copy>
<xmlpoke
file="${dir.publish}\wwwroot\Web.config"
xpath="/configuration/system.web/compilation/#debug"
value="false" />
<xmlpoke
file="${dir.publish}\wwwroot\Web.config"
xpath="/configuration/system.web/trace/#enabled"
value="false" />
<move file="${dir.publish}\wwwroot\Web.config" tofile="${dir.publish}\wwwroot\Release.config" overwrite="true" />
<delete file="${dir.publish}\wwwroot\Web.config" />
</target>
Before this target you have to run the normal build procedure of course.
There is a Ftp Task for nant.
Beside that, you have to create a script that copies the files and directories you need and the config files. I don't do it automatically, because I want to have control over database update scripts and changes in web.config.