JAVA mapping error

Hi All,
I am getting the below error while executing a JAVA mapping.
<SAP:Category>Application</SAP:Category>
  <SAP:Code area="MAPPING">LINKAGE_ERROR</SAP:Code>
  <SAP:P1>XMLNSTagCreate1/XMLNSTagCreate1</SAP:P1>
  <SAP:P2>java.lang.NoClassDefFoundError: XMLNSTagCreate1/XM</SAP:P2>
  <SAP:P3>LNSTagCreate1 (wrong name: XMLNSTagCreate1)</SAP:P3>
  <SAP:P4 />
  <SAP:AdditionalText />
  <SAP:Stack>Linkage error while loading class XMLNSTagCreate1/XMLNSTagCreate1; java.lang.NoClassDefFoundError: XMLNSTagCreate1/XMLNSTagCreate1 (wrong name: XMLNSTagCreate1)</SAP:Stack>
  <SAP:Retry>M</SAP:Retry>
I have tried compiling the code in the same JRE as the one in PI. Still it is not working.
Please suggest.
Regards,
Yashwanth
Edited by: YashwanthSVK on Aug 17, 2011 8:38 PM

Hi all... thank you for the replies.. I have compiled the code in the same version of JRE as the PI version...
Hi Vijay,
I also felt the same but as I do not have much knowledge in JAVA, i could not track it further. 
below is the code for the mapping... would you mind if I ask you to have a look at it and let me know where the error is..
thank you so much ...
import java.io.*;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerFactory;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import com.sap.aii.mapping.api.MappingTrace;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.FileWriter;
This mapping creates xmlns attribute to send to Tradeplace
public class XMLNSTagCreate1 extends DefaultHandler  implements StreamTransformation {
     private Map param;
     private MappingTrace trace;
     private OutputStream out;
     public void execute(InputStream in, OutputStream out)
          throws StreamTransformationException {
               DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
                    try {
                         //trace.addWarning("Execute function starts here");
                         DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
                         try {
                              org.w3c.dom.Document doc = docBuilder.parse(in);
                              //Node TradeplaceMessage = doc.getFirstChild();
                              Element trade=(Element) doc.getFirstChild();
                              if(trade.hasAttribute("tag1"))
                              NamedNodeMap TradeplaceMessageAttributes = trade.getAttributes();
                              String xmlnsValue=trade.getAttribute("tag1");
                              String modeValue=trade.getAttribute("productionMode");
                                  trace.addInfo("XMLNS  Value:"+xmlnsValue);
                                                                 trade.removeAttribute("tag1");
                                   trade.removeAttribute("productionMode");
                                   trade.setAttribute("xmlns",xmlnsValue);
                                   trade.setAttribute("productionMode",modeValue);
                                                  javax.xml.transform.Transformer transformer = TransformerFactory.newInstance().newTransformer();
                                                  transformer.setOutputProperty(OutputKeys.INDENT, "yes");
                                                  StreamResult result = new StreamResult(new StringWriter());
                                                  DOMSource source = new DOMSource(doc);
                                                  transformer.transform(source, result);
                                                  String xmlString = result.getWriter().toString();
                                                  //System.out.println(xmlString);
                                                  out.write(xmlString.getBytes());
                         } catch (SAXException e1) {
                              // TODO Auto-generated catch block
                              e1.printStackTrace();
                         } catch (IOException e1) {
                              // TODO Auto-generated catch block
                              e1.printStackTrace();
                         } catch (TransformerConfigurationException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                         } catch (TransformerFactoryConfigurationError e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                         } catch (TransformerException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                    } catch (ParserConfigurationException e) {
                         // TODO Auto-generated catch block
                         e.printStackTrace();
     public static void main2(String[] args) throws Exception {
          String xmlFile = "U:
Untitled.xml";
          InputStream in = new BufferedInputStream(new FileInputStream(xmlFile));
          XMLNSTagCreate1 test = new XMLNSTagCreate1();
          //test.countOccurences(in);
     public static void main(String[] args) throws Exception {
          String xmlFile = "//NA.AD.WHIRLPOOL.COM//myApps//home//NA//qqjos1d//My Documents//TP2.xml";
          InputStream in = new BufferedInputStream(new FileInputStream(xmlFile));
          FileOutputStream out = new FileOutputStream("//NA.AD.WHIRLPOOL.COM//myApps//home//NA//qqjos1d//My Documents//DhanishTP2.xml");
          XMLNSTagCreate1 test = new XMLNSTagCreate1();
          test.execute(in, out);
          OutputStreamWriter out1 = new OutputStreamWriter(out,"UTF-8");
     /* (non-Javadoc)
@see com.sap.aii.mapping.api.StreamTransformation#setParameter(java.util.Map)
     public void setParameter(Map param) {
          // TODO Auto-generated method stub

Similar Messages

  • Getting Java mapping errors when testing my Interface mapping

    Hi,
    I'm trying to test my interface mapping from IR, I keep getting these exceptions. All I'm doing in my interface mapping is I have two mapping programs a XSLT mapping with java helper functions with the XSL and a message mapping. In the test it pass thru the XSLT mapping but fails at Message mapping and throws the following exception. Any help on this is really appreciated.
    10:03:26 Start of test
    Call XSLT processor with stylsheet com/earthlink/xi/mapping/xmlc_to_crm_resp.xsl.
    START APPLICATION TRACE ***
    Response:
    0
    END APPLICATION TRACE ***
    Returned form XSLT processor.
    Call method execute of the application Java mapping com.sap.xi.tf._MM_XMLC_RESP_
    Error during appliction Java mapping com/sap/xi/tf/_MM_XMLC_RESP_
    java.lang.NullPointerException at com.sap.aii.mappingtool.tf3.AMappingProgram.exceptionCaught$(AMappingProgram.java:59) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:182) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:149) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.execute(RepJavaMapping.java:73) at com.sap.aii.ibrep.server.mapping.ibrun.RepSequenceMapping.execute(RepSequenceMapping.java:54) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80) at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127) at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.transform(MapServiceRemoteObjectImpl0.java:167) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:104) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    10:03:26 End of test

    Joe,
    most likely your XSLT is outputting a not well-formed XML message.
    Remove message mapping from the mapping list and execute it again, to check output.
    Also, for mapping debugging in java enhanced function inside XSLT mappings, use the following:
    1st, you need to pass the "inputparam" parameter from the XSLT runtime to the Java function (it needs to be one of the input parameters for the executed java function).
    In the Java code itself, implement the following code:
    AbstractTrace trace = (AbstractTrace) param.get(StreamTransformationConstants.MAPPING_TRACE);
    trace.addInfo("Log your message here!");
    where <i>param</i> is the input parameter refering to the <i>inputparam</i> from XSLT.
    The AbstractTrace and StreamTransformationConstants classes can be found in the aii_map_api.jar file (used in Java mappings).
    Regards,
    Henrique.

  • Java Mapping Error - Unable to instantiate the Java class

    Hi,
    I am trying out a Java Mapping scenario.
    The code worked fine in eclipse.i could get the desired output.
    but when i tried it out in XI ....i got the following error in moni:
    *Unable to instantiate the Java class*
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">CANNOT_INSTANCIATE_CLASS</SAP:Code>
      <SAP:P1>JavaMapping</SAP:P1>
      <SAP:P2>http://www.sdsdsd.com/XI/Sales/T~</SAP:P2>
      <SAP:P3>3bd13b30-6300-11dc-b9f1-f0050aa5c91a</SAP:P3>
      <SAP:P4>-1</SAP:P4>
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Unable to instantiate the Java class JavaMapping (http://www.sdsdsd.com/XI/Sales/T~, 3bd13b30-6300-11dc-b9f1-f0050aa5c91a, -1)</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Please help me out with this error.

    Hi Anu,
    Currently I am also facing the same Unable to instantiate the Java class  same java class is working fine in eclipse .
    Could you please confirm Is this because of version mismatch that in Eclipse JAVA and SAP JAVA ?
    Thanks in Advance.
    Best,
    Srinivas

  • JAVA MApping errors

    Hello,
             I have got following errors in sxmb_moni :
    Error Details:
    Trace level="1" type="T">Java mapping com/capgemini/bc/mappings/order/ZORA_DPO_TRANSFER_2_XMLSQLCoreInsert has thrown a StreamTransformationException.</Trace>
      <Trace level="1" type="T">com.sap.aii.mapping.api.StreamTransformationException: execute(): ZORA_DPO_TRANSFER to MT_XMLSQL_PO_INSERT java mapping failed : buildDistribution(): getExpenditureType(): can not find expenditure type in NP1ST for pattern FR-85000000-4 at com.capgemini.bc.mappings.order.ZORA_DPO_TRANSFER_2_XMLSQLCoreInsert.execute(ZORA_DPO_TRANSFER_2_XMLSQLCoreInsert.java:461) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:92) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0_0.processFunction(MappingServiceObjectImpl0_0.java:131) at sun.reflect.GeneratedMethodAccessor554.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy151.processFunction(Unknown Source) at sun.reflect.GeneratedMethodAccessor2875.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:107) at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113) at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:157) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172) Root Cause: com.sap.aii.mapping.lookup.LookupException: buildDistribution(): getExpenditureType(): can not find expenditure type in NP1ST for pattern FR-85000000-4 at com.capgemini.bc.mappings.order.ZORA_DPO_TRANSFER_2_XMLSQLCoreInsert.buildDistribution(ZORA_DPO_TRANSFER_2_XMLSQLCoreInsert.java:289) at com.capgemini.bc.mappings.order.ZORA_DPO_TRANSFER_2_XMLSQLCoreInsert.execute(ZORA_DPO_TRANSFER_2_XMLSQLCoreInsert.java:436) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:92) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0_0.processFunction(MappingServiceObjectImpl0_0.java:131) at sun.reflect.GeneratedMethodAccessor554.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy151.processFunction(Unknown Source) at sun.reflect.GeneratedMethodAccessor2875.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:107) at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113) at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:157) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)</Trace>
    Please suggest How can I get overcome from the above mentioned error.
    Thanks in advance,
    Sandip Adhikary

    The error could be related to the structure used in java mapping not matching with the structures provided in interface mapping OR the data is not proper/ inadequate.
    Regards,
    Prateek

  • Error while doing java mapping

    Hi,
    I have written a java mapping code .But i have a small doubt when i compile it it is showing errors that package com.sap.aii.mapping.api does not exist.How can i solve the problem.Please help me in this issue.
    Thanks,
    Bhargav

    Hi ,
    check this thread, it may help you.
    https://forums.sdn.sap.com/click.jspa?searchID=3558715&messageID=3229273
    Regards,
    Ramesh.

  • PI 7.11 - How to create a System Error in SXMB_MONI using a Java Mapping

    Hi
    We ve go a  Java Mapping in a File-to-HTTP Scenario. It works perfect except of one error case: if an empty source file or a source file with the wrong structure is delivered. In this case our Java Mapping forwards an empty payload to the HTTP channel. So, for PI is the mapping successful.
    I'd like to recognize this case and invoke a system error in the SXMB_MONI, so that this mapping will be stopped and our alerting concept informs the users. I know, how to recognize the case in Java but need to know how to create the System Error Status in the PI System.
    Thanks in advance
    Michael

    Hi Michael,
    Please refer here for the mapping API description:
    http://help.sap.com/javadocs/NW04S/SPS09/pi/com/sap/aii/mapping/api/package-summary.html
    You can use the StreamTransformationException exception describet there to raise an error from your Java mapping. Direct link:
    http://help.sap.com/javadocs/NW04S/SPS09/pi/com/sap/aii/mapping/api/StreamTransformationException.html
    You might also consider using the "Empty-File Handling" option in sender file CC to avoid processing empty files by PI.
    Hope this helps,
    Greg

  • Linkage error while doing java mapping

    Hi,
    I Have written a java mapping but when i use it in xi.It is showing an error as linkage error
    LinkageError at JavaMapping.load(): Could not load class: com/satyam/nestle/JavaMap
    Can anyone explain what does this mean and how to overcome it.
    Thanks in advance,
    Bhargav

    Did you try testing the java mapping seperately....that it does not have any errors??? Also check the cahce update. Sometimes it happens that XI is not able to load the class file from the cache. Perform a CPA cache refresh (delta). This should solve the problem
    Reward if helpful.

  • Java.util.EmptyStackException Mapping error

    Hi All,
    I am integrating SAP ECC 6.0 system with SAP SNC.
    For these i am using  standard content of SAP SNC
    I am getting following mapping error :
    TransformerConfigurationException occurred when loading XSLT InvoiceRequest_InvoicInvoic01_01.xsl; details: Could not load stylesheet.com.sap.engine.lib.xml.util.NestedException: Error parsing query. -> java.util.EmptyStackException
    Plz help me out
    Regards Milan

    hi,
    check the interaface mapping which is used in your flow
    inside integration repository - is it working over there?
    do you see the XSL file in the external archives in repository?
    Regards,
    Michal Krawczyk
    http://mypigenie.com XI/PI FAQ

  • Error in Java mapping

    Hi~
    I am trying to use import statement :
    import com.sap.aii.mapping.api.StreamTransformation; in the java mapping.
    But I am getting an error saying
    "StreamTransformation cannot be resolved to a type"
    I am working on the SAP Netweaver STudio SP01. Do I need to load any libraries for the SAP programs ?
    I am a newbie with Java. I dont get the direction to resolve this issue.
    Good Day~
    ~Peeru

    Hi,
    guess Raj is right.
    This could be helpful too:
    /people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    Regards
    Patrick

  • Error in Java Mapping program

    Hi friends,
    I am tryin java mapping for first time.. and created one java program using link https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field
    But when I am compiling it using JAVAC, I am getting following error message that
    package com.sap.aii.mapping.api does not exist . How can I solve this error.
    Complete error is as follows:
    C:j2sdk1.4.2_16-x64 in>javac PayloadToXMLField.java
    PayloadToXMLField.java:1: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformation;
                                   ^
    PayloadToXMLField.java:2: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.AbstractTrace;
                                   ^
    PayloadToXMLField.java:3: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformationConstants;
                                   ^
    PayloadToXMLField.java:8: cannot resolve symbol
    symbol  : class StreamTransformation
    location: class PayloadToXMLField
    public class PayloadToXMLField implements StreamTransformation {
                                              ^
    PayloadToXMLField.java:16: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class PayloadToXMLField
        AbstractTrace trace;
        ^
    PayloadToXMLField.java:27: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class PayloadToXMLField
                (AbstractTrace) param.get(
                 ^
    PayloadToXMLField.java:28: cannot resolve symbol
    symbol  : variable StreamTransformationConstants
    location: class PayloadToXMLField
                    StreamTransformationConstants.MAPPING_TRACE);
                    ^
    PayloadToXMLField.java:43: cannot resolve symbol
    symbol  : variable outputPayload
    location: class PayloadToXMLField
            outputPayload =
            ^
    PayloadToXMLField.java:50: cannot resolve symbol
    symbol  : variable outputPayload
    location: class PayloadToXMLField
                out.write(outputPayload.getBytes());
                          ^
    9 errors
    Thanks,
    Brijesh Soni

    thanks , it is done now..
    the program is compiled properly and class file is generated.
    but m gettin error in mapping.
    in IR i created two message type  with data type as string.
    and i had imported the class file and java program using Imported archives.
    now in interface mapping mapping program i had selected type as Java Class.and name of java program.
    but when i tested it, it is giving error as Linkage error occurred when loading class zip/PayloadToXMLField
    Please suggest, M i doing some thing wrong?is any thing missing?
    Program tht i had used in java
    from link (https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field):
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import java.util.Map;
    import java.io.*;
    public class PayloadToXMLField implements StreamTransformation {
        String strXML = new String();
        String outputPayload = new String();
         //Declare the XML tag for your XML message
         String StartXMLTag = "<Payload>";
         String EndXMLTag = "</Payload>";
        AbstractTrace trace;
        private Map param = null;
        public void setParameter(Map param) {
            this.param = param;
        public void execute(InputStream in, OutputStream out) {
            trace =
                (AbstractTrace) param.get(
                    StreamTransformationConstants.MAPPING_TRACE);
            trace.addInfo("Process Started");
            try {
                StringBuffer strbuffer = new StringBuffer();
                byte[] b = new byte[4096];
                for (int n;(n = in.read(b)) != -1;) {
                    strbuffer.append(new String(b, 0, n));
                strXML = strbuffer.toString();
            } catch (Exception e) {
                System.out.println("Exception Occurred");
            outputPayload =
                "<?xml version="1.0" encoding="UTF-8"?>"
                   + StartXMLTag
                   + strXML
                   + EndXMLTag;
            try {
                out.write(outputPayload.getBytes());
                   trace.addInfo("Process Completed");;
            } catch (Exception e) {
                trace.addInfo("Process Terminated: Error in writing out payload");;
    and detailed trace of error is:
    11:34:21 Start of test
    LinkageError at JavaMapping.load(): Could not load class: zip/PayloadToXMLField
    java.lang.NoClassDefFoundError: zip/PayloadToXMLField (wrong name: PayloadToXMLField) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.lang.ClassLoader.defineClass(ClassLoader.java:448) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingLoader.findClass(RepMappingLoader.java:175) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.load(RepJavaMapping.java:136) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.execute(RepJavaMapping.java:50) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80) at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127) at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.transform(MapServiceRemoteObjectImpl0_0.java:167) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:104) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    11:34:21 End of test

  • How to avoid Linkage Error in JAVA Mapping

    Dear Experts,
    I am trying to test the JAVA mapping compiled in NWDS but receiving the error
    "LinkageError at JavaMapping.load(): Could not load class".
    java.lang.NoClassDefFoundError: JSONXMLProject/bin/com/sap/json/ConvJson2Xml (wrong name: com/sap/json/ConvJson2Xml)
    at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:735)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:716) at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at com.sap.aii.ib.server.mapping.execution.MappingLoader.findClass(MappingLoader.java:195)
    Following are the details:
    SAP PO 7.4
    SP Stack Number 05
    JDK Version jdk16
    NWDS
    SAP Enhancement Package 1 for SAP NetWeaver Developer Studio 7.3 SP10 PAT0000
    1.Created the Project , Package and then class (Included the logic)
    2. Included 1 JSON Jar file into my project and the Added to build path.
    3.Exported the project as Archive File and saved in desktop
    4.Imported into SAP PO system as Imported Archive
    5.Could not observe the JSON jar file which i used as referenced JAR in NWDS
    6.Tested in OM after referencing the JAVA class and found the above error.
    I have JDK 5, 6 and 7 present in my local desktop and I am trying to export the compiled code using both JAVA SE 1.6 and 1.5 in NWDS seperatly after going several discussions.
    Can any one hep me with the screenshots and tell me how to include all the reference jar files in exported project..
    Regards..

    Dear Anand,
    I did exactly as you shared. As the JSON jar has number of classes, then in OM all the Classes had to be assigned. Then the linkage error went.
    But in execution , it shows a new error that all the classes of the JSON jar has to be implemented with interface StremTransformation or AbstractTransformation.
    I assume in the Operation Mapping I will use only 1 class as JAVA Class. Anyway I am attaching the document with navigation.
    Do we have any other alternative??
    Please rename the extension of the document by remove .txt
    Regards

  • LINKAGE ERROR in Java Mapping

    Hi Friends,
    I am getting LINKAGE ERROR when executing JAVA mapping as its not able to reference AbstractTransform class provided by SAP PI API.
    This problem occurs in particular environment for this particular mapping. For other environments this is working fine.
    I assume it has something to do with Java Library reference which is mis-configured during transport. Can anyone let me know how and where the library path is configured for Imported Achieves in SAP PI 7.1.
    We are using java 1.5 for building and creating java achieves.
    Many thanks,
    SK

    Hi Sumant,
      This error occurs when the jdk version of XI server and the library version you used to develop the mapping are incompatible. Make sure you use the same version as of the server
    have a look in SAP Note 755302
    Regds,
    Pinangshuk.

  • Getting Error in java mapping: Parsing empty source. Root element expected!

    Hi Experts,
       I am using java mapping for schema validation of input message. I have followed all the standard procedures and implemented the java class in the interface mapping.
    My interface mapping is like this:
    OrderData --->Java Class ---SchemaValidate
                         Mesg Map ---OrderData_to_BAP --->BAPI Msg
    So first I want to validate the schema of the input message. If the input message is invalid then XI should throw an exception. Then I use the actual message mapping to map the input order data to the BAPI input parameters.
    In the java code I am using xerces parser.
    The java code works fine when I run it as a standalone application.
    The interface mapping also works fine if I don't include the java mapping. Ofcourse schema validation does not happen.
    But when I test the interface mapping by including the java mapping then I am getting the error:
    Call method execute of the application Java mapping SchemaValidate
    Java mapping SchemaValidate completed. (execute() of SchemaValidate
    com.sap.aii.utilxi.misc.api.BaseRuntimeException: Parsing an empty source. Root element expected!
    What am I doing wrong? Why it is not getting the root element?
    My Java code is as follows:
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import java.io.*;
    import java.util.Map;
    import javax.xml.parsers.*;
    import org.xml.sax.helpers.*;
    import org.xml.sax.*;
    import org.apache.xerces.jaxp.*;
    Sample mapper for SAP-XI
    @author Gopal
    public class SchemaValidate implements StreamTransformation {
        //Constants when using XML Schema for SAX parsing.
         static final String JAXP_SCHEMA_LANGUAGE =
         "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
         static final String W3C_XML_SCHEMA =
         "http://www.w3.org/2001/XMLSchema";
         static final String JAXP_SCHEMA_SOURCE =
         "http://java.sun.com/xml/jaxp/properties/schemaSource";
    Injection of mapping parameters
    from integration engine
    @param map Map with configuration data
        public void setParameter(Map map) {
    Mapping implementation
    @param inputStream Input data from integration engine
    @param outputStream Output data to integration engine
        public void execute(InputStream inputStream,
                            OutputStream outputStream)
          throws StreamTransformationException {
            try {
                  // obtain an object of class javax.xml.parsers.SAXParser,
                  SAXParserFactory spf = SAXParserFactoryImpl.newInstance();
                  spf.setNamespaceAware(true);
                  spf.setValidating(true);
                  SAXParser sp = spf.newSAXParser();
                  // setup the schema file
                  sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
                  sp.setProperty(JAXP_SCHEMA_SOURCE, new File("IOReqMsgSchema.xsd"));
                  //parse the input xml using the given schema
                  sp.parse(inputStream, new ParseErrorHandler());
            catch(SAXException se) {
              se.printStackTrace();
            catch ( Exception e ) {
              throw new StreamTransformationException( e.getMessage() );
    My input message is :
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:OrderCreate_request xmlns:ns0="mynamespace">
       <ORDER>HTEST1234567</ORDER>
       <ORDER_TYPE>z001</ORDER_TYPE>
       <ORDER_NAME>Test Order</ORDER_NAME>
       <CO_AREA>INTC</CO_AREA>
       <CCTR_POSTED>1234567890888888888</CCTR_POSTED>
       <CURRENCY>USD</CURRENCY>
       <PERSON_RESP>12345679</PERSON_RESP>
    </ns0:OrderCreate_request>
    Kindly help! please this is urgent!!!!!!
    Thanks
    Gopal
    Edited by: gopalkrishna baliga on Feb 28, 2008 9:34 AM

    Hi Stefan,
       I did the code changes to return output stream and the java code works perfectly in standalone mode in my PC.
       But when I use the same in the Java mapping with XI then It throws an error "Getting Error in java mapping: Parsing empty source. Root element expected!".
    My XI J2EE server has JDK1.4.3.11.
    Is there any limitation of using SAX parser in XI? If Yes, then which parser should be used for schema validation in XI?
    I have included the XSD file for schema validation along with class files in the .jar file. This jar file is then imported in XI repository. Is the XI engine not able to read the XSD file?
    Do I have to handle reading XSD file differently? Any suggession how?
    Is this parser error due to some security access?
    Kindly help me! I have been struggling with this problem since 2 weeks. I will be greatfull to you if you can help me.
    Thanks
    Gopal

  • Error using Java Mapping

    Hi All,
    I am working on scenario with help of this blog for java mapping
    http://www.riyaz.net/blog/xipi-java-mapping-demystified/
    I am getting error while i test the interface mapping as
    Problem while building Tree view
    Unable to display tree view; Error when parsing an XML document (Premature end of file.)
    How can i solve this error
    Regards,
    Syed

    Hi,
    all you need to do is close all the tags properly and try to validate the XML
    hope it will work
    Regards
    Venkat

  • Cannot resovle the Symbol error in UDF - Java mapping - RFC Lookup ?

    Hi Friends ,
    We are working on Java mapping  -  UDF for RFC Lookup . It is giving the Cannot resolve Symbol for all imported archive java class files even if we give again all imported files in import section of UDF we are still getting the same cannot resolve error  .
    We are using SP 12 of XI 3.0 . What could be the reason ?
    Thanks.,
    V.Rangarajan

    Hi,
    Can you try to open imported archive in IR and check if the path(folder structure like com.abc.xyz.etc) for classes is same as in import statement in UDF.Since we had experienced the same problem.
    Thanks.
    Regards,
    Shweta

Maybe you are looking for