#190 Memory Leak on reload in web container caused by JMX bean

Dozer v5.1

When dozer (5.0) is used in a web container (tomcat 6) the autoregistered JMX bean causes a memory leak on reload. While the JMX bean is still registered after application shutdown, there is a reference between the bean and the webapp classloader. This reference keeps the webapp classloader from being garbage collected. So with autoregistered JMX bean after a couple of redeployments of a WAR in tomcat, an out of memory error will be caused by this memory leak.
Simple workaround is to disable the JMX bean with the dozer config property.

I use dozer in a webapp with spring, configured, as mentioned in the docs, as spring singleton.
A solution to the problem without disabling the JMX bean could be the following:
- org.dozer.DozerBeanMapper could implement springs DisposableBean interface and clean up the bean at shutdown. To prevent any dependency to spring dozer could just have a shutdown / destroy method, that could be explicitly configured in spring as shutdown method with <... destroy-method=""/>.
- A finalizer to the central org.dozer.DozerBeanMapper to unregister the bean may be another, not so preferrable way to solve this.


  • dmitry (lv)

    dmitry (lv) - 2009-04-29

    Thank you for this report and detailed explanation. I will address it with high priority.
    I think DisposableBean for Spring integration makes sense.

  • dmitry (lv)

    dmitry (lv) - 2009-04-29
    • milestone: --> Dozer v5.1
    • assigned_to: nobody --> buzdin
  • dmitry (lv)

    dmitry (lv) - 2009-06-02

    Dozer has a special class for Spring integration called DozerBeanMapperFactoryBean.
    It does implement both DisposableBean and InitializingBean interfaces. Disposable behaviou releases all JMX resources. It can be done manually as well by using DozerBeanMapper.destroy() method.

  • dmitry (lv)

    dmitry (lv) - 2009-06-02
    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks