Re: JMX context restart issue

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: JMX context restart issue

Stephen Stevens
Hi Greg.

Any chance you will be able to look at this one for 5.1.5?

Regards,

Stephen

Stephen Stevens <stephenstevens <at> yahoo.com.au> writes:

>
> Hi.
>
> I have a problem when restarting web applications with JMX. It seems like
> not everything is cleaned up properly after a stop.
>
> The easiest way to reproduce this behaviour is to follow these steps (I
used

> a clean copy of 5.1.4 that I downloaded today).
>
> 1/ Start the Jetty demo with JMX:
>
> java -Dmain.class=org.mortbay.xml.XmlConfiguration -jar start.jar
> etc/demo-jmx.xml
>
> 2/ Once it has started up, open demo/webapps/jetty/WEB-INF/web.xml in your
> favourite editor, and make the XML illegal in some way. (e.g. change
> <display-name> to </display-name>.)
>
> 3/ Go to the JMX Console at http://localhost:8082/ and click on the link
> for:
>
> org.mortbay:jetty=default,WebApplicationContext=1,context=/jetty
>
> 4/ Invoke the stop operation, and then click on "Return to Mbean view"
>
> 5/ Invoke the start operation.
>
> It will of course give an error, and throw an exception into the log as
you

> would expect.
>
> 6/ Now fix the problem in the web.xml, and try to stop/start again.
>
> This is the error you will see in the log:
>
> 16:00:40.421 WARN!! [Thread-56]
> org.mortbay.jetty.servlet.XMLConfiguration.initi
> alize(XMLConfiguration.java:217) >19> Configuration problem at <servlet>
>     <servlet-name>default</servlet-name>
>     <servlet-class>org.mortbay.jetty.servlet.Default</servlet-class>
>     <init-param>
>       <param-name>acceptRanges</param-name>
>       <param-value>true</param-value>
>     </init-param>
>     <init-param>
>       <param-name>dirAllowed</param-name>
>       <param-value>true</param-value>
>     </init-param>
>     <init-param>
>       <param-name>putAllowed</param-name>
>       <param-value>false</param-value>
>     </init-param>
>     <init-param>
>       <param-name>delAllowed</param-name>
>       <param-value>false</param-value>
>     </init-param>
>     <init-param>
>       <param-name>redirectWelcome</param-name>
>       <param-value>false</param-value>
>     </init-param>
>     <init-param>
>       <param-name>minGzipLength</param-name>
>       <param-value>8192</param-value>
>     </init-param>
>     <load-on-startup>0</load-on-startup>
>   </servlet>
> java.lang.IllegalArgumentException: Named servlet already exists: default
>         at
> org.mortbay.jetty.servlet.ServletHandler.newServletHolder(ServletHand
> ler.java:268)
>         at
> org.mortbay.jetty.servlet.XMLConfiguration.initServlet(XMLConfigurati
> on.java:370)
>         at
> org.mortbay.jetty.servlet.XMLConfiguration.initWebXmlElement(XMLConfi
> guration.java:241)
>         at
> org.mortbay.jetty.servlet.XMLConfiguration.initialize(XMLConfiguratio
> n.java:209)
>         at
> org.mortbay.jetty.servlet.XMLConfiguration.configureDefaults(XMLConfi
> guration.java:160)
>         at
> org.mortbay.jetty.servlet.WebApplicationContext.configureDefaults(Web
> ApplicationContext.java:414)
>         at
> org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicatio
> nContext.java:463)
>         at org.mortbay.util.Container.start(Container.java:72)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.mortbay.util.jmx.ModelMBeanImpl.invoke(ModelMBeanImpl.java:780)
>         at
> mx4j.server.interceptor.InvokerMBeanServerInterceptor.invoke(InvokerM
> BeanServerInterceptor.java:221)
>         at
> mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultM
> BeanServerInterceptor.java:120)
>         at
> mx4j.server.interceptor.SecurityMBeanServerInterceptor.invoke(Securit
> yMBeanServerInterceptor.java:84)
>         at
> mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultM
> BeanServerInterceptor.java:120)
>         at
> mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultM
> BeanServerInterceptor.java:120)
>         at
> mx4j.server.interceptor.ContextClassLoaderMBeanServerInterceptor.invo
> ke(ContextClassLoaderMBeanServerInterceptor.java:203)
>         at mx4j.server.MX4JMBeanServer.invoke(MX4JMBeanServer.java:1043)
>         at
> mx4j.tools.adaptor.http.InvokeOperationCommandProcessor.executeReques
> t(InvokeOperationCommandProcessor.java:164)
>         at
> mx4j.tools.adaptor.http.HttpAdaptor$HttpClient.run(HttpAdaptor.java:9
> 80)
>
> 16:00:40.421 WARN!! [Thread-56]
> org.mortbay.jetty.servlet.WebApplicationContext.
> doStart(WebApplicationContext.java:521) >16> Configuration error on
> C:\Java\jett
> y/demo/webapps/jetty
> javax.servlet.UnavailableException: Configuration problem
>         at
> org.mortbay.jetty.servlet.XMLConfiguration.initialize(XMLConfiguratio
> n.java:218)
>         at
> org.mortbay.jetty.servlet.XMLConfiguration.configureDefaults(XMLConfi
> guration.java:160)
>         at
> org.mortbay.jetty.servlet.WebApplicationContext.configureDefaults(Web
> ApplicationContext.java:414)
>         at
> org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicatio
> nContext.java:463)
>         at org.mortbay.util.Container.start(Container.java:72)
> ....
>
> So, the default servlet already exists in a "stopped" web application? And
> now you cannot restart that web application without restarting the entire
> server.
>
> You can see a similar problem by the absence of an error. Restart the
server
> and follow the same steps, except that instead of breaking the web.xml,
> remove one of the classes referenced in the web.xml before restarting the
> web application (e.g. delete
> demo/webapps/jetty/WEB-INF/classes/DemoFilter.class). Not only do you NOT
> get an error about the missing class on restart, but everything continues
to
> work. But restart the server and it fails as you would expect.
>
> I have also seen cases where I have replaced a jar (which displays its
> version number in the log on startup) and after the restart, it shows the
> version number of the jar I have just replaced, not the new one I have
> loaded.
>
> At the moment I am using 5.1.2 on our production servers, and I was hoping
> that these problems were fixed in 5.1.4, but I don't think they are. At
the
> moment, I am having to take all contexts off the air by a server restart,
> when what I really want to do is upgrade one and just stop and start it
> without affecting any of our other customers.
>
> I hope I have given you enough information. Any help would be appreciated.
>
> BTW, I would really, *REALLY* appreciate a one-step restart operation....
I
> think it as simple as adding this method to org.mortbay.http.HttpContext:
>
>     /** Restart the context.
>      *  <at> param graceful If true and statistics are on, then this
method will

> wait
>      * for requestsActive to go to zero before calling stop()
>      */
>     public void restart(boolean graceful)
>         throws Exception
>     {
>         stop(graceful);
>         start();
>     }
>
> And adding this call to
> org.mortbay.http.jmx.HttpContextMBean.defineManagedResource():
>
>     defineOperation("restart",new
> String[]{"java.lang.Boolean.TYPE"},IMPACT_ACTION);
>
> Thanks.
>
> Stephen
>
> Send instant messages to your online friends http://au.messenger.yahoo.com

>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Jetty-support mailing list
> Jetty-support <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
>



Send instant messages to your online friends http://au.messenger.yahoo.com 



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support