Menu

Field mapping error

Help
2010-11-08
2013-05-02
  • Andre Mayer

    Andre Mayer - 2010-11-08

    Why Am I getting this error when mapping a UUID field?
    I dont know if dozer is not initializing this UUID, I read the documentation and there says that dozer tries to instantiate the default constructor…..

    2546  ERROR org.dozer.MappingProcessor - Field mapping error ->
      MapId: null
      Type: null
      Source parent class: com.ls.soa.stack.soaservices.service.contract.soap.v2.search.SearchOutput
      Source field name: id
      Source field type: class java.util.UUID
      Source field value: cc70b9b9-6a88-48b7-bb52-9c74d577b9c5
      Dest parent class: com.ls.soa.stack.soaservices.service.contract.soap.v1.search.SearchOutput
      Dest field name: id
      Dest field type: java.util.UUID
    org.dozer.MappingException: java.lang.NoSuchMethodException: java.util.UUID.<init>()
    at org.dozer.util.MappingUtils.throwMappingException(MappingUtils.java:88)
    at org.dozer.factory.ConstructionStrategies$ByConstructor.newInstance(ConstructionStrategies.java:261)
    at org.dozer.factory.ConstructionStrategies$ByConstructor.create(ConstructionStrategies.java:245)
    at org.dozer.factory.DestBeanCreator.create(DestBeanCreator.java:65)
    at org.dozer.MappingProcessor.mapCustomObject(MappingProcessor.java:466)
    at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:427)
    at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:324)
    at org.dozer.MappingProcessor.mapField(MappingProcessor.java:270)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:239)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:181)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:125)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:120)
    at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:99)
    at com.ls.soa.stack.soaservices.service.search.converter.ResponseConverterV2ToV1.convert(ResponseConverterV2ToV1.java:25)
    at com.ls.soa.stack.soaservices.service.search.SearchServiceEntryPoint.search(SearchServiceEntryPoint.java:43)
    at com.ls.soa.stack.soaservices.service.search.test.utils.SearchDatasourceRouter.search(SearchDatasourceRouter.java:85)
    at com.ls.soa.stack.soaservices.service.search.test.v1.SearchServiceImplTest.testDefaultSortByDefaultRelevancy(SearchServiceImplTest.java:547)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Caused by: java.lang.NoSuchMethodException: java.util.UUID.<init>()
    at java.lang.Class.getConstructor0(Class.java:2706)
    at java.lang.Class.getDeclaredConstructor(Class.java:1985)
    at org.dozer.factory.ConstructionStrategies$ByConstructor.newInstance(ConstructionStrategies.java:257)
    … 39 more

     
  • Abhishek Ransingh

    Hi,
      Looks like the source field object is coming from some other modules and you have to first build that module since the destination module has some dependencies from the source module. Please first build the source module and then try to build the module where you have configured your mapping files.

    Thanks
    Abhishek

     
  • dmitry (lv)

    dmitry (lv) - 2010-11-09

    The default contructor means that Dozer simply tries to invoke new UUID(). If an object does not have no-args constructor you have two options: use copy-by-reference, write bean factory for that.

    Please refer to the documentation for details.

    Dmitry

     

Log in to post a comment.

MongoDB Logo MongoDB