Skip to content
Advertisement

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

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

JavaScript

TestResource.java file

JavaScript

SampleResponse.java file

JavaScript

When I run this on the server, it throws the following error:

JavaScript

Please someone help!!!

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement