1 pièce(s) jointe(s)
newSchema(url) exécution très très très lente
Bonjour,
En passant de jboss 5 a 7 la ligne de code suivante:
Schema schema = sf.newSchema(url);
me pose désormais un gros probleme, au lieu de s'exécuter quasi instantanément elle met désormais 1mn
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| private static void MarshallMsg(Interchange interchange, File output) throws ValidationException {
try {
JAXBContext jaxbContext = JAXBContext.newInstance("fr.mgi.mcustomsmsg.xml.entity");
Marshaller marshaller = jaxbContext.createMarshaller();
//encoding fichier xml, par defaut UTF-8
marshaller.setProperty(Marshaller.JAXB_ENCODING, PropertiesLoader.get("xml.encoding", "UTF-8"));
//formatter le xml (human readable => non par defaut)
Boolean format = "false".equals(PropertiesLoader.get("xml.output.formatted", "false")) ? false : true;
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, format);
//pour la validation xml/schema
boolean validEnabled = true;//"true".equals(PropertiesLoader.get("xml.output.validate", "true"));
if (validEnabled) {
SchemaFactory sf = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
//on recupere l'URL du schema
URL url = Thread.currentThread().getContextClassLoader().getResource("xsd/Interchange.xsd");
Schema schema = sf.newSchema(url);
//ajout du schema
marshaller.setSchema(schema);
}
marshaller.marshal(interchange, output);
} catch (SAXException ex) {
log.error("=" + MarshallMsg.class.getName() + " / SAXException MarshallMsg(): " + ex);
} catch (JAXBException ex) {
log.error("=" + MarshallMsg.class.getName() + " / JAXBException MarshallMsg(): " + ex);
throw new ValidationException(ex.toString());
}
} |
merci de votre aide :)