on 10-19-2007 6:11 AM
Dear all,
Do we have any extra things to execute the Java mapping using the Sax Parser?
When I am executing the interface mapping ,I am getting the" Linkage error when loading the class" error.
Kindly let me know your personnel maildId so that I can mail you the screen shots.
Thanks,
Srinivasa
Hi srinivas,
As rightly mentioned by Ramesh it is Jar file problem .
Make sure that you have included aii.mapping.jar &aii.util file in
your development .You can first test your mapping in NetWeaver development Studeo and export it as a jar file .now it should work.If it doesnt work properly you can send me your code with the file to be mapped .
My Email is
<a href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement&">please do provide email IDs - see the forum's Rules and Regulations</a>
Message was edited by: SDN XI Moderator
Kenny Scott
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear sunil,
Find the File.
Source:
<MTO_FTP_MAT_DETAILS>
<MATDETAILS>
<MAKTX>
<MATNR>
<WERKS>
<LABST>
<MEINS>
<PERCNT>
TARGET
MTI_FTP_MAT_DETAILS
<MATDETAILS>
<MAKTX>
<MATNR>
<WERKS>
<LABST>
<MEINS>
<PERCNT>
Source:
<MTO_FTP_MAT_DETAILS>
<MATDETAILS>
<MAKTX>
<MATNR>
<WERKS>
<LABST>
<MEINS>
<PERCNT>
TARGET
MTI_FTP_MAT_DETAILS
<MATDETAILS>
<MAKTX>
<MATNR>
<WERKS>
<LABST>
<MEINS>
<PERCNT>
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import com.sap.aii.mapping.api.StreamTransformation;
class Echo {
public static OutputStream out;
}
public class myEcho extends DefaultHandler implements StreamTransformation {
private Map map;
public void setParameter(Map param) {
map = param;
}
public void execute(InputStream in, OutputStream out) {
DefaultHandler handler = this;
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
SAXParser saxParser = factory.newSAXParser();
Echo.out = out;
saxParser.parse(in, handler);
} catch (Throwable t) {
t.printStackTrace();
}
}
public void startDocument() throws SAXException {
try {
Echo.out.write("<?xml version='1.0' encoding='UTF-8'?>".getBytes());
} catch (IOException e) {
e.notify();
}
}
public void endDocument() throws SAXException {
try {
Echo.out.flush();
} catch (IOException e) {
throw new SAXException("I/O error", e);
}
}
public void startElement(String namespaceURI, String sName, // simple name
String qName, // qualified name
Attributes attrs) throws SAXException {
String eName = sName; // element name
if ("".equals(eName))
eName = qName; // not namespace-aware
if ("ns0:MTO_SAP_MAT_DETAILS".equals(qName)) {
try {
Echo.out.write(("<MTI_FTP_MAT_DETAILS>").getBytes());
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
Echo.out.write(("<" + qName + ">").getBytes());
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void endElement(String namespaceURI, String sName, // simple name
String qName // qualified name
) throws SAXException {
String eName = sName; // element name
if ("".equals(eName))
eName = qName; // not namespace-aware
if ("ns0:MTO_SAP_MAT_DETAILS".equals(qName)) {
try {
Echo.out.write(("</MTI_FTP_MAT_DETAILS>").getBytes());
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
Echo.out.write(("</" + qName + ">").getBytes());
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void characters(char buf[], int offset, int len)
throws SAXException {
String s = new String(buf, offset, len);
try {
Echo.out.write(s.getBytes());
} catch (Exception e) {
e.printStackTrace();
}
}
Is there some custom class that you are using the Java Code? Is that imported in the Imported Archives?
Also, is you used NWDS and use CtrlShoftO to import the Classes, make sure you imported the class relevant to SAX parser. You would be asked to choose the import class when the same class is in different packages and hence choose the one relevant to SAX.
Regards
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Srinivas,
Check the following items.
1. Check the JDK/JRE version that u used to compile the java code. Some times JDK/JRE used by XI may be in a lesser version and may not be able to load the class in ur Archive.
2.Check the Package structure of ur program. The Java files in the imported archive must be in the folder/package structure as indicated by package declaration of the program.
3. Make sure that u have also imported the jars referenced by your program as a seperate Archive.
Regards,
Sudharshan N A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Srinivas,
The linkage error is due to not finding libraries at runtime. anyways can you forward the screen shots at ramesh.pmurthy@gmail.com, let me check.
regards
Ramesh P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.