JavaMelody with Tomcat 7

66 views
Skip to first unread message

Kevin Ge

unread,
Apr 7, 2021, 6:10:00 AM4/7/21
to javamelody
Hi I have followed instructions here UserGuide · javamelody/javamelody Wiki (github.com). I have put the javamelody.jar and jrobin-1.5.9.jar in the WEB-INF\lib\. And I have added this section in the WEB-INF\web.xml.
<filter> <filter-name>javamelody</filter-name> <filter-class>net.bull.javamelody.MonitoringFilter</filter-class> <async-supported>true</async-supported> </filter> <filter-mapping> <filter-name>javamelody</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>ASYNC</dispatcher> </filter-mapping> <listener> <listener-class>net.bull.javamelody.SessionListener</listener-class> </listener>

When I tried http://<host>/<context>/monitoring, it gave me this error. I don't understand the meaning of it. Looks like hazelcast is interfering with the monitoring. Has anyone had the same issue here?

Thanks


Stack trace:
java.lang.IllegalStateException: Unable to connect to any address! The following addresses were tried: [[127.0.0.1]:5703, [127.0.0.1]:5702, [127.0.0.1]:5701]
    at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.connectToClusterInternal(ClientConnectionManagerImpl.java:869)
    at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.access$1200(ClientConnectionManagerImpl.java:109)
    at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$2.call(ClientConnectionManagerImpl.java:879)
    at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$2.call(ClientConnectionManagerImpl.java:875)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:64)
    at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:80)
[wrapped] javax.cache.CacheException: Error opening URI [hazelcast]
    at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:130)
    at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:159)
    at com.hazelcast.cache.HazelcastCachingProvider.getCacheManager(HazelcastCachingProvider.java:174)
    at net.bull.javamelody.internal.model.JCacheInformations.buildJCacheInformationsList(JCacheInformations.java:95)
    at net.bull.javamelody.internal.model.JavaInformations.<init>(JavaInformations.java:204)
    at net.bull.javamelody.internal.web.MonitoringController.doActionIfNeededAndReport(MonitoringController.java:158)
    at net.bull.javamelody.MonitoringFilter.doMonitoring(MonitoringFilter.java:408)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:206)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at com.sustain.security.ApiTokenWebFilter.doFilter(ApiTokenWebFilter.java:57)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at com.hazelcast.web.HzWebFilter.doFilter(HzWebFilter.java:37)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

evernat

unread,
Apr 7, 2021, 8:34:57 AM4/7/21
to javamelody
Hi Kevin,

javamelody autodiscovers caches using the JCache (JSR107) api. And it seems that your caches are misconfigured in Hazelcast.

bye,
Emeric

Kevin Ge

unread,
Apr 8, 2021, 1:01:43 PM4/8/21
to javamelody
Hi Emeric,
Thank you so much for the quick reply. For JavaMelody to work, what needs to be done to configure the caches correctly in Hazelcast?
Appreciate your time!

Kevin

evernat

unread,
Apr 8, 2021, 8:06:48 PM4/8/21
to javamelody
Hi Kevin,

When JCache classes are included in your webapp, the java call to getCacheManager() on each provider in javax.cache.Caching.getCachingProviders() needs to work for javamelody. And an exception was thrown when calling that as you have said with a stack-trace.
I do not know exactly why Hazelcast did not work in your case, neither what you do with Hazelcast, but the issue to fix is related to the exception:

java.lang.IllegalStateException: Unable to connect to any address! The following addresses were tried: [[127.0.0.1]:5703, [127.0.0.1]:5702, [127.0.0.1]:5701]
    at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.connectToClusterInternal(ClientConnectionManagerImpl.java:869)
    at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.access$1200(ClientConnectionManagerImpl.java:109)
    at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$2.call(ClientConnectionManagerImpl.java:879)
    at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$2.call(ClientConnectionManagerImpl.java:875)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    [...]

    at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:64)
    at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:80)
[wrapped] javax.cache.CacheException: Error opening URI [hazelcast]
    at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:130)
    at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:159)
    at com.hazelcast.cache.HazelcastCachingProvider.getCacheManager(HazelcastCachingProvider.java:174)

You may look at Hazelcast documentation if it helps:

bye,
Emeric
Reply all
Reply to author
Forward
0 new messages