The following issue has been updated:

    Updater: Vincent Massol (mailto:[EMAIL PROTECTED])
       Date: Sat, 17 Apr 2004 8:15 AM
    Changes:
             assignee changed from Cactus Developers Mailing List to Vincent Massol
             description changed from If an exception occurs while starting a jetty 
context, the setup will throw an exception and 
teardown won't be called even though jetty is still running.  Subsequent jetty tests 
will fail 
because jetty is still running and can't be started again. 
 
Here's an example stack trace: 
 
java.lang.RuntimeException: ConnectionPoolManager already configured 
        at 
com.aex.common.manager.ConnectionPoolManager.configure(ConnectionPoolManager.java:234) 
        at 
com.aex.common.servlet.InitializeListener.contextInitialized(InitializeListener.java:67)
 
        at 
org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:439) 
        at org.mortbay.http.HttpServer.start(HttpServer.java:663) 
        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.cactus.extension.jetty.JettyTestSetup.setUp(JettyTestSetup.java:169) 
        at junit.extensions.TestSetup$1.protect(TestSetup.java:18) 
        at junit.framework.TestResult.runProtected(TestResult.java:124) 
        at junit.extensions.TestSetup.run(TestSetup.java:23) 
        at junit.framework.TestSuite.runTest(TestSuite.java:208) 
        at junit.framework.TestSuite.run(TestSuite.java:203) 
        at junit.framework.TestSuite.runTest(TestSuite.java:208) 
        at junit.framework.TestSuite.run(TestSuite.java:203) 
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
 
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276) 
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167) 
 
The Exception is caught in the try block around TestSetup.java:18.  Jetty is running 
at this point 
but teardown is never called to stop it even though the test is over. 
 
I'd suggest replacing the startup line in 
org.apache.cactus.extension.jetty.JettyTestSetup with 
something like: 
 
       // Start the Jetty server 
        try { 
                        server.getClass().getMethod("start", null).invoke(server, 
null); 
        } catch (Throwable ex) { 
                        try { 
                                boolean started = ((Boolean) 
server.getClass().getMethod("isStarted", 
null).invoke(server, null)).booleanValue(); 
                                if (started) { 
                                        server.getClass().getMethod("stop", 
null).invoke(server, null); 
                                } 
                        } finally { 
                                if (ex instanceof Exception) { 
                                        throw (Exception)ex; 
                                } else { 
                                        throw (Error)ex; 
                                } 
                        } 
        } to If an exception occurs while starting a jetty context, the setup will 
throw an exception and 
teardown won't be called even though jetty is still running.  Subsequent jetty tests 
will fail 
because jetty is still running and can't be started again. 
 
Here's an example stack trace: 
 
java.lang.RuntimeException: ConnectionPoolManager already configured 
        at 
com.aex.common.manager.ConnectionPoolManager.configure(ConnectionPoolManager.java:234) 
        at 
com.aex.common.servlet.InitializeListener.contextInitialized(InitializeListener.java:67)
 
        at 
org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:439) 
        at org.mortbay.http.HttpServer.start(HttpServer.java:663) 
        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.cactus.extension.jetty.JettyTestSetup.setUp(JettyTestSetup.java:169) 
        at junit.extensions.TestSetup$1.protect(TestSetup.java:18) 
        at junit.framework.TestResult.runProtected(TestResult.java:124) 
        at junit.extensions.TestSetup.run(TestSetup.java:23) 
        at junit.framework.TestSuite.runTest(TestSuite.java:208) 
        at junit.framework.TestSuite.run(TestSuite.java:203) 
        at junit.framework.TestSuite.runTest(TestSuite.java:208) 
        at junit.framework.TestSuite.run(TestSuite.java:203) 
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
 
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276) 
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167) 
 
The Exception is caught in the try block around TestSetup.java:18.  Jetty is running 
at this point 
but teardown is never called to stop it even though the test is over. 
 
I'd suggest replacing the startup line in 
org.apache.cactus.extension.jetty.JettyTestSetup with 
something like: 
 
       // Start the Jetty server 
        try { 
                        server.getClass().getMethod("start", null).invoke(server, 
null); 
        } catch (Throwable ex) { 
                        try { 
                                boolean started = ((Boolean) 
server.getClass().getMethod("isStarted", 
null).invoke(server, null)).booleanValue(); 
                                if (started) { 
                                        server.getClass().getMethod("stop", 
null).invoke(server, null); 
                                } 
                        } finally { 
                                if (ex instanceof Exception) { 
                                        throw (Exception)ex; 
                                } else { 
                                        throw (Error)ex; 
                                } 
                        } 
        }
             environment changed from Operating System: Other
Platform: Other to Operating System: Other
Platform: Other
             priority changed to Blocker
             Fix Version changed to 1.6
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/CACTUS-63?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/CACTUS-63

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: CACTUS-63
    Summary: Failure to start jetty prevents subsequent jetty tests from running
       Type: Bug

     Status: Resolved
   Priority: Blocker
 Resolution: FIXED

    Project: Cactus
 Components: 
             Framework
   Fix Fors:
             1.6
   Versions:
             1.5-beta1

   Assignee: Vincent Massol
   Reporter: James Stangler

    Created: Thu, 23 Oct 2003 5:39 PM
    Updated: Sat, 17 Apr 2004 8:15 AM
Environment: Operating System: Other
Platform: Other

Description:
If an exception occurs while starting a jetty context, the setup will throw an 
exception and 
teardown won't be called even though jetty is still running.  Subsequent jetty tests 
will fail 
because jetty is still running and can't be started again. 
 
Here's an example stack trace: 
 
java.lang.RuntimeException: ConnectionPoolManager already configured 
        at 
com.aex.common.manager.ConnectionPoolManager.configure(ConnectionPoolManager.java:234) 
        at 
com.aex.common.servlet.InitializeListener.contextInitialized(InitializeListener.java:67)
 
        at 
org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:439) 
        at org.mortbay.http.HttpServer.start(HttpServer.java:663) 
        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.cactus.extension.jetty.JettyTestSetup.setUp(JettyTestSetup.java:169) 
        at junit.extensions.TestSetup$1.protect(TestSetup.java:18) 
        at junit.framework.TestResult.runProtected(TestResult.java:124) 
        at junit.extensions.TestSetup.run(TestSetup.java:23) 
        at junit.framework.TestSuite.runTest(TestSuite.java:208) 
        at junit.framework.TestSuite.run(TestSuite.java:203) 
        at junit.framework.TestSuite.runTest(TestSuite.java:208) 
        at junit.framework.TestSuite.run(TestSuite.java:203) 
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
 
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276) 
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167) 
 
The Exception is caught in the try block around TestSetup.java:18.  Jetty is running 
at this point 
but teardown is never called to stop it even though the test is over. 
 
I'd suggest replacing the startup line in 
org.apache.cactus.extension.jetty.JettyTestSetup with 
something like: 
 
       // Start the Jetty server 
        try { 
                        server.getClass().getMethod("start", null).invoke(server, 
null); 
        } catch (Throwable ex) { 
                        try { 
                                boolean started = ((Boolean) 
server.getClass().getMethod("isStarted", 
null).invoke(server, null)).booleanValue(); 
                                if (started) { 
                                        server.getClass().getMethod("stop", 
null).invoke(server, null); 
                                } 
                        } finally { 
                                if (ex instanceof Exception) { 
                                        throw (Exception)ex; 
                                } else { 
                                        throw (Error)ex; 
                                } 
                        } 
        }


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to