1

I have recently upgraded my Smooks application from 1.4 to 1.5.1, but I keep getting the exception below:

Error when processing EDI file org.milyn.cdr.SmooksConfigurationException: Error invoking @Initialize method 'initialize' on class 'org.milyn.smooks.scripting.groovy.GroovyContentHandlerFactory'.

I am pretty new to Smooks and Groovy, but this is an extract of my code, which was working in version 1.4. I also have all the 1.5.1 classes in my classpath, including the 1.5 EDI definitions I am trying to load.

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);

Extract from GroovyContentHandlerFactory

@Initialize 
public void initialize() throws IOException { 
String templateText = StreamUtils.readStreamAsString(getClass().getResourceAsStream("ScriptedGroovy.ftl")); 
classTemplate = new FreeMarkerTemplate(templateText);

Any help or ideas would be much appreciated as I have spent hours on trying to figure this one out.

Cheers, Matt

Matt Drake
  • 57
  • 1
  • 10

0 Answers0