Home Ask Login Register

Developers Planet

Your answer is one click away!

Psychose February 2016

Java - Orika 1.4.5 - OutOfMemoryException : PermGen Space

I have a problem with Orika 1.4.5 and PermGen Space.

Indeed, i'm using a a ConfigurableMapper this way :

 public class SoapSearchPrdvFreeSlotsMapper extends ConfigurableMapper {
public void configure(MapperFactory mapperFactory) {
    mapperFactory.registerClassMap(mapperFactory.classMap(PrdvFreeSlot.class, PrdvWsListerDispoTelV2Filter.class)
                .field("typeRdv", "wsldtTypeRdv")
                .field("motifId", "wsldtMotifId")
    mapperFactory.registerClassMap(mapperFactory.classMap(PrdvFreeSlot.class, PrdvWsListerDispoTelV2.class)
                .field("typeRdv", "wsldtTypeRdv")
                .field("motifId", "wsldtMotifId")
                .field("quantum", "wsldtActiviteIdActivQuantum")
                .field("activiteJours", "wsldtActiviteIdActivJours")
                .field("activiteHeureFerme", "wsldtActiviteIdActivHeureFerme")
                .field("activiteHeureOuvert", "wsldtActiviteIdActivHeureOuvert")
                .field("startDate", "disDate")
                .field("disCapacity", "disCapacite")
                .field("disReserve", "disReserve")
                .field("reserveCC", "wsldtReserveCC")

public void configureFactoryBuilder(DefaultMapperFactory.Builder builder) {
    builder.build().getConverterFactory().registerConverter(new DateXmlDateConverter());


But each time i call this mapper, i have autogenerated class mappers which are stored in the PermGen.

I try to use the "existsRegisteredMapper" of the MapperFactory to prevent class mappers auto-generation but it doesn't work:

public static <T, U> boolean existsRegisteredMapperInFactory(MapperFactory mapperFactory, Class<T> classSrc, Class<U> classDest) {
    return mapperFactory.existsRegisteredMapper(TypeFactory.valueOf(classSrc), TypeFactory.valueOf(clas        


Sidi Mohamed February 2016

Please make sure that the mapper is a singleton. You don't need to instantiate it everytime.

You don't need to verify if the the mapper has been registered or not. It will be generated only once (per MapperFactory instance).

So just make sure that SoapSearchPrdvFreeSlotsMapper is a singleton (only one instance, ConfigurableMapper is thread-safe)

Post Status

Asked in February 2016
Viewed 2,781 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life