Thanks Vincent,

I moved to cactus 1.2 and the easy solution to my problem was to run tomcat
on another port for tests.

But, I gave your suggestion a try w/1.1 (make sure the URL is a valid URL)
and got the following results:

BTW, I have been running tomcat as an NT service ... and using JDK1.3.1_01

1) ant tests_all returns successfully if I stop the Tomcat NT service
first, with the following output (I ommitted the successful tests):

Buildfile: build.xml

init:
     [echo] --------- Cactus Sample 1.1 ---------
     [echo]
     [echo] java.class.path = E:\DevTools\jdk1.3.1_01\lib\tools.jar;E:
\DevTools\jakarta-ant-1.4\lib\junit.jar;E:
\DevTools\jakarta-ant-1.4\lib\jaxp.jar;E:
\DevTools\jakarta-ant-1.4\lib\jakarta-ant-1.4-optional.jar;E:
\DevTools\jakarta-ant-1.4\lib\crimson.jar;E:
\DevTools\jakarta-ant-1.4\lib\ant.jar;
     [echo]
     [echo] java.home = E:\DevTools\jdk1.3.1_01\jre
     [echo] user.home = C:\Documents and Settings\Administrator
     [echo]
     [echo] basedir = E:\DevTools\commons-cactus-23-1.1\sample
     [echo]
     [echo] servlet.jar = E:/Apache Tomcat 4.0/common/lib/servlet.jar
     [echo] cactus.jar = ../lib/commons-cactus.jar
     [echo] junit.jar = E:/DevTools/jakarta-ant-1.4/lib/junit.jar
     [echo] cactus.ant.jar = ../lib/commons-cactus-ant.jar

prepare:

prepare-compile:

compile:

testwar:

check_tests_resin_20:
     [echo]
     [echo] *********************************************************
     [echo] WARNING : The 'resin.home.20' property has not been set.
     [echo]           No test will be run on that servlet engine.
     [echo] *********************************************************
     [echo]

prepare_tests_resin_20:

tests_resin_20:

check_tests_resin_13:
     [echo]
     [echo] *********************************************************
     [echo] WARNING : The 'resin.home.13' property has not been set.
     [echo]           No test will be run on that servlet engine.
     [echo] *********************************************************
     [echo]

prepare_tests_resin_13:

tests_resin_13:

check_tests_tomcat_40:

prepare_tests_tomcat_40:
     [echo] tomcat.home.40 = E:/Apache Tomcat 4.0
   [delete] Deleting: E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\conf\server.xml
   [delete] Deleting directory E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\webapps\test
     [copy] Copying 1 file to E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\conf

tests_tomcat_40:

start_tomcat_40:
     [java] HttpConnector Opening server socket on all host IP addresses
     [java] Starting service Tomcat-Standalone
     [java] Apache Tomcat/4.0
     [java] StandardHost[localhost]: Installing web application at context
path /test from URL jar:file:E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\webapps\test.war!/
     [java] WebappLoader[/test]: Deploying class repositories to work
directory E:\Apache Tomcat 4.0\work\localhost\test
     [java] WebappLoader[/test]: Deploy JAR /WEB-INF/lib/cactus-23.jar to
E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\webapps\test\WEB-INF\lib\cactus-23.jar
     [java] WebappLoader[/test]: Deploy JAR /WEB-INF/lib/junit.jar to E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\webapps\test\WEB-INF\lib\junit.jar
     [java] WebappLoader[/test]: Deploy JAR /WEB-INF/lib/log4j.jar to E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\webapps\test\WEB-INF\lib\log4j.jar
     [java] StandardManager[/test]: Seeding random number generator class
java.security.SecureRandom
     [java] StandardManager[/test]: Seeding of random number generator has
been completed
     [java] StandardWrapper[/test:default]: Loading container servlet
default
     [java] StandardWrapper[/test:invoker]: Loading container servlet
invoker
     [java] StandardWrapper[/test:jsp]: Using Jasper classloader for
servlet jsp
     [java] HttpConnector[8080] Starting background thread

tests:
    ...

stop_tomcat_40:
     [java] Stopping service Tomcat-Standalone
     [java] HttpConnector[8080] Stopping background thread
     [java] StandardHost[localhost]: Removing web application at context
path /test
[runservertests] Server stopped !

check_tests_orion_14:
     [echo]
     [echo] *********************************************************
     [echo] WARNING : The 'orion.home.14' property has not been set.
     [echo]           No test will be run on that servlet engine.
     [echo] *********************************************************
     [echo]

prepare_tests_orion_14:

tests_orion_14:

tests_all:

BUILD SUCCESSFUL

Total time: 21 seconds

****************************************************
****************************************************

2) If I have the Tomcat service running, I get the following:

Buildfile: build.xml

init:
     [echo] --------- Cactus Sample 1.1 ---------
     [echo]
     [echo] java.class.path = E:\DevTools\jdk1.3.1_01\lib\tools.jar;E:
\DevTools\jakarta-ant-1.4\lib\junit.jar;E:
\DevTools\jakarta-ant-1.4\lib\jaxp.jar;E:
\DevTools\jakarta-ant-1.4\lib\jakarta-ant-1.4-optional.jar;E:
\DevTools\jakarta-ant-1.4\lib\crimson.jar;E:
\DevTools\jakarta-ant-1.4\lib\ant.jar;
     [echo]
     [echo] java.home = E:\DevTools\jdk1.3.1_01\jre
     [echo] user.home = C:\Documents and Settings\Administrator
     [echo]
     [echo] basedir = E:\DevTools\commons-cactus-23-1.1\sample
     [echo]
     [echo] servlet.jar = E:/Apache Tomcat 4.0/common/lib/servlet.jar
     [echo] cactus.jar = ../lib/commons-cactus.jar
     [echo] junit.jar = E:/DevTools/jakarta-ant-1.4/lib/junit.jar
     [echo] cactus.ant.jar = ../lib/commons-cactus-ant.jar

prepare:

prepare-compile:

compile:

testwar:

check_tests_resin_20:
     [echo]
     [echo] *********************************************************
     [echo] WARNING : The 'resin.home.20' property has not been set.
     [echo]           No test will be run on that servlet engine.
     [echo] *********************************************************
     [echo]

prepare_tests_resin_20:

tests_resin_20:

check_tests_resin_13:
     [echo]
     [echo] *********************************************************
     [echo] WARNING : The 'resin.home.13' property has not been set.
     [echo]           No test will be run on that servlet engine.
     [echo] *********************************************************
     [echo]

prepare_tests_resin_13:

tests_resin_13:

check_tests_tomcat_40:

prepare_tests_tomcat_40:
     [echo] tomcat.home.40 = E:/Apache Tomcat 4.0
   [delete] Deleting: E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\conf\server.xml
   [delete] Deleting directory E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\webapps\test
     [copy] Copying 1 file to E:
\DevTools\commons-cactus-23-1.1\sample\out\test\tomcat40\conf

tests_tomcat_40:

start_tomcat_40:
     [java] HttpConnector Opening server socket on all host IP addresses
     [java] Catalina.start: LifecycleException:  null.open:
java.net.BindException: Address in use: JVM_Bind
     [java] LifecycleException:  null.open:  java.net.BindException:
Address in use: JVM_Bind
     [java]    at
org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.java:1116)
     [java]    at
org.apache.catalina.core.StandardService.initialize(StandardService.java:454)
     [java]    at
org.apache.catalina.core.StandardServer.initialize(StandardServer.java:552)
     [java]    at
org.apache.catalina.startup.Catalina.start(Catalina.java:775)
     [java]    at
org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
     [java]    at
org.apache.catalina.startup.Catalina.process(Catalina.java:179)
     [java]    at java.lang.reflect.Method.invoke(Native Method)
     [java]    at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:218)
     [java] ----- Root Cause -----
     [java] java.net.BindException: Address in use: JVM_Bind
     [java]    at java.net.PlainSocketImpl.socketBind(Native Method)
     [java]    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:405)
     [java]    at java.net.ServerSocket.<init>(ServerSocket.java:170)
     [java]    at java.net.ServerSocket.<init>(ServerSocket.java:121)
     [java]    at
org.apache.catalina.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:118)
     [java]    at
org.apache.catalina.connector.http.HttpConnector.open(HttpConnector.java:946)
     [java]    at
org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.java:1114)
     [java]    at
org.apache.catalina.core.StandardService.initialize(StandardService.java:454)
     [java]    at
org.apache.catalina.core.StandardServer.initialize(StandardServer.java:552)
     [java]    at
org.apache.catalina.startup.Catalina.start(Catalina.java:775)
     [java]    at
org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
     [java]    at
org.apache.catalina.startup.Catalina.process(Catalina.java:179)
     [java]    at java.lang.reflect.Method.invoke(Native Method)
     [java]    at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:218)


3) And at this point I have to stop the process.  I also tried a different
URL (http://localhost:8080/index.html)
and got ...

tests:
    [junit] Running
org.apache.commons.cactus.sample.unit.TestServletTestCase_TestResult
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.25 sec
    [junit] Testsuite:
org.apache.commons.cactus.sample.unit.TestServletTestCase_TestResult
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.25 sec
    [junit]
    [junit] Testcase: testLongProcess took 0.25 sec
    [junit]    Caused an ERROR
    [junit] http://localhost:8080/test/ServletRedirector
    [junit] java.io.FileNotFoundException:
http://localhost:8080/test/ServletRedirector
    [junit]    at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:562)
    [junit]    at
org.apache.commons.cactus.client.AutoReadHttpURLConnection.getInputStream(AutoReadHttpURLConnection.java:119)
    [junit]    at
org.apache.commons.cactus.client.ServletHttpClient.doTest(ServletHttpClient.java:113)
    [junit]    at
org.apache.commons.cactus.ServletTestCase.runGenericTest(ServletTestCase.java:158)
    [junit]    at
org.apache.commons.cactus.ServletTestCase.runTest(ServletTestCase.java:128)
    [junit]    at
org.apache.commons.cactus.AbstractTestCase.runBare(AbstractTestCase.java:281)
    [junit]    at junit.framework.TestResult$1.protect(TestResult.java:106)
    [junit]    at
junit.framework.TestResult.runProtected(TestResult.java:124)
    [junit]    at junit.framework.TestResult.run(TestResult.java:109)
    [junit]    at junit.framework.TestCase.run(TestCase.java:131)
    [junit]    at junit.framework.TestSuite.runTest(TestSuite.java:173)
    [junit]    at junit.framework.TestSuite.run(TestSuite.java:168)
    [junit]    at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:231)
    [junit]    at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:409)
    [junit]

stop_tomcat_40:
     [java] Catalina.stop: java.net.ConnectException: Connection refused:
connect
     [java] java.net.ConnectException: Connection refused: connect
     [java]    at java.net.PlainSocketImpl.socketConnect(Native Method)
     [java]    at
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:320)
     [java]    at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:133)
     [java]    at
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
     [java]    at java.net.Socket.<init>(Socket.java:273)
     [java]    at java.net.Socket.<init>(Socket.java:100)
     [java]    at
org.apache.catalina.startup.Catalina.stop(Catalina.java:826)
     [java]    at
org.apache.catalina.startup.Catalina.execute(Catalina.java:683)
     [java]    at
org.apache.catalina.startup.Catalina.process(Catalina.java:179)
     [java]    at java.lang.reflect.Method.invoke(Native Method)
     [java]    at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:218)
     [java] Java Result: 1


Has anyone else had this problem w/1.1?

Thanks,
Malcolm





                                                                                       
                          
                    "Vincent                                                           
                          
                    Massol"              To:     <[EMAIL PROTECTED]>      
                          
                    <vmassol@octo.       cc:                                           
                          
                    com>                 Subject:     Re: Question regarding ant 
runservertests task             
                                                                                       
                          
                    09/24/01 10:51                                                     
                          
                    AM                                                                 
                          
                    Please respond                                                     
                          
                    to cactus-user                                                     
                          
                                                                                       
                          
                                                                                       
                          




Hi Malcom,

Can you ensure that the testURL attribute of the runservertests tasks
points
to a valid URL, i.e. verify that when Tomcat 4.x is started, calling this
URL returns a valid page ? This is the mechanism used by this task to
verify
if the server is running. I'll try it myself.

Thanks
-Vincent

----- Original Message -----
From: "Malcolm Alexander" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 24, 2001 3:38 PM
Subject: Question regarding ant runservertests task


>
> In the cactus sample, the "tests_tomcat_40" ant script starts the server
> and stops the server after the unit tests are completed, in the custom
task
> "runservertests".  The documentation mentions that if the server is
> started, it will stay up, and if it is not, it will be started and shut
> down.  Here is the output I get if I have Tomcat 4.0 started:
>
> ...
>
> start_tomcat_40:
>      [java] HttpConnector Opening server socket on all host IP addresses
>      [java] Catalina.start: LifecycleException:  null.open:
> java.net.BindException: Address in use: JVM_Bind
>      [java] LifecycleException:  null.open:  java.net.BindException:
> Address in use: JVM_Bind
>      [java]     at
>
org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.ja

va:1116)
>      [java]     at
>
org.apache.catalina.core.StandardService.initialize(StandardService.java:454

)
>      [java]     at
>
org.apache.catalina.core.StandardServer.initialize(StandardServer.java:552)
>      [java]     at
> org.apache.catalina.startup.Catalina.start(Catalina.java:775)
>      [java]     at
> org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
>      [java]     at
> org.apache.catalina.startup.Catalina.process(Catalina.java:179)
>      [java]     at java.lang.reflect.Method.invoke(Native Method)
>      [java]     at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:218)
>      [java] ----- Root Cause -----
>      [java] java.net.BindException: Address in use: JVM_Bind
>      [java]     at java.net.PlainSocketImpl.socketBind(Native Method)
>      [java]     at
java.net.PlainSocketImpl.bind(PlainSocketImpl.java:405)
>      [java]     at java.net.ServerSocket.<init>(ServerSocket.java:170)
>      [java]     at java.net.ServerSocket.<init>(ServerSocket.java:121)
>      [java]     at
>
org.apache.catalina.net.DefaultServerSocketFactory.createSocket(DefaultServe

rSocketFactory.java:118)
>      [java]     at
>
org.apache.catalina.connector.http.HttpConnector.open(HttpConnector.java:946

)
>      [java]     at
>
org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.ja

va:1114)
>      [java]     at
>
org.apache.catalina.core.StandardService.initialize(StandardService.java:454

)
>      [java]     at
>
org.apache.catalina.core.StandardServer.initialize(StandardServer.java:552)
>      [java]     at
> org.apache.catalina.startup.Catalina.start(Catalina.java:775)
>      [java]     at
> org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
>      [java]     at
> org.apache.catalina.startup.Catalina.process(Catalina.java:179)
>      [java]     at java.lang.reflect.Method.invoke(Native Method)
>      [java]     at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:218)
>
>
> Is there a problem with my setup?
> Tomcat 4.0, Cactus 1.1, Ant 1.4
>
> Thanks,
> malcolm
>
>






Reply via email to