I am encountering a problem while marshalling my Java objects using JAXB.
When i run the web service as an independent application, it works fine.
When i Integrate it with my project, and use the generated Java classes,
while marshalling, I get an exception
RequestImplclass nor any of its super class is not known to any of this context.
While generating my JAXB instance I use the following statement:
JAXBContext jaxb = JAXBContext.newInstance("com.eos.hotels.API.Request");
I have 2 separate xsds, one for Request and another for Response.
The generated java classes are stored in a folder structure as follows:
API->Request API->Response
In both the above folders, an ObjectFactory.java is created and jaxb.properties is also there.
Also, inside each of the above mentioned folders, impl folder is created which has all Impl files, and inside this impl folder, runtime folder is created.
All the xs:element from XSD are created as interfaces, only the Impls are classes.
Also, there are no XML annotations in the generated java files.
Can anyone tell me what is going wrong here?
Is this problem happening because of folder structure or because the XML annotations are not present?
I read on the internet that annotations if not present also are not a problem.
I have even tried to copy the generated impl classes in the same folder as ObjectFactory.java, but that also did not work.
While creating the
JAxbContextI used the following:Though I am not sure why, it seems to be working fine.