cancel
Showing results for 
Search instead for 
Did you mean: 

Linkage error occured when loading the class:Java Mapping

Former Member
0 Kudos

I AM GETTING THE ABOVE ERROR IN SUB WHEN TESTING THE MAPPING .

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

}

}

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi,

You should build all the java class and import them. This error is usually when you change one class and you dont compile and build the rest.

Regards.

Message was edited by:

Iñaki Vila

Former Member
0 Kudos

All the java classes are built.In this program there are 2 classes eho,myecho.

Answers (1)

Answers (1)

iaki_vila
Active Contributor
0 Kudos

Hi,

When you make the jar to import to XI you must verify the two classes are generated at the same time. Later you can verify in Inteface Mapping that you are using the myEcho class to do the java mapping.

Plesae verify the java version are the same in you own machine and the xi machine.

Regards.