DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24072>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24072

Failure to start jetty prevents subsequent jetty tests from running

           Summary: Failure to start jetty prevents subsequent jetty tests
                    from running
           Product: Cactus
           Version: 1.5-beta1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Framework
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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 unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to