Learning how to improve your development process by adding monitoring with JavaMelody

105 views
Skip to first unread message

Angélica Sanz U.

unread,
Oct 17, 2016, 5:24:48 AM10/17/16
to javamelody
Hi! Here's a blog post about how to improve your development process by adding monitoring with JavaMelody that be of help for you: https://www.magnolia-cms.com/blogs/lars-fischer/detail~@import@improve-your-development-process-by-adding-monitoring-with-javamelody~.html

This post goes over the needs of monitoring projects, how to set up this monitoring with JavaMelody step by step, including info on advanced configurations, and additional resources.

Hope you find this post helpful!

-Angélica

Andrea Rossi

unread,
Aug 12, 2022, 12:42:19 PM8/12/22
to javamelody
I have some trouble to configure Javamelody for magnolia cms, so link give me 404 not found.
It's possible at now have some information about it?

Emeric Vernat

unread,
Aug 12, 2022, 12:46:18 PM8/12/22
to javam...@googlegroups.com
--

---
You received this message because you are subscribed to the Google Groups "javamelody" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javamelody+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javamelody/40d1921a-761d-4d81-9990-f484e5367557n%40googlegroups.com.

Andrea Rossi

unread,
Aug 31, 2022, 5:10:20 PM8/31/22
to javamelody
I have some trouble for apply 
Modify web.xml

 <filter>
    <filter-name>javamelody</filter-name>
    <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>javamelody</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <listener>
    <listener-class>net.bull.javamelody.SessionListener</listener-class>
  </listener>

  <filter>
    <display-name>Magnolia global filters</display-name>
    <filter-name>magnoliaFilterChain</filter-name>
    <filter-class>info.magnolia.cms.filters.MgnlMainFilter</filter-class>
    <init-param>
      <param-name>authorized-users</param-name>
      <param-value>superuser:superuser</param-value>
    </init-param>
    <init-param>
      <param-name>monitoring-path</param-name>
      <param-value>C:/dev/repo_git/flos/flos-project/javamelody</param-value>
    </init-param>
    <init-param>
      <param-name>storage-directory</param-name>
      <param-value>C:/dev/repo_git/flos/flos-project/temp/javamelody</param-value>
    </init-param>
    </filter>

I must add magnolia-core library because NoClass errors appare for info.magnolia.cms.filters.MgnlMainFilter class, but after that 
SEVERE: Exception starting filter [magnoliaFilterChain]
java.lang.IllegalStateException: No ComponentProvider has been set yet, something must have gone terribly wrong at startup.

You have some ideas?

evernat

unread,
Aug 31, 2022, 5:57:35 PM8/31/22
to javamelody
Hello Andrea,

You probably don't have the same Magnolia version as blog's article.
And it seems that your javamelody configuration in web.xml is mixed with a info.magnolia.cms.filters.MgnlMainFilter which was supposed to be already in web.xml.

I suggest to add in your web.xml something like the following, without adding a magnolia filter :

 <filter>
    <filter-name>javamelody</filter-name>
    <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
    <init-param>
      <param-name>authorized-users</param-name>
      <param-value>superuser:superuser</param-value>
    </init-param>
    <init-param>
      <param-name>monitoring-path</param-name>
      <param-value>/monitoring</param-value>

    </init-param>
    <init-param>
      <param-name>storage-directory</param-name>
      <param-value>C:/dev/repo_git/flos/flos-project/temp/javamelody</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>javamelody</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <listener>
    <listener-class>net.bull.javamelody.SessionListener</listener-class>
  </listener>

Then the monitoring page will be available at .../monitoring in your webapp, accorging to the monitoring-path parameter.
I recommend to never use a password which is the same as the username, even in development, because a simple password is sometimes put in production without changing it. It's better to use a randonly generated password instead.

bye,
Emeric


Andrea Rossi

unread,
Sep 2, 2022, 6:16:17 AM9/2/22
to javamelody
Hi thanks, 
now I can see on /monitoring so HTTP statistic works
But I have none hits on JDBC connection and SQL connection, but apparently, the database is correctly setup, in fact Database : Queries summary for 24h shows list effectly queries runned.
Web application uses hibernate library.

DataBase:
java:/comp/env/jdbc/flosAuthor:
jdbc:mysql://localhost:3306/flospimauthor
MySQL, 5.7.37-log
Driver JDBC: MySQL-AB JDBC Driver, mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )

Opened JDBC connections: None
Statistics SQL - 1 day since midnight: None
How is it possible?

evernat

unread,
Sep 2, 2022, 6:59:39 AM9/2/22
to javamelody
Hi Andrea,

According to that javamelody info, you have configured a dataSource in JNDI according to:
https://docs.magnolia-cms.com/product-docs/6.2/Administration/Architecture/Repositories/Repositories-configuration.html#_jndi
Great !

It may be similar to this one from the same author mentionned in our previous messages:

Now I think that you still need to use that dataSource from JNDI in your Magnolia configuration.
For that, see the page above by the same author.

In short, according to him, you need to change your repository configuration in Magnolia to declare your datasource like this:
<Repository>
<DataSources>
  <DataSource name="magnolia">
    <param name="driver" value="javax.naming.InitialContext"/>
<!-- note that you have declared java:/comp/env/jdbc/flosAuthor in JNDI instead of java:comp/env/jdbc/MagnoliaAuthor -->
<!-- so adapt this line -->
    <param name="url" value="java:comp/env/jdbc/MagnoliaAuthor"/>
    <param name="databaseType" value="mysql"/>
  </DataSource>
</DataSources>
...

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