ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kees van Dieren <kees.vandie...@mp-objects.com>
Subject Re: Using Ant to start tomcat and run cactus tests
Date Wed, 11 May 2005 07:08:59 GMT
You can fix this as following:
Create a batch file start-test.bat in the ant script project dir, with 
content with looks as  the following:
cd /java/tomcat-5.x/bin
run.bat

In ant, you can call this batch-fileas the following:
        <exec executable=" start-test.bat" os="Windows 2000, Windows XP">
            <arg line=" add arguments (optional)" />
        </exec>
if it also needs to work for linux, it can be done as following:
        <exec executable="./start-test.sh" os="Linux">
            <arg line=" add arguments (optional)" />
        </exec>

Hope that helps.

Regards,
Kees
Bryan Mishkin wrote:

>Hmmm...
>
>I revised the target per your advice:
>
><java dir="${tomcat.home}" classname="org.apache.catalina.startup.Bootstrap"
>fork="yes">
>                <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
>                <jvmarg value="-Dcatalina.base=${tomcat.home}/webapps"/>
>                <arg value="start"/>
>                <classpath>
>                  <fileset dir="${tomcat.home}">
>                      <include name="bin/bootstrap.jar"/>
>                  </fileset>
>                </classpath>
>        </java>
>
>And 
>
><java dir="${tomcat.home}/bin"
>classname="org.apache.catalina.startup.Bootstrap" fork="yes">
>                <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
>                <jvmarg value="-Dcatalina.base=${tomcat.home}/webapps"/>
>                <arg value="start"/>
>                <classpath>
>                  <fileset dir="${tomcat.home}">
>                      <include name="bin/bootstrap.jar"/>
>                  </fileset>
>                </classpath>
>        </java>
>
>I still get the same error :(  I'm guessing you are correct but I'm not sure
>how to fix the problem.  I also tried this:
>
><java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
>                <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
>                <jvmarg value="-Dcatalina.base=${tomcat.home}/webapps"/>
>                <arg value="start"/>
>                <classpath>
>                  <fileset dir="${tomcat.home}">
>                      <include name="bin/bootstrap.jar"/>
>                  </fileset>
>                    <fileset dir="${tomcat.home}">
>                      <include name="conf/server.xml"/>
>                  </fileset>
>                </classpath>
></java>
>
>But that didn't work either :(  I'd appreciate any other ideas
>
>
>Bryan 
> 
>
>-----Original Message-----
>From: Kees van Dieren [mailto:kees.vandieren@mp-objects.com] 
>Sent: Tuesday, May 10, 2005 9:56 AM
>To: 'Ant Users List'
>Subject: RE: Using Ant to start tomcat and run cactus tests
>
>Hi,
>
>I expect this to be current-working-dir issue. 
>
>When creating new java.io.File objects, it uses the current working
>directory as prefix. I think when you start tomcat with ant, the current
>working dir is that of the ant-script, and so it can't find the server.xml. 
>
>Maybe it helps when you set the dir attribute of the java task, to the dir
>where the tomcat startup batch scripts are located?
>
>Kind regards,
>
>Kees van Dieren
>Senior Software Engineer
>
>MP Objects Software for E-logistics
>Stationsplein 45
>3013 AK Rotterdam
>The Netherlands
>
>Post address:
>Postbus 29126
>3001 GC Rotterdam
>
>Mobile: +31 (0)6-43068619
>Phone: +31 (0)10-2900304
>Fax: +31 (0)10-2900305
>
>-----Original Message-----
>From: Bryan Mishkin [mailto:bmishkin@hoovers.com] 
>Sent: Tuesday, May 10, 2005 4:32 PM
>To: 'Ant Users List'
>Subject: Using Ant to start tomcat and run cactus tests
>
>Has anyone gotten this to work?  I am fairly skilled with ant and tried
>various solutions from the web and the cactus website.  Currently I am
>utilizing the following to attempt to start tomcat:
>
><runservertests
> 
>testurl="${cactus.contextURL}-test/${cactus.servletRedirectorName}?Cactus_Se
>rvice=RUN_TEST"
>                starttarget="tomcat-start"
>                stoptarget="tomcat-stop"
>                testtarget="execute-cactus-tests"/>
>
><target name="tomcat-start">
>         <!-- Start Tomcat -->
>        <java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
>                <jvmarg value="-Dcatalina.home=${tomcat.home}"/>
>                <jvmarg value="-Dcatalina.base=${tomcat.home}/webapps"/>
>                <arg value="start"/>
>                <classpath>
>                  <fileset dir="${tomcat.home}">
>                      <include name="bin/bootstrap.jar"/>
>                  </fileset>
>                </classpath>
>        </java>
>
>    </target>
>
>The message ANT returns is 'Can't Load Server.xml'
>
>Can't load server.xml
>Can't load server.xml
>May 10, 2005 9:27:35 AM org.apache.catalina.startup.Catalina start
>INFO: Server startup in 0 ms
>java.lang.reflect.InvocationTargetException
>	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>	at
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>)
>	at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>.java:25)
>	at java.lang.reflect.Method.invoke(Method.java:324)
>	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
>	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
>Caused by: java.lang.NullPointerException
>	at org.apache.catalina.startup.Catalina.await(Catalina.java:619)
>	at org.apache.catalina.startup.Catalina.start(Catalina.java:579)
>	... 6 more
>
>Ideas would be appreciated or tips on getting cactus tests integrated into a
>build
>
>Thanks
>
>Bryan 
> 
> 
>-----Original Message-----
>From: Daniele Gianni [mailto:daniele_gianni2003@yahoo.it] 
>Sent: Thursday, May 05, 2005 3:48 AM
>To: Ant Users List
>Subject: Re: Installing Ant under Windows XP
>
>Dear Conor,
>
>thanks for your suggestions. This is what I gets executing ant.bat 
>having commented out the first line (@echo off), unfortunately this is 
>still not obvious for me so if you have an further suggestions I will 
>appreciate it very much.
>
>The message "unexpected software" is shown after the command: if not "" 
>== "" goto runAntWithJikes. At any rate, I have copied all the text below.
>
>Daniele
>
>
>
>C:\Documents and Settings>REM  Copyright 2001,2004 The Apache Software 
>Foundation
>
>C:\Documents and Settings>REM
>
>C:\Documents and Settings>REM  Licensed under the Apache License, 
>Version 2.0 (the "License");
>
>C:\Documents and Settings>REM  you may not use this file except in 
>compliance with the License.
>
>C:\Documents and Settings>REM  You may obtain a copy of the License at
>
>C:\Documents and Settings>REM
>
>C:\Documents and Settings>REM      
>http://www.apache.org/licenses/LICENSE-2.0
>
>C:\Documents and Settings>REM
>
>C:\Documents and Settings>REM  Unless required by applicable law or 
>agreed to in writing, software
>
>C:\Documents and Settings>REM  distributed under the License is 
>distributed on an "AS IS" BASIS,
>
>C:\Documents and Settings>REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY 
>KIND, either express or implied.
>
>C:\Documents and Settings>REM  See the License for the specific language 
>governing permissions and
>
>C:\Documents and Settings>REM  limitations under the License.
>
>C:\Documents and Settings>if exist "\antrc_pre.bat" call "\antrc_pre.bat"
>
>C:\Documents and Settings>if "Windows_NT" == "Windows_NT"
>
>C:\Documents and Settings>rem C:\Programmi\apache-ant-1.6.2\bin\ is 
>expanded pathname of the current
>
>script under NT
>
>C:\Documents and Settings>set 
>DEFAULT_ANT_HOME=C:\Programmi\apache-ant-1.6.2\bin\..
>
>C:\Documents and Settings>if "C:\Programmi\apache-ant-1.6.2" == "" set
>
>ANT_HOME=C:\Programmi\apache-ant-1.6.2\bin\..
>
>C:\Documents and Settings>set DEFAULT_ANT_HOME=
>
>C:\Documents and Settings>rem Slurp the command line arguments. This 
>loop allows for an unlimited number
>
>C:\Documents and Settings>rem of arguments (up to the command line 
>limit, anyway).
>
>C:\Documents and Settings>set ANT_CMD_LINE_ARGS=
>
>C:\Documents and Settings>if """" == """" goto doneStart
>
>C:\Documents and Settings>rem find ANT_HOME if it does not exist due to 
>either an invalid value passed
>
>C:\Documents and Settings>rem by the user or the ant problem on Windows 9x
>
>C:\Documents and Settings>if exist 
>"C:\Programmi\apache-ant-1.6.2\lib\ant.jar" goto checkJava
>
>C:\Documents and Settings>set _JAVACMD=
>
>C:\Documents and Settings>if "C:\j2sdk1.4.2_05" == "" goto noJavaHome
>
>C:\Documents and Settings>if not exist "C:\j2sdk1.4.2_05\bin\java.exe" 
>goto noJavaHome
>
>C:\Documents and Settings>if "" == "" set 
>_JAVACMD=C:\j2sdk1.4.2_05\bin\java.exe
>
>C:\Documents and Settings>goto checkJikes
>
>C:\Documents and Settings>if not "" == "" goto runAntWithJikes
>Unexpected Software
>C:\Documents and Settings>if not 
>"C:\Programmi\Pitch\prti1516\lib\prti1516.jar;
>
>F:\gianni\progetti\temp;"C:\Programmi\Apache Software Foundation\Tomcat
>
>5.0\webapps\ROOT\webbasedsim\WEB-INF""=="" goto runAntWithClasspath
>
>
>
>Conor MacNeill wrote:
>
>  
>
>>I doubt building from source will solve your problems.
>>
>>To solve these sorts of problems, one thing you should try is to 
>>comment out the first line of ant.bat (the "@echo off" line). You can 
>>then see what the ant batch file is doing and where it is failing.
>>
>>Try that. If it is not obvious from that, try copying the output and 
>>sending it to the list.
>>
>>Also another thing to check is whether you have a CLASSPATH 
>>environment variable and whether it has any quotes in it. If it has, 
>>remove them.
>>
>>Conor
>>
>>Daniele Gianni wrote:
>>
>>    
>>
>>>Thanks to everyone for your efforts but it still seems not to work.
>>>I may try building it from source, do you think I can work around 
>>>these problems building it from source?
>>>
>>>Thanks again,
>>>
>>>Daniele
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message