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

后端 未结 8 1266
再見小時候
再見小時候 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 09:12

    To get rid of additional jaxb.index files you may use Java class to instantiate the context:

    http://docs.oracle.com/javase/6/docs/api/javax/xml/bind/JAXBContext.html#newInstance(java.lang.Class...)

    Usually you need to pass in only single java class because other classes are "statically reachable from these class(es)" so JAXB is able to identify them.

提交回复
热议问题