Help me : Why do I get an unsatisfiedLinkError - jni;rmi environment

C

Chandrashekar

Hi

I wanted to make a jni call using the RMI. This is what I did :

1. I wrote an Remote interface with empty method names
2. I wrote a Remote method with a native declaration that implements
the Remote interface
3. I wrote a Server that would do the binding.
4. I wrote a Client that would instantiate the remote interface and
call the native function.

Before this, I generated the C++ header file using the Javah. It gave
me a mangled name, included that in the C++ and generated the dll.
I have ensured the Remote method has the same name as the .h file.

5. I have changed the java.policy.
6. I created LIB, LIBPATH pointed it to the drive where the .dll
resides. I even included the dll's path to path and classpath
7. Run the server and the client.
8. I am getting the following error :

ENV : Windows 2000 Professional SP4/ JDK 1.3.1_02

In the last 2 days I have browsed through a lot of pages. I am still
unable to figure out why this is happening. Please help me.

Thanks,

Chandrashekar P.

+==================================+

Exception occured while client calljava.rmi.ServerError: Error
occurred in server thread; nested exception is:
java.lang.UnsatisfiedLinkError: calcEDF
java.rmi.ServerError: Error occurred in server thread; nested
exception is:
java.lang.UnsatisfiedLinkError: calcEDF
java.lang.UnsatisfiedLinkError: calcEDF
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown
Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sam.rmitest1.kmv_business_calc_EDFCalc_Stub.getEDFValue(Unknown
Source)
at sam.rmitest1.Client.main(Client.java:23)

The following code listings are given for refrence.
====================
my Server looks like this :
//Server.java
package sam.rmitest1;

import java.rmi.Naming;

public class Server
{
public static void main(String args[])
{
// install RMI security manager

System.setSecurityManager(new SecurityManager());

// create a remote object and register it

try
{
String name = "//<ip no.>/kmv_server";
kmv_business_calc_EDFCalc1 si = new kmv_business_calc_EDFCalc1();
Naming.rebind(name, si);
}
catch (Exception e)
{
System.err.println(e);
}
}
}
=================
// Client.java
package sam.rmitest1;

import java.rmi.Naming;
import java.util.*;
public class Client
{
public static void main(String args[])
{
ArrayList a = null;
try
{
if (System.getSecurityManager() == null)
{
System.setSecurityManager(new SecurityManager());
}
String name = "//<ip.no>/kmv_server";
try
{
Search kmvRemoteObj = (Search) Naming.lookup(name);

kmvRemoteObj.getEDFValue(a);

}
catch (Exception e)
{
System.out.println("Exception occured while client call" +
e.toString());
e.printStackTrace();
}

}
catch (Exception e)
{
System.out.println("From the EDFCalc_Main " + e.toString());
e.printStackTrace();
}
}
}
=========================
Remote interface

//Search.java
package sam.rmitest1;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;

public interface Search extends Remote
{
public String getString() throws RemoteException;
public void getEDFValue(ArrayList ArrayListInput) throws
RemoteException;
}

====================
Remote object that implements the Interface

package sam.rmitest1;

import java.rmi.server.UnicastRemoteObject;
import java.rmi.RemoteException;
import java.util.*;

public class kmv_business_calc_EDFCalc1 extends UnicastRemoteObject
implements Search
{

// load C/C++ shared library

static
{
System.loadLibrary("EDFInvoker");
}

// constructor

public kmv_business_calc_EDFCalc1() throws RemoteException
{
super();
}

// public remotely-callable method that finds an entry

public String getString()
{
return "abcd";
}

// native C++ method to actually look up an entry

private native double[] calcEDF
(
<parameters list>
);

public void getEDFValue(ArrayList ArrayListInput)
{
try
{
kmv_business_calc_EDFCalc1 objKMV = new
kmv_business_calc_EDFCalc1();
dblValue = objKMV.calcEDF
(<parameter list>);
}
catch(Exception e)
{
e.printStackTrace();
}

} // end of getEDFValue

}
+=========END OF LISTINGS===========+
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top