MappingException
Closed this issue · 1 comments
Hello,
it seems we getting same kind of symptoms described here: #252 , #248. We got multiple MapperFactories and Mappers so they are not singletones.
Sometimes really wired exceptions happens like:
ma.glasnost.orika.MappingException: exception while creating object factory for org.joda.time.chrono.ISOChronology at ma.glasnost.orika.impl.generator.ObjectFactoryGenerator.build(ObjectFactoryGenerator.java:104) at ma.glasnost.orika.impl.DefaultMapperFactory.lookupObjectFactory(DefaultMapperFactory.java:966) at ma.glasnost.orika.impl.MapperFacadeImpl.resolveMappingStrategy(MapperFacadeImpl.java:182) at ma.glasnost.orika.impl.DefaultBoundMapperFacade$BoundStrategyCache.getStrategy(DefaultBoundMapperFacade.java:259) at ma.glasnost.orika.impl.DefaultBoundMapperFacade.map(DefaultBoundMapperFacade.java:137) at ma.glasnost.orika.generated.DateTime_DateTime_ObjectFactory43244272000899444324688331862560$9984.create(DateTime_DateTime_ObjectFactory43244272000899444324688331862560$9984.java)
But we defined DateTime as pass through why the mapper is generated?
MapperFactory mapperFactory = new DefaultMapperFactory.Builder()
.build();
mapperFactory
.getConverterFactory()
.registerConverter(
new PassThroughConverter(
LocalDateTime.class, DateTime.class, DateTimeZone.class, ISOChronology.class));
return mapperFactory;
I checked the implementation of JavassistCompilerStrategy there are couple questions:
- why superClasses map is static
- why in registerClassLoader function synchronization is done on parameter
Those exception ofc happens only in production. i cant reproduce it locally even with high concurrent simulation. Any ideas what can go wrong?
we are currently using version 1.5.0.
Problem solved by instantiating all mappers in single threaded environment. I am strongly recommend to avoid dynamic mapper generation in high conccurent environment.