cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Java mapping(jdk1.4.2) on PI 7.0

Former Member
0 Kudos

Hi All

Need quick help!! As i need to complete this requirement on priority.

In Java mapping I have included code for Converting input file to Base64,Read Dynamic file name,Map file name to few fields and read Date and convert from YYYYMMDDHHMISS to "YYYY-MM-DDTHH:MI:SS"

I see only one warning "The type StreamTransformation is deprecated"

But as per this link we can still use StreamTransformation. Please help me ..... This is blocking me to test the scenario.

http://help.sap.com/javadocs/pi/sp3/xpi/com/sap/aii/mapping/api/StreamTransformation.html

However I exported with warnings and when I execute the scenarion in interface mapping aswell as in SXMB_MONI I see error.

In MONI:

Java mapping base64/Base64encode has thrown a StreamTransformationException.

In Interface mapping:

Start of test

  • Call method execute of the application Java mapping base64.Base64encode
  • Java mapping base64/Base64encode has thrown a StreamTransformationException.
  • com.sap.aii.mapping.api.StreamTransformationException: java.lang.NullPointerException: while trying to invoke the method java.lang.String.split(java.lang.String) of a null object loaded from local variable 'fileName'

Regards

Anitha

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Thank you Frederik

Thats correct!! Also I have removed .PDF from file name and I can see message processing successfully.

String date = arr[3].toLowerCase().replaceAll(".pdf","");//It will remove the file extension part from fourth token

Hence closing the thread.

Regards

Anitha

Answers (10)

Answers (10)

0 Kudos

Trace:

<Trace level="1" type="T">Java mapping base64/Base64encode has thrown a StreamTransformationException. </Trace>
<Trace level="1" type="T">com.sap.aii.mapping.api.StreamTransformationException: java.lang.IllegalArgumentException: Illegal pattern character 'Y'
at base64.Base64encode.execute(Base64encode.java:59)
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.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:331)

Former Member

Hi Anitha,

your root cause for the exception is the following:

java.lang.IllegalArgumentException: Illegal pattern character 'Y'

and it is thrown while the creation of your SimpleDateFormat.

Please take a look into the Java 1.4 Documentation of SimpleDateFormat.

The correct initialization of your SimpleDateFormat would be:

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

Kind Regards

Frederik

0 Kudos

Hi Evgeniy.. Please find attached screen.

former_member190293
Active Contributor
0 Kudos

What is the error messge shown in monitor?

Regards, Evgeniy.

0 Kudos

Hi Evgeniy

Sorry the error messages which you see is from Operational mapping(when I tested only mapping).

But in MONI there is no such error and I can see file name in DC of MONI.

so I suspect problem is here while reading 4th string(date&time) and converting to required format (YYYY-MM-DDTHH:MI:SS) and omit .pdf from file name.

Please help me!!

Regards

Anitha

former_member190293
Active Contributor
0 Kudos

Hi Anitha!

As I could see from error message:

java.lang.NullPointerException: while trying to invoke the method java.lang.String.split(java.lang.String) of a null object loaded from local variable 'fileName'

String.split() method raises exception because 'fileName' variable is null.

You can easily check it up: just comment DC part of your code and set any constant value to fileName variable in your code. If no error is raised - your variable gets wrong value (null) from DC.

Regards, Evgeniy.

0 Kudos

Hi Evgeniy

I think problem is here while reading 4th string(date&time) and converting to required format (YYYY-MM-DDTHH:MI:SS) and omit .pdf from file name.

Please help me to resolve this and correct me if wrong.

Regards

Anitha

Former Member
0 Kudos

Hi Evgeniy

I think its going wrong here while reading fourth token(date&time) from file name: 3003222742_6989_6220860905800023_20170117153350.PDF

String arr[] = fileName.split("_"); //it will split the string into multiple token
String InvoiceNumber = arr[0]; //it will take the first token
String MerchantNumber = arr[1]; // second token
String CardNumber = arr[2]; //Third token
//String date = arr[3];
Date yourDate = new Date();
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("YYYY-MM-DDTHH:MI:SS");
String date = DATE_FORMAT.format(yourDate);

Former Member
0 Kudos

Hi Evgeniy

I see in MONI dynamic configuration is performed.

<SAP:DynamicConfiguration SOAP:mustUnderstand="1" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SAP="http://sap.com/xi/XI/Message/30"><SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">3003222742_6989_6220860905800023_20170117153350.PDF</SAP:Record></SAP:DynamicConfiguration>

Former Member
0 Kudos

Hi Evgeniy

I have already checked the File Name box in ASMA parameters of sender file channel.

Please let me know if I missed anything.

former_member190293
Active Contributor
0 Kudos

Hi Anitha!

Did you read my answer in previous thread?

Your fileName variable is null. This means that you didn't get "FileName" attribute from Dynamic Configuration. Did you set required ASMA parameters to store file name to DC in file sender channel?

Error you get doesn't depends on your JRE version.