You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rainer Jung <ra...@kippdata.de> on 2011/07/31 19:57:13 UTC

Strange problem in TC7 manager

Reproduction:

- add manager-jmx and manager-status to tomcat-users.xml
- Start TC 7 trunk
- As first request call http://localhost:8080/manager/jmxproxy
  Response OK
- As second request call http://localhost:8080/manager/manager/all
  Response Exception:

javax.servlet.ServletException: java.lang.NullPointerException
	org.apache.catalina.manager.StatusManagerServlet.doGet(StatusManagerServlet.java:305)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)

root cause

java.lang.NullPointerException
	org.apache.catalina.manager.StatusTransformer.writeDetailedState(StatusTransformer.java:553)
	org.apache.catalina.manager.StatusManagerServlet.doGet(StatusManagerServlet.java:300)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)

In fact mBeanServer in StatusManagerServlet is null.

If you call /manager/status/all first, then it'll be OK, even after
jmxproxy. Adding some debug log shows, that init() in
StatusManagerServlet, which sets MBeanServer is called for another
instance, than the actual call to doGet(), which stills has MBeanServer
set to null.

Any idea what's happening here?

Regards,

Rainer


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Strange problem in TC7 manager

Posted by Rainer Jung <ra...@kippdata.de>.
On 31.07.2011 20:45, Mark Thomas wrote:
> On 31/07/2011 19:29, Mark Thomas wrote:
>> On 31/07/2011 18:57, Rainer Jung wrote:
>>> Any idea what's happening here?
>>
>> Not yet, although it is probably my fault :)
>>
>> I can reproduce this, looking in more detail now...
> 
> The problem is that calling isSingleThreadModel (triggered by reading
> the JMX attributes) triggers creation of an instance that is then thrown
> away but the instanceInitialized flag is set. When the first request is
> received a new instance is created but not initialized.
> 
> I#ll see if I can come up with a patch. I cam also see a couple of other
> ways this could go wrong. I'll try and fix those too.

Thank's for investigating, interesting explanation.

Unfortunately it is not completely unlikely, that a jmxproxy dump is
done early after startup. e.g. as part of monitoring or availability check.

Found it while testing tcnative ...

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Strange problem in TC7 manager

Posted by Mark Thomas <ma...@apache.org>.
On 31/07/2011 19:29, Mark Thomas wrote:
> On 31/07/2011 18:57, Rainer Jung wrote:
>> Any idea what's happening here?
> 
> Not yet, although it is probably my fault :)
> 
> I can reproduce this, looking in more detail now...

The problem is that calling isSingleThreadModel (triggered by reading
the JMX attributes) triggers creation of an instance that is then thrown
away but the instanceInitialized flag is set. When the first request is
received a new instance is created but not initialized.

I#ll see if I can come up with a patch. I cam also see a couple of other
ways this could go wrong. I'll try and fix those too.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Strange problem in TC7 manager

Posted by Mark Thomas <ma...@apache.org>.
On 31/07/2011 18:57, Rainer Jung wrote:
> Reproduction:
> 
> - add manager-jmx and manager-status to tomcat-users.xml
> - Start TC 7 trunk
> - As first request call http://localhost:8080/manager/jmxproxy
>   Response OK
> - As second request call http://localhost:8080/manager/manager/all
>   Response Exception:
> 
> javax.servlet.ServletException: java.lang.NullPointerException
> 	org.apache.catalina.manager.StatusManagerServlet.doGet(StatusManagerServlet.java:305)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> 	org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
> 
> root cause
> 
> java.lang.NullPointerException
> 	org.apache.catalina.manager.StatusTransformer.writeDetailedState(StatusTransformer.java:553)
> 	org.apache.catalina.manager.StatusManagerServlet.doGet(StatusManagerServlet.java:300)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> 	org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
> 
> In fact mBeanServer in StatusManagerServlet is null.
> 
> If you call /manager/status/all first, then it'll be OK, even after
> jmxproxy. Adding some debug log shows, that init() in
> StatusManagerServlet, which sets MBeanServer is called for another
> instance, than the actual call to doGet(), which stills has MBeanServer
> set to null.
> 
> Any idea what's happening here?

Not yet, although it is probably my fault :)

I can reproduce this, looking in more detail now...

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org