cancel
Showing results for 
Search instead for 
Did you mean: 

LinkageError in Java Mapping in PI7.1

Former Member
0 Kudos

Hi,

Using a Java mapping to receive EDI file and sent to different location based on the content in the file. When I tried to run from the end to end received the below error

<SAP:Code area="RCVR_DETERMINATION">CX_RD_PLSRV</SAP:Code>

  <SAP:P1>Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed</SAP:P1>

  <SAP:P2 />

  <SAP:P3 />

  <SAP:P4 />

  <SAP:AdditionalText />

  <SAP:Stack>Error when determining the receiver: Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed Error while determining root tag of XML: BOM / charset detection failed Error while parsing an XML stream: &#39;BOM / charset detection failed&#39;.</SAP:Stack>


If I run in Operation Mapping

        LinkageError when loading class UpmFileIdentification/bin/fileidentification; details: java.lang.NoClassDefFoundErro

Appreciate your inputs and quick response.

Thanks,

Senthil

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi All,

I could able to nail-down the issue and it is because of source EDI file. When I process the attached Sample2 file the interface executed successfully,

So now is it possible to validate EDI file content in File to File scenario without mapping? Kindly advice.

Note: Sample is original file and Sample2 is modified file

Thanks,

Senthilkumar

Message was edited by: Senthil Kumar

Former Member
0 Kudos

Hi All,

Thanks for the input! The actual problem Linkage had been resolved but the second error still not resolved hence I close this thread and opened a new thread of new problem.

http://scn.sap.com/thread/3472460

Thanks,

Senthil.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Senthil,

                  It seems you have not compiled the java code incorrect java version. For Pi 7.1 you need j2sdk 1.5. Secondly if you are using external library to compile the code, then those libraries should be uploaded along with the original java class. Please kindly recompile and upload again.

Second reason can be

If your XML is UTF-16 or UTF-32,then it needs a BOM which is missing. Please check this link.

http://en.wikipedia.org/wiki/Byte-order_mark

Regards

Anupam

Former Member
0 Kudos

Hi Amit, Anumpam,

Thanks for the useful info! Could able to clear the linkage error but still when I execute end-to-end getting the below error

<SAP:Stack>Error when determining the receiver: Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed Error while determining root tag of XML: BOM / charset detection failed Error while parsing an XML stream: &#39;BOM / charset detection failed&#39;.</SAP:Stack>


Note: I guess the RAW file will not get covert into XML and which will be directly read by Java code. Correct me if I am wrong


Snippet of my input fie:


UNB+UNOC:2+XXX:ZZZ+003708183569+131202:1657+XXX0000000010' -> start of the file

UNZ+1+XXX0000000010' -> end of the file


My code to chose the folder based on the content as below:

package sap.com;

import java.io.BufferedReader;

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.OutputStream;

import java.util.Map;

import com.sap.aii.mapping.api.AbstractTrace;

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.StreamTransformationConstants;

import com.sap.aii.mapping.api.StreamTransformationException;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

public class fileidentification extends AbstractTransformation

{

private Map map = null;

private AbstractTrace trace = null;

String line =null;

StringBuffer message=new StringBuffer();

public static void main(String[] args) throws  Exception

{

  // TODO Auto-generated method stub

fileidentification file=new fileidentification();

FileInputStream in=new FileInputStream("C:/Users/Test/DESADV.txt");

FileOutputStream out=new FileOutputStream("C:/Users//Test/output.txt");

file.execute(in,out);

//out.write(file.message.toString().getBytes("UTF-8"));

  }

public void execute(InputStream in, OutputStream out)

  throws StreamTransformationException

  {

  Boolean SYSTEMIN=false;

  Boolean DESADV=false;

  Boolean EXWL12=false;

  Boolean EXUI13=false;

  Boolean LOC= false;

  // TODO Auto-generated method stub

trace = (AbstractTrace)map.get( StreamTransformationConstants.MAPPING_TRACE );

  trace.addInfo("EXECUTE METHOD STARTS- STEP -1");

  try {

  BufferedReader reader = new BufferedReader(new InputStreamReader(in,""));

  trace.addInfo("BUFFER READER STARTS - STEP 2");

   message.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> <ns0:Receivers xmlns:ns0=\"http://sap.com/xi/XI/System\">");

  message.append(" <Receiver>      <Party agency=\"\" scheme=\"\"/><Service>");

  trace.addInfo("ROOTS ARE APPDEDED IN MESSAGE -STEP -3 ");

  while ((line = reader.readLine()) != null)

  {

  trace.addInfo("WHILE LOOP STARTS -STEP 4 ");

if(line.indexOf("IFTMBF")>0)

  {

  SYSTEMIN=true;

  break;

}

  if(line.indexOf("DESADV")>0)

  DESADV=true;

  if(line.indexOf("EXWL12")>0)

  EXWL12=true;

  if(line.indexOf("EXUI13")>0)

  EXUI13=true;

  if(line.indexOf("LOC+8+LO01")>0)

  LOC=true;

  }

  trace.addInfo("WHILE LOOP ENDS -STEP 5 ");

  if(SYSTEMIN)

  message.append("SYSTEMIN");

  else if(DESADV&&EXWL12&&LOC)

  message.append("ITSSYSTEMVALKOXW");

  else if(DESADV&&EXUI13&&LOC)

  message.append("ITSSYSTEMVALKOXU");

  else if(DESADV)

  message.append("ITSSYSTEMCSLXW");

  message.append("    </Service>   </Receiver></ns0:Receivers>");

  out.write(message.toString().getBytes(""));

  trace.addInfo("AFTER OUT HAS WRITTENS -STEP 6 ");

  }catch (Exception e)

  {

  }

  System.out.println(message);

  }

  public void setParameter(Map param) {

  // TODO Auto-generated method stub

   this.map = param;

  }

  @Override

  public void transform(TransformationInput arg0, TransformationOutput arg1)

  throws StreamTransformationException {

this.execute(arg0.getInputPayload().getInputStream(),arg1.getOutputPayload().getOutputStream());

  }

}

Appreciate your further inputs!


Regards,

Senthil

Message was edited by: Senthil Kumar

iaki_vila
Active Contributor
0 Kudos

Hi Senthil,

The problem is the apostrophe character in the file, you need to skip its processing.


Regards,

Former Member
0 Kudos

Hi,

No luck I just tried with only below date in the EDI file. still the same error.

UNB+UNOC:2:XXX:ZZZ+003708183569+131202:1657+XXX0000000010

Thanks,

Senthil.

Message was edited by: Senthil Kumar

anupam_ghosh2
Active Contributor
0 Kudos

Hi Senthil,

                    When you are testing the code in local system are you getting same exception?

Could you please post/email me a sample file to tset your code. Also please mention the rules of the file content based on which you are determining the receiver.

Regards

Anupam

manikandan_shanmugam3
Active Participant
0 Kudos

HI Anupam,

Code is running fine in Eclipse and it creates a target xml sucessfully.

Regards,

Mani

Former Member
0 Kudos

Hi Anupam,

Sorry for the delay! when tested in eclipse the code is working fine and also working fine from Operating Mapping where the target node had been populated with the receiver value based on the input file.

I guess there is an issue with below set of code

  message.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n" );
  message.append("<ns0:Receivers xmlns:ns0=\"http://sap.com/xi/XI/System\">" + "\n");
  message.append(" <Receiver>" + "\n");
  message.append("<Party agency=\"\" scheme=\"\"/>"+"\n" );
  message.append("<Service>");

The entire code had been given in the attachment with the sample file. Appreciate your input as it is becoming a bottle-neck for the interface. And when I do test configuration for ID I am getting the same error given in snippet.

Thanks,

Senthil.

manigram
Active Participant
0 Kudos

HI

Check your message mapping first and check is there any error?

Regards,

Manigandan

Former Member
0 Kudos

Hello,

Make sure u are properly importing archives in PI, check my reply in below thread:

In addition to that, if u r using ICO then make sure that u explicitly remove SWCV entry in the ICO config.

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit,

Is is possible to get the sample file of your source?

Thanks,

Senthil.