tibco or JNI runtime error: UnsatisfiedLinkError
800339Sep 1 2005 — edited Jan 21 2006hello, there:
I wanted to test the tibco queue. I started rvd and tried the following code which is a simple server, however, I got an exception like below:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Library not found: tibrvnative
at com.tibco.tibrv.Tibrv.loadNativeLibrary(Tibrv.java:355)
at com.tibco.tibrv.Tibrv.<clinit>(Tibrv.java:67)
at SimpleTestServer.<init>(SimpleTestServer.java:28)
at SimpleTestServer.main(SimpleTestServer.java:19)
from the doc it seems I need to have sth related to JNI, but I don't know what to do next. Can anyone with Tibco or JNI experience enlight me please?
Thank you very much
import com.tibco.tibrv.Tibrv;
import com.tibco.tibrv.TibrvException;
import com.tibco.tibrv.TibrvListener;
import com.tibco.tibrv.TibrvMsg;
import com.tibco.tibrv.TibrvMsgCallback;
import com.tibco.tibrv.TibrvRvdTransport;
public class SimpleTestServer implements TibrvMsgCallback{
// The subject used to define this test. Both the client and
// server must use the same subject in order to communicate.
public static final String TEST_SUBJECT = "TEST_TIBCO.CALCULATE";
// The transport to be used for listening and replying
private TibrvRvdTransport transport;
public static void main(String args[]){
try{
new SimpleTestServer();
}
catch(TibrvException e){
e.printStackTrace();
}
}
public SimpleTestServer() throws TibrvException{
// Open a native rendezvous implementation
Tibrv.open(Tibrv.IMPL_NATIVE);
// Create a transport with the default settings
transport = new TibrvRvdTransport(null, null, null);
// Create a listener to listen for queries
new TibrvListener(Tibrv.defaultQueue(), this, transport, TEST_SUBJECT, null);
System.out.println("Server is listening for reqeusts");
// Wait for rendezvous to respond with messages. In the meantime, to
// keep the application going and rendezvous active, just set a
// timed dispatch to run forever.
while(true){
try{
Tibrv.defaultQueue().timedDispatch(999);
// Create a listener to listen for queries new TibrvListener(Tibrv.defaultQueue(), this, transport, TEST_SUBJECT, null);
System.out.println("Server is listening for reqeusts");
// Wait for rendezvous to respond with messages. In the meantime, to
// keep the application going and rendezvous active, just set a
// timed dispatch to run forever.
while(true){
try{
Tibrv.defaultQueue().timedDispatch(999);
}
catch(InterruptedException e){
}
}
}
// Rendezvous makes message callbacks through this method.
// Extract parameters, compute sum and send back in a new message.
public void onMsg(TibrvListener listener, TibrvMsg msg){
try{
int a = msg.getAsInt("a",0);
int b = msg.getAsInt("b",0);
int sum = a + b;
TibrvMsg response = new TibrvMsg();
response.add("sum", sum, TibrvMsg.U32);
transport.sendReply(response, msg);
System.out.println("Query: "+a+" + "+b+" = "+sum);
}
catch (TibrvException e){
e.printStackTrace();
}
}
}