Hello,
I have implement a simple mapping between to IDOC-Types in JAVA. As first I would test the mapping therefore I read the InputStream from a testfile, but this did not work. Can anybody help me?
Source code:
SAXBuilder parser = new SAXBuilder();
Document src_doc = parser.build(new FileInputStream("CRMXIF_ORDER_SAVE_TEMPLATE.xml"));
The parser.build statement makes the error:
java.lang.NoClassDefFoundError: com/sap/guid/GUIDFormatException
at com.sap.aii.utilxi.log.impl.LoggerImpl.log(LoggerImpl.java:168)
at com.sap.aii.utilxi.log.api.Logger.log(Logger.java:138)
at com.sap.aii.utilxi.prop.api.PropertySourceFactory.getPropertySource(PropertySourceFactory.java:56)
at com.sap.aii.utilxi.misc.api.AIIProperties.sync(AIIProperties.java:519)
at com.sap.aii.utilxi.misc.api.AIIProperties.(AIIProperties.java:292)
at com.sap.aii.utilxi.misc.api.AIIProperties.getInstance(AIIProperties.java:319)
at com.sap.aii.utilxi.xml.api.XMLServices.getParserFactory(XMLServices.java:144)
at com.sap.aii.utilxi.xml.xdom.io.XDOMInputter.parse(XDOMInputter.java:203)
at com.sap.aii.utilxi.xml.xdom.io.XDOMInputter.read(XDOMInputter.java:166)
at com.sap.aii.utilxi.xml.jdom.SAXBuilder.build(SAXBuilder.java:60)
at XIMapping.Map2Orders.main(Map2Orders.java:54)
Exception in thread "main"
Thanks for help
Björn
Hi!!!
Are you testing your java mapping after adding it to the Repository or outside it (from command line)?
If you are doing it outside then have you got aii_util_misc.jar(there is GUIDFormatException class) file in your CLASSPATH?
To test java mapping from command line you have to have aii_map_api.jar file in your CLASSPATH.
If you want to test your java mapping, I would recommend you to use code like this below (look at the main function) rather than your source code.
public class YOURMAPPING implements StreamTransformation {
private Map m_param;
public void setParameter(Map param) {
m_param = param;
}
public void execute(InputStream in, OutputStream out) {
// write your logic here
// for example parsing input stream
DefaultHandler handler = this;
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
SAXParser saxParser = factory.newSAXParser();
this.out = out;
saxParser.parse(in, handler);
} catch (Throwable t) {
t.printStackTrace();
}
}
(...)
public static void main(String args[]) throws Exception {
System.out.println("Start");
YOURMAPPING mapping = new YOURMAPPING();
mapping.setParameter(new Hashtable());
mapping.execute(new FileInputStream("CRMXIF_ORDER_SAVE_TEMPLATE.xml"), new FileOutputStream("output.xml"));
System.out.println("Done.");
}
}
Regards,
Andrzej Filusz
Add a comment