I have a requirement that I need to convert xsd file to POJO files. While using tomcat I didnot face any issue but when I am using weblogic I am getting error
Can't find resource for bundle java.util.PropertyResouceBundle,key JAXPSupportedProperty
File tmpDir = util.createTempPOJODirectory();
String xsdFilePath = convertToXSD(xmlResponse, tmpDir); // The xml response will be converted to XML file and then converted to XSD file
if (StringUtils.isNotBlank(xsdFilePath)) {
log("XSD location ::" + xsdFilePath + " and output location :: " + tmpDir);
// Setup schema compiler
SchemaCompiler sc = XJC.createSchemaCompiler();
sc.forcePackageName("");
// Setup SAX InputSource
File schemaFile = new File(xsdFilePath);
InputSource is = new InputSource(schemaFile.toURI().toString());
// is.setSystemId(schemaFile.getAbsolutePath());
// Parse & build
sc.parseSchema(is);
log("after parsing and building");
log("sc :: " + sc);
S2JJAXBModel model = null;
try {
model = sc.bind();
}
catch (Exception e1) {
log("Exception :: " + ExceptionUtils.getFullStackTrace(e1));
}
log("model :: " + model);
try {
JCodeModel jCodeModel = model.generateCode(null, null);
jCodeModel.build(tmpDir);
log("generation POJO's is success");
return "POJO are created under " + tmpDir + " successfully.";
}
catch (IOException e) {
log("unable to generate POJO's");
log("IOException occurs :: " + ExceptionUtils.getFullStackTrace(e));
}
catch (Exception e) {
log("Exception occurs :: " + ExceptionUtils.getFullStackTrace(e));
}`
For this I have used below jars :-
- xsd-gen-0.2.1.jar
- xom-1.2.5.jar
- wiztools-commons-lib-0.4.1.jar
- jaxb-xjc-2.2.11.jar
- jaxb-core-2.2.11.jar
- cli-7.jar
Thanks guys, I have resolved this issue by removing jaxb jars.