caitale / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

java.lang.ClassCastException: net.bull.javamelody.Counter cannot be cast to net.bull.javamelody.MBeanNode #416

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,
I have a javamelody collector with javamelody 1.50, tomcat 7.0.47.
It collects data from several tomcat apps with javamelody 1.50 jar.
For one application, when I clic on "MBeans" I have an error : 
"net.bull.javamelody.Counter cannot be cast to net.bull.javamelody.MBeanNode"

In the logs : 
16:15:39,352 WARN  [net.bull.javamelody] mbeans report failed
java.lang.ClassCastException: net.bull.javamelody.Counter cannot be cast to 
net.bull.javamelody.MBeanNode
        at net.bull.javamelody.HtmlMBeansReport.writeTree(HtmlMBeansReport.java:59)
        at net.bull.javamelody.HtmlReport.writeMBeans(HtmlReport.java:350)
        at net.bull.javamelody.HtmlController.doMBeans(HtmlController.java:303)
        at net.bull.javamelody.HtmlController.doHtmlPartForSystemActions(HtmlController.java:165)
        at net.bull.javamelody.HtmlController.doHtmlPart(HtmlController.java:139)
        at net.bull.javamelody.HtmlController.doHtml(HtmlController.java:104)
        at net.bull.javamelody.MonitoringController.doCompressedHtml(MonitoringController.java:252)
        at net.bull.javamelody.MonitoringController.doReportCore(MonitoringController.java:204)
        at net.bull.javamelody.MonitoringController.doReport(MonitoringController.java:192)
        at net.bull.javamelody.CollectorController.doPart(CollectorController.java:211)
        at net.bull.javamelody.CollectorController.doCompressedPart(CollectorController.java:187)
        at net.bull.javamelody.CollectorController.doReport(CollectorController.java:172)
        at net.bull.javamelody.CollectorController.doMonitoring(CollectorController.java:146)
        at net.bull.javamelody.CollectorServlet.doGet(CollectorServlet.java:98)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)

What version of the product are you using? Javamelody 1.50

On what application server, JDK, operating system?
tomcat 7.0.47.
JDK : jdk1.7.0_45/
Linux Centos 6.5 x86_64

Original issue reported on code.google.com by adrien.n...@gmail.com on 30 Jun 2014 at 2:19

GoogleCodeExporter commented 9 years ago
I made a mistake, the apps which have the problem is on a tomcat 6 server 
6.0.37. 

Original comment by adrien.n...@gmail.com on 30 Jun 2014 at 2:22

GoogleCodeExporter commented 9 years ago
When I connect directly on the apps by the url 
http://myserver:port/myapp/monitoring
It works, I can access to mbeans.

Original comment by adrien.n...@gmail.com on 30 Jun 2014 at 2:29

GoogleCodeExporter commented 9 years ago
It seems that the collector server can call the monitored apps over http. But 
when asking for mbeans, the "part=mbeans" http parameter does not get through, 
for some servers.

I suggest to log on Linux of the collector server, and then to execute the 
following commands to see if there is a difference between the responses (it 
should be):
wget http://myserver:port/myapp/monitoring?format=serialized
wget http://myserver:port/myapp/monitoring?format=serialized&part=mbeans

where myapp is one of the monitored app where it does not work.

By chance, you may have the xstream library in one of these monitored apps. In 
this case, execute the following commands instead to have human readable 
responses:
wget http://myserver:port/myapp/monitoring?format=json
wget http://myserver:port/myapp/monitoring?format=json&part=mbeans

Original comment by evernat@free.fr on 4 Jul 2014 at 1:04

GoogleCodeExporter commented 9 years ago
any news?

Original comment by evernat@free.fr on 19 Jul 2014 at 12:06

GoogleCodeExporter commented 9 years ago
Thanks for your response.
In fact the app was on tomcat 6, but we tried under tomcat 7, the problem still 
persist. We are investigating but it's holidays for many people :)

Original comment by adrien.n...@gmail.com on 21 Jul 2014 at 12:04

GoogleCodeExporter commented 9 years ago
any news?

Original comment by evernat@free.fr on 30 Aug 2014 at 5:07

GoogleCodeExporter commented 9 years ago
With this : 
wget http://myserver:port/myapp/monitoring?format=serialized
wget http://myserver:port/myapp/monitoring?format=serialized&part=mbeans
I don't have the same result.
It's in binary format, with "less" I can see some line of text.
With mbeans option I can see this line at the beging of the result : 
<AC><ED>^@^Esr^@^Sjava.util.ArrayListx<81><D2>^]<99><C7>a<9D>^C^@^AI^@^Dsizexp^@
^@^@^Lw^D^@^@^@^Lsr^@ESCnet.bull.javamelody.Counter]<CF>a<F3>
^\<87><D0>^B^@^MZ^@     
displayedZ^@^LerrorCounterJ^@^SestimatedMemorySizeI^@^PmaxRequestsCountL^@^Kappl
icationt^@^RLjava/lang/String;L^@^PchildCounterNameq^@~^@^CL^@^Ferrorst^@^VLjava
/util/LinkedList;L^@^HiconNameq^@~^@^CL^@^Dnameq^@~^@^CL^@^Hrequestst^@$Ljava/ut
il/concurrent/ConcurrentMap;L^@^]rootCurrentContextsByThreadIdq^@~^@^EL^@       
startDatet^@^PLjava/util/Date;L^@^KstorageNameq^@~^@^Cxp^A^@^@^@^@^@^@^@^@^@^@^@
'^Pt^@)/my_app-app_myservert^@^Csqlpt^@    
dbweb.pngt^@^Dhttpsr^@&java.util.concurrent.ConcurrentHashMapd<99><DE>^R<9D><87>
)=^C^@^CI^@^KsegmentMaskI
^@^LsegmentShift[^@^Hsegmentst^@1[Ljava/util/concurrent/ConcurrentHashMap$Segmen
t;xp^@^@^@^O^@^@^@^\ur^@1[Ljava.util.concurrent.ConcurrentHashMap$Segment;Rw?A2<
9B>9t^B^@^@xp^@^@^@^Psr^@.java.util.concurrent.ConcurrentHashMap$Segment^_6L<90>
X<93>)=^B^@^AF^@
loadFactorxr^@(java.util.concurrent.locks.ReentrantLockfU<A8>,,<C8>j<EB>^B^@^AL^
@^Dsynct^@/Ljava/util/concurrent/locks/ReentrantLock$Sync;xpsr^@4java.util.concu
rrent.locks.ReentrantLock$NonfairSynce<88>2<E7>S{<BF>^K^B^@^@xr^@-java.util.conc
urrent.l

With json I have an error 500.

Original comment by adrien.n...@gmail.com on 1 Sep 2014 at 7:56

GoogleCodeExporter commented 9 years ago
It confirms that the problem is on the monitored app and not in the collector 
server.
The monitored app does not give the good data for:
http://myserver:port/myapp/monitoring?format=serialized&part=mbeans
Because when using the mbeans parameter, the binary data is supposed to contain 
net.bull.javamelody.MBeanNode and not net.bull.javamelody.Counter like you have.

Can you check what is exactly the javamelody version in the monitored app?
It is displayed at the bottom of http://myserver:port/myapp/monitoring

And can you check that the following page with 2 parameters also contains the 
MBeans tree as html?
http://myserver:port/myapp/monitoring?format=html&part=mbeans

> With json I have an error 500.
OK, given this error 500, it seems that this monitored app does not include the 
xstream library.

Original comment by evernat@free.fr on 1 Sep 2014 at 11:25

GoogleCodeExporter commented 9 years ago
We use JavaMelody 1.50.0

Original comment by adrien.n...@gmail.com on 2 Sep 2014 at 9:09

GoogleCodeExporter commented 9 years ago
You say 1.50.0, but you do not say what is the version displayed at the bottom 
of http://myserver:port/myapp/monitoring
And no reponse for the second question.

No response for the questions above, so closing as invalid/incomplete.
I hope that you will find the problem and can fix it.

Original comment by evernat@free.fr on 16 Nov 2014 at 4:18