Skip to Content
0
Former Member
Feb 10, 2006 at 05:18 PM

JNI & MI 2.5

68 Views

Hello,

I'm trying to call some native code from a MI application on WM2003 SE.

<b>[NOT MI]</b>

1. Created a JAVA wrapper application to call a native DLL (in NWDS, then executing javac, javah to create a header file)

2. Created the native DLL in embedded Visual C++ 4.0

3. Copied the native DLL and the JAVA wrapper app. to a mobile device

4. Started JAVA application (using Jrun from Creme 3.26)

5. Everything worked fine, the native functions were called.

<b>[MI]</b>

1. Added the JAVA wrapper class to a MI project

2. Deployed the MI project to the mobile device

3. When I try to call the native DLL from the servlet, I get an exception:

<i>java.lang.UnsatisfiedLinkError on <method_name> </i>

I think the problem is somewhere in the Tomcat server. I've tried to put the native dll in various directories (\Windows; \MI\bin\native etc.). I've also tried to set up java.library.path in MobileEngine.config:

<i>MI.ClientInstaller.StaticCommandLine=-Of -mi -classpath '%CI_HOME%/MICI.jar' com.sap.ip.mi.ci.ClientInstaller '-home:%CI_HOME%' -Djava.library.path=\windows

</i>

<i>MI.StaticCommandLine=-mi -Of -cf MI/creme_listOfJars.txt com.sap.ip.me.core.Startup '-home:%MI_HOME%' -Djava.library.path=\windows

</i>

Despite trying anything I could think about, I'm still experiencing the problem. Pls., can anyone help? Thanks in advance!

Regards,

Marek

P.S. Which version of the tomcat server is included in MI 2.5? I think it's the 3.3 version, but I'm not sure about this.

<b>JAVA wrapper class:</b>

public class NativeWrapper {
    static {
	System.loadLibrary("OrwNat");
    }

    public static native void Func1();
    public static native void Func2();
}

<b>Servlet class:</b>

public class MIInfoClass extends AbstractMEHttpServlet implements Constants {

...

public String doHandleEvent(
		String eventName,
		HttpServletRequest request,
		HttpServletResponse response)
		throws ServletException, IOException {

...

    if (eventName.equals(EVENT_NAME_CALL)) {
        NativeWrapper.Func1();
	nextJSP = TABLEVIEW_JSP;
    }

...