Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

java.lang.NullPointerException - Trace in Java Mapping

$
0
0

Hi,

 

How to resolve this error ????

 

I am executing below code in Eclipse.

 

 

 

package com.sap.integration.sfsf;

 

 

import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.File;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.OutputStream;

import java.io.OutputStreamWriter;

import java.util.HashMap;

import java.util.Map;

import javax.xml.parsers.DocumentBuilder;

import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;

import org.w3c.dom.Element;

import org.w3c.dom.Node;

import org.w3c.dom.NodeList;

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

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

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

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

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

 

 

public class PassThrough implements StreamTransformation

{

 

                    //private Map param = null;

    private AbstractTrace trace = null;

 

 

              public void setParameter(Map param)

              {

               this.trace = (AbstractTrace) param.get(StreamTransformationConstants.MAPPING_TRACE);

              }

 

 

 

          public void execute(InputStream arg0, OutputStream arg1) throws StreamTransformationException

      {    

 

                       //AbstractTrace trace = (AbstractTrace)params.get(StreamTransformationConstants.MAPPING_TRACE);

               //trace = (AbstractTrace)param.get(StreamTransformationConstants.MAPPING_TRACE);

               trace.addInfo("Processing message Starts. Execute Method.");

                 System.out.println("Processing message Starts. Execute Method.");

 

      }

 

 

      public static void main(String[] args)

      {

          try

          {       

           InputStream in = new FileInputStream(new File("K:/QueryOperation.xml"));     

           OutputStream out = new FileOutputStream(new File("K:/Output.xml"));      

           PassThrough myMapping = new PassThrough();

           myMapping.execute(in, out);

          }          

          catch (Exception e)

          {     

             e.printStackTrace();   

          }

      }

 

 

}


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>