下面是我的代码和目录结构,以及报错信息
public static void loadSchema() {
Resource res = new ClassPathResource("wsdl/");
File f = null;
try {
f = res.getFile();
} catch (IOException e) {
e.printStackTrace();
}
log.info("wsdl dir:" + f.getPath());
addXsdPath(f); }
public static synchronized void addXsdPath(File file) { if (file.isDirectory()) {
File[] fileArr = file.listFiles();
for (int i = 0; i < fileArr.length; i++) {
addXsdPath(fileArr[i]);
}
} else {
// logger.info("file:" + file.getName());
Matcher matcher = EXP_PATTERN.matcher(file.getName());
if (matcher.matches()) {
String serviceName = batchReplace(file.getName(), "Schema.xsd", "Ser");
String xsdPath = file.getAbsolutePath();
XSOMParser parser = new XSOMParser();
try {
log.info(serviceName + ":" + xsdPath);
parser.parse(new File(xsdPath)); XSSchemaSet xsdSet = parser.getResult();
log.info(serviceName + ":" + xsdPath + "," + (xsdSet == null ? "null" : "ok"));
schemaMap.put(serviceName, xsdSet); } catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} else {
// logger.info("file:" + file.getName() + ", unmatcher");
}
}
}
public static void loadSchema() {
Resource res = new ClassPathResource("wsdl/");
File f = null;
try {
f = res.getFile();
} catch (IOException e) {
e.printStackTrace();
}
log.info("wsdl dir:" + f.getPath());
addXsdPath(f); }
public static synchronized void addXsdPath(File file) { if (file.isDirectory()) {
File[] fileArr = file.listFiles();
for (int i = 0; i < fileArr.length; i++) {
addXsdPath(fileArr[i]);
}
} else {
// logger.info("file:" + file.getName());
Matcher matcher = EXP_PATTERN.matcher(file.getName());
if (matcher.matches()) {
String serviceName = batchReplace(file.getName(), "Schema.xsd", "Ser");
String xsdPath = file.getAbsolutePath();
XSOMParser parser = new XSOMParser();
try {
log.info(serviceName + ":" + xsdPath);
parser.parse(new File(xsdPath)); XSSchemaSet xsdSet = parser.getResult();
log.info(serviceName + ":" + xsdPath + "," + (xsdSet == null ? "null" : "ok"));
schemaMap.put(serviceName, xsdSet); } catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} else {
// logger.info("file:" + file.getName() + ", unmatcher");
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货