Menu

NoClassDefFoundError

Help
2010-08-11
2021-02-03
  • alfred Pouli

    alfred Pouli - 2010-08-11

    Hi,

    I need some help on a mapping file with Dozer. I've got a first class FirstClassDB  which looks like this :

    public class FirstClassDB {
      private FirstClassIdDB id;
    ….
    }

    public class FirstClassIdDB {
      private FirstSubClassDB firstSubClass;
      private String test;

    }

    public class FirstSubClassDB {
      private FirstSubClassIdDB id;
      ….
    }

    public class FirstSubClassIdDB {
      private String testSubClassId;

    }

    And i'd like to fill a DTO object :

    public class MyDTOClass {
      private String testDTO;
      private String testSubClassIdDTO;
    }

    My mapping file :

    <mapping>
    <class-a>FirstClassDB </class-a>
    <class-b>MyDTOClass </class-b>
    <field>
    <a>id.firstSubClass.id.testSubClassId</a>
    <b>testSubClassIdDTO</b>
    </field>
    <field>
    <a>id.test</a>
    <b>testDTO</b>
    </field>
    </mapping>

    When i try to map my FirstClassDB to MyDTOClass, i've got the following exception :

    org.dozer.MappingException: java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject
    at org.dozer.util.MappingUtils.throwMappingException(MappingUtils.java:88)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:181)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:124)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:119)
    at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:92)
            ….

    All the getters and setters are public.

    Thanks.

     
  • alfred Pouli

    alfred Pouli - 2010-08-11

    I'm using Dozer 5.2.2. With the 5.2.0, there was no exception but in my DTO class, only the testDTO was filled, testSubClassIdDTO was always null.

     
  • dmitry (lv)

    dmitry (lv) - 2010-08-12

    NoClassDef exception is a fixed bug in trunk where in version 5.2.2 compile time dependency was introduced to Apahe XmlBeans project. This will be removed in next releases. Otherwise your mapping looks correct…

    Does Dozer instantiate intermediate objects in chain "id.firstSubClass.id.testSubClassId" ? or everything is null after running a mapping?

    Dmitry

     
  • alfred Pouli

    alfred Pouli - 2010-08-12

    No, nothing is instantiate, everything is null. I just can get the value of "test" in FirstClassIdDB, all the attributes of FirstSubClassDB   i try to get are null.

     
  • Klaus Schuster

    Klaus Schuster - 2021-02-03

    same problem with dozer 5.5.1 - solved by putting xmlbeans-2.5.0.jar to classpath in websphere 9.0 environment.

     

Log in to post a comment.