0 Replies Latest reply on Jul 31, 2017 5:38 AM by drwschneider

    Wildfly 10.1 Metaspace exceeded on redeploy of JPA application

    drwschneider

      I would be very grateful indeed for help on the following problem I am facing with undeployment/redeployment of a JPA/Hibernate application:

       

      When I redeploy an EAR using JPA on Wildfly 10.1 a couple of times the server runs out of metaspace,

      because the classes from the EAR are not garbage collected, so each redeployment adds another copy

      of the classes.

      From the heap dump taken after undeploying the EAR  it seems that a Hibernate class, org.hibernate.cfg.annotations.reflection.JPAMetadataProvider,

      which is loaded by a ModuleClassLoader different from the one loading the EAR,

      retains references to elements from the EAR, i.e. classes, methods and fields, being annotated with JPA annotations.

      These references seem to prevent the EAR classes from being garbage collected.

       

      Is there a way to remove those references or any other means of avoiding this problem?

      Thank you very much for your help.