cancel
Showing results for 
Search instead for 
Did you mean: 

How do I configure a Java Call Atom in B1if

dennisruenzler
Discoverer
0 Kudos

Hi,

I need some help in configuring my Java call atom. It seems I am not able to get the correct qualified classname.

The jar file has been put in the folder ..\Tomcat\webapps\B1iXcellerator\WEB-INF\lib (code of the only contained file below)

No matter what I enter as Java Class Name, I keep on getting this error:

com.sap.b1i.bizprocessor.BizProcException: BPE027 Could not obtain instance of 'Callable' class Further details: className: main/Test

Is there anything I am missing in the configuration?

Thanks a lot

package main;

import java.sql.Connection;
import java.util.Properties;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import com.sap.b1i.bizprocessor.BizProcMessage;
import com.sap.b1i.bizprocessor.BizProcMessageWithBSA;
import com.sap.b1i.bizprocessor.BizStoreAccessor;
import com.sap.b1i.bizprocessor.Callable;

public class Test implements Callable {
    private int level = 0; 
    
    public Test() {
    
    }
    @Override
    public boolean call(Properties inProps, BizProcMessage inMsg, Properties outProps, BizProcMessage outMsg, Connection conn, String jobID) throws Exception {
        if(inMsg != null && inMsg instanceof BizProcMessageWithBSA) {
            BizProcMessageWithBSA bpmbsa = (BizProcMessageWithBSA) inMsg;
            BizStoreAccessor bsa = bpmbsa.getAccessor ();
            fillProperties(outProps, bpmbsa.getXMLDOMPayload(bsa));
        }
        return false;
    }
    
    private void fillProperties(Properties prop, Document document) {
        NodeList list = document.getChildNodes();
        for (int i = 0; i < list.getLength(); i++) {
            iterateNode(prop, list.item(i));
        }
    }
    private void iterateNode(Properties prop, Node n) {
        level++;
        if(n.getNodeName()!=null&&n.getNodeName().length()>0) {
            prop.setProperty(n.getNodeName(), "level: "+level+" value: "+n.getNodeValue());
        }
        NodeList list  =    n.getChildNodes();
        for (int i = 0; i < list.getLength(); i++) {
            iterateNode(prop, list.item(i));
        }
        level--;
    }

    @Override
    public boolean isThreadSafe() {
        return false;
    }

    @Override
    public void mustDestroy() {
        
    }

    @Override
    public boolean usesJDBC() {
        return false;
    }
}

Accepted Solutions (1)

Accepted Solutions (1)

dennisruenzler
Discoverer
0 Kudos

I found my error:

In the configuration of the java atom, I wrote

#main/Test

as Java Class Name, instead it had to be

#main.Test

such a small error...

Answers (2)

Answers (2)

HuanYang
Employee
Employee
0 Kudos

Hello,

There are different ways to call Java Class.

You may use call Java atom, or use xsl code.

What you mentioned is using Call Java Atom.


Here is an example for using call java in xsl code.

Java code:

public class AddClass
{
	public static long Add(long i,long j)
	{
		return (i + j);
	}
}


XSL code:

<xsl:template xmlns:myClient="com.sap.b1i.MyClient.AddClass" name="transform">
	<AddResult>
		<x>123</x>
		<y>234</y>
		<Result>
			<xsl:value-of select="myClient:Add(123,234)"/>
		</Result>
	</AddResult>
</xsl:template>

Thanks & best regards

Huan Yang

dennis_reiner
Explorer
0 Kudos

Hi,

can you give us some atom config informations?
The Java Class name must be the fully qualified class name. Keep in mind that the jar file must be available in the integration framework base directory.

dennisruenzler
Discoverer
0 Kudos

As far as I know, the base directory should be this one:

D:\Program Files (x86)\SAP\SAP Business One Integration\IntegrationServer\Tomcat\webapps\B1iXcellerator\WEB-INF\lib

Since a lot of other B1i jars are found here, this should be right.

The relevant configuration of the java atom is this:

Java Class Name*: #main/Test
SysId*: #
Input*: #atom2/root/Payload
Parameter*: #

If needed, I can attach the jar and/or the full scenario