lanxy88 / javamelody

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

heaphisto report failed -- unsatisfied link error with multiple webapps in tomcat 7 #398

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. deploy two webapps (with javamelody.jar in WEB-INF/lib or javamelody.jar in 
tomcat lib) in a tomcat7 instance
2. on each webapp do http://<host>:<port>/<app>/monitoring?part=heaphisto
3. see exception in the log

What is the expected output? What do you see instead?
For the first webapp. It is ok and always able to show the heap histogram.
For the second webapp. The front end show a pop up message request using the 
JDK. Then the "View memory histogram"  button disappear.
It is sure the tomcat startup with JDK.
And there is exception log.

the below show the exception log from windows. And it is also encounter in 
redhat.

java.lang.UnsatisfiedLinkError: Native Library C:\Program 
Files\Java\jdk1.6.0_35\jre\bin\attach.dll already loaded in another classloader
2014-03-31 10:28:02.977 WARN  [] [127.0.0.1] net.bull.javamelody - heaphisto 
report failed
java.lang.IllegalStateException: Memory histogram not supported because the 
server uses the JRE and not the JDK.
Check that a JDK is installed and check the environment variable JAVA_HOME or 
the launch file.
        at net.bull.javamelody.VirtualMachine.heapHisto(VirtualMachine.java:164) ~[javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.VirtualMachine.createHeapHistogram(VirtualMachine.java:175) ~[javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.HtmlController.doHeapHisto(HtmlController.java:222) [javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.HtmlController.doHtmlPartForSystemActions(HtmlController.java:152) [javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.HtmlController.doHtmlPart(HtmlController.java:140) [javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.HtmlController.doHtml(HtmlController.java:105) [javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.MonitoringController.doCompressedHtml(MonitoringController.java:240) [javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.MonitoringController.doReportCore(MonitoringController.java:197) [javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.MonitoringController.doReport(MonitoringController.java:185) [javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.MonitoringController.doActionIfNeededAndReport(MonitoringController.java:143) [javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.MonitoringFilter.doMonitoring(MonitoringFilter.java:349) [javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:172) [javamelody-core-1.49.0.jar:na]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.42]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.42]
        at com.pccw.webppb.server.filter.RequestInfoLog.doFilter(RequestInfoLog.java:65) [RequestInfoLog.class:na]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.42]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.42]
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-3.2.2.RELEASE.jar:3.2.2.RELEASE]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.42]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.42]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) [catalina.jar:7.0.42]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) [catalina.jar:7.0.42]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [catalina.jar:7.0.42]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) [catalina.jar:7.0.42]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) [catalina.jar:7.0.42]
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) [catalina.jar:7.0.42]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.42]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) [catalina.jar:7.0.42]
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) [tomcat-coyote.jar:7.0.42]
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) [tomcat-coyote.jar:7.0.42]
        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852) [tomcat-coyote.jar:7.0.42]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_35]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_35]
        at java.lang.Thread.run(Thread.java:662) [na:1.6.0_35]
Caused by: com.sun.tools.attach.AttachNotSupportedException: no providers 
installed
        at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:190) ~[na:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_35]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_35]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_35]
        at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_35]
        at net.bull.javamelody.VirtualMachine.invoke(VirtualMachine.java:185) ~[javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.VirtualMachine.getJvmVirtualMachine(VirtualMachine.java:88) ~[javamelody-core-1.49.0.jar:na]
        at net.bull.javamelody.VirtualMachine.heapHisto(VirtualMachine.java:150) ~[javamelody-core-1.49.0.jar:na]
        ... 34 common frames omitted

What version of the product are you using? On what application server, JDK,
operating system?

a)
javamelody 1.49
Server version: Apache Tomcat/7.0.42
Server number:  7.0.42.0
OS Name:        Windows 7
OS Version:     Professional
Architecture:   Intel 32bit
JVM Version:    1.6.0_35
JVM Vendor:     Oracle

b)
javamelody 1.49
Server version: Apache Tomcat/7.0.47
Server number:  7.0.47.0
OS Name:        RedHat 
OS Version:     4.1.2-48
Architecture:   Intel 64bit
JVM Version:    1.7.0_25
JVM Vendor:     Oracle

Please provide any additional information below.
It is very similar to issue 273.

Original issue reported on code.google.com by hei1...@gmail.com on 31 Mar 2014 at 3:09

GoogleCodeExporter commented 9 years ago
This issue as nothing to do with usability as in web design, so removing the 
"usability" label.

Original comment by evernat@free.fr on 20 Apr 2014 at 12:21

GoogleCodeExporter commented 9 years ago
I dot not reproduce the issue in Tomcat 6 and 7, with JDK 6 and 7, on Windows 
with several webapps.
Can you give the values of your system properties, on Windows, just to check?

Original comment by evernat@free.fr on 27 Apr 2014 at 2:08

GoogleCodeExporter commented 9 years ago
any news?

Original comment by evernat@free.fr on 18 May 2014 at 9:16

GoogleCodeExporter commented 9 years ago
Sorry for late reply,

The windows machine config:
Windows 7 32 bits
CPU : Intel i3-2120
Ram : 4.00GB

And other properties is mentioned in the issue.

The issue appear when the tomcat has two web apps and run together.

Can you reproduce the issue in Linux?
The error is very similar to the issue 273 but native library path is just 
different and which point to my java home directory.

Thanks a lot

Original comment by hei1...@gmail.com on 19 May 2014 at 4:30

GoogleCodeExporter commented 9 years ago
I think that, for whatever reason, you run Tomcat like with a JRE (perhaps, a 
JRE inside a JDK).

And I have now fixed some case, of "UnsatisfiedLinkError: Native Library ... 
attach.dll already loaded in another classloader ... IllegalStateException: 
Memory histogram not supported because the server uses the JRE and not the 
JDK.".
It's fixed in trunk (revision 3829) and ready for the next release (1.52).

I suggest that you test the fix with a new build from trunk, which is available 
at:
https://javamelody.ci.cloudbees.com/job/javamelody%20ant/lastSuccessfulBuild/art
ifact/javamelody.jar

Original comment by evernat@free.fr on 6 Jul 2014 at 1:41

GoogleCodeExporter commented 9 years ago
The fix for this issue is finally reverted (commented out, revision 3870), 
pending later thinking, because the fix causes an issue in the openjpa dynamic 
enhancement agent when the openjpa agent is loaded by InstrumentationFactory 
after a call to heap histo.
So the issue is reopened.

Original comment by evernat@free.fr on 3 Aug 2014 at 10:36