cancel
Showing results for 
Search instead for 
Did you mean: 

Error in Execution of Java Mapping

former_member181928
Participant
0 Kudos

I have Created a program for java mapping , created a jar and loaded it into xi.Created an interface mapping and linked that java class in the mapping prog section.

when i try to test by clicking on the start transformation button i get the following exception..

Creating Java Mapping <mapping name>

Loading Class <mapping name>

Call method execute of the application Java Mapping <mapping name>

java.lang.IllegalArgumentException null

I cant make out as to how the arg in the execute method is not proper.

Can anyone tell where can i view the entire stacktrace generated..

Please suggest

regards

Nilesh Taunk

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

<i>Can anyone tell where can i view the entire stacktrace generated..

</i>

It uses a unix like folder path, use ftp to access ur Xi server path ,

"/usr/sap/J2E/JC00/j2ee/cluster/server0/log"

Please refer a thread from java forum,

Also see,

http://help.sap.com/saphelp_nw04/helpdata/en/b7/54e63f48e58f15e10000000a155106/content.htm

You may also use visual administrator if you have access, and see the trc file,

/people/michal.krawczyk2/blog/2005/09/07/xi-why-dont-start-searching-for-all-errors-from-one-place

Or netweaver administrator,

/people/michal.krawczyk2/blog/2005/05/27/xi-netweaver-administrator--first-look--logs-traces

Hope this helps,

Anirban.

Former Member
0 Kudos

Some checkpoints :

1. Make sure the signature of execute method in your Java program is

public void execute(InputStream iStream, OutputStream oStream)throws StreamTransformationException.

2. XI runtime being the caller of your class and execute method there is no possibility of passing wrong arguments.So this seems to be error somewhere in your program only.

3. Try putting a "try-catch" in your program and printing the stacktrace.

Add the following line in your execute method.

MappingTrace trace =

(AbstractTrace) map.get(

StreamTransformationConstants.MAPPING_TRACE);

For this statement to compile make sure your class has a private variable map of type Hashmap and the method setParameter has an implementation like :

public void setParameter(Map parameter) {

map = parameter;

}

Then , in catch block you can write

trace.addInfo(e.printStackTrace());

Hope this helps.

Message was edited by: Amol Joshi

former_member181928
Participant
0 Kudos

I have Checked my prog it works file when i test it standalone...

I am pasting initial part of my code

public class OrderJavaMapping implements StreamTransformation {

/* (non-Javadoc)

  • @see com.sap.aii.mapping.api.StreamTransformation#setParameter(java.util.Map)

*/

private OutputStream out;

private Document sourceDocument = null;

private Document targetDocument = null;

public void setParameter(Map arg0) {

// TODO Auto-generated method stub

}

/* (non-Javadoc)

  • @see com.sap.aii.mapping.api.StreamTransformation#execute(java.io.InputStream, java.io.OutputStream)

*/

public void execute(InputStream in, OutputStream out)

throws StreamTransformationException {

this.out = out;

DocumentBuilder documentBuilder = null;

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

factory.setValidating(true);

factory.setNamespaceAware(true);

The signature of execute is also correct ...

Where can we see the entire Stacktrace coz the trace in the lower editor goes off immediately after giving the main error msg in a popup.

bhavesh_kantilal
Active Contributor
0 Kudos

hi,

For tracing your error, just make sure that that these 2 methods have been implemented in your mapping and along with the following variables ,

private Map map;

public AbstractTrace trace;

public void setParameter (Map param) {

map = param;

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

}

public void execute (InputStream in, OutputStream out) throws com.sap.aii.mapping.api.StreamTransformationException {

}

To trace, the following code in your catch block

catch(Exception e){

trace.addDebugMessage(e.getMessage());

}

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

For the DOM model, this is how your execute mthod should be,

<i>public void execute (InputStream in, OutputStream out)

throws com.sap.aii.mapping.api.StreamTransformationException {

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

try {

// create DOM structure from input XML

DocumentBuilder builder = factory.newDocumentBuilder();

document = builder.parse(in);

}

catc(Exception e)

{

}

}</i>

Also, this method is also <b>compulsory</b>,

<i>public void setParameter (Map param) {

map = param;

}</i>Please declare map as <b>private Map map</b>;

Do check with this and let me know if it works,

Regards,

Bhavesh

former_member181928
Participant
0 Kudos

I was able to reslove the problem.

It was because of the second line

documentBuilder = factory.newDocumentBuilder();

documentBuilder.setErrorHandler(null);

It was giving an Illegal argument exception ..I commented it and it worked in XI.Proabably it does not accept a null value..

Can you pls explain me the concept of setErrorHandler().

It was working fine in Standalone NWDS ..but the same code will not working in XI...

One more problem.

When you test the mapping you get all the message trace at the bottom of the screen.. but these messages come and vanish immediately if some error occurs.. i do not have access to the server and therefore cannot access the log files directly. Is there a web console through which i can get the stacktrce..

regards

Nilesh Taunk.

Former Member
0 Kudos

Hi Nilesh,

To view Message Trace, goto XI-Runtime workbench ->Message Monitoring ->Display (Fill selection criteria) ->Adapter Engine->Audit Log

Regards,

Ananth