我最近将我的Smooks应用程序从1.4升级到1.5.1,但我一直得到以下例外:
处理EDI文件时出错org.milyn.cdr.SmooksConfigurationException:错误 在类'org.milyn.smooks.scripting.groovy.GroovyContentHandlerFactory'上调用@Initialize方法'初始化'。
我是Smooks和Groovy的新手,但这是我的代码的摘录,它在1.4版本中运行。 我的类路径中也包含所有1.5.1类,包括我试图加载的1.5 EDI定义。
Smooks smooks = null;
try {
smooks = new Smooks();
}
catch(Exception exception) { System.out.println("Error " + exception); }
try {
smooks.setReaderConfig(new UNEdifactReaderConfigurator("urn:org.milyn.edi.unedifact:d01b-mapping:*"));
// Create an exec context - no profiles....
ExecutionContext executionContext = smooks.createExecutionContext();
DOMResult domResult = new DOMResult();
// Configure the execution context to generate a report...
executionContext.setEventListener(new HtmlReportGenerator("EDI/reports/report.html"));
smooks.filterSource(new StreamSource((InputStream) bufferedinputstream), domResult);
从GroovyContentHandlerFactory中提取
@Initialize
public void initialize() throws IOException {
String templateText = StreamUtils.readStreamAsString(getClass().getResourceAsStream("ScriptedGroovy.ftl"));
classTemplate = new FreeMarkerTemplate(templateText);
我会非常感激任何帮助或想法,因为我花了好几个小时试图解决这个问题。
干杯,马特