cancel
Showing results for 
Search instead for 
Did you mean: 

JAVAMAP-Sax Parser ...............Linkage error when loading the class.

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

sunil_singh13
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

}

}

Answers (3)

Answers (3)

bhavesh_kantilal
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Dear Muthy,

I have sent you the screenshots Please check your mail box.

Thanks,

Srinivasa

Former Member
0 Kudos

Dear Murthy,

I have sent you the screenshots Please check your mail box.

Thanks,

Srinivasa

Former Member
0 Kudos

hi,

I havent received any !!

Former Member
0 Kudos

I have send it to pmurthy@gmail.com.

Kindly check it now .

Thanks,

Srinivasa

Former Member
0 Kudos

my id is <b>ramesh.pmurthy@gmail.com</b> and not pmurthy@gmail.com

Former Member
0 Kudos

Yes murthy,

I have sent it again.to ramesh.pmurthy@gmail.com.

Kindly check it now.

Thanks,

srinivasa

Former Member
0 Kudos

hi

activate the imported archive (your java mapping)

Former Member
0 Kudos

I activated the the imported archieves and interface mapping .

The result is same.loadind error

Former Member
0 Kudos

hey,

include these statements and see

import javax.xml.transform.Result;

import javax.xml.transform.sax.SAXTransformerFactory;

import javax.xml.transform.sax.TransformerHandler;

import javax.xml.transform.stream.StreamResult;

regards

Ramesh P