JaxbRepresentation gives error “doesnt contain ObjectFactory.class or jaxb.index”

后端 未结 8 1279
再見小時候
再見小時候 2021-02-02 08:11

I am trying to create a sample test application which converts an object to JaxbRepresentation. But when I try to run this, it gives me an error.

Main.java file

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-02 08:59

    I was using Spring and I just had to change

    Jaxb2Marshaller mlr = new Jaxb2Marshaller();
    mlr.setContextPaths("","");
    

    to

    Jaxb2Marshaller mlr = new Jaxb2Marshaller();
    mlr.setPackagesToScan("","");
    

    Ref1 & Ref2

提交回复
热议问题