tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dennis ch <>
Subject JNI error under tomcat: java.lang.UnsatisfiedLinkError
Date Fri, 02 Jul 2010 07:46:32 GMT

I have a java class ( that invokes a native method in an so file
(, using SWIG 1.3.29 to generate JNI code/wrapper and compiled
the library). I can use System.loadLibrary() to load the without
any error (-Djava.library.path=/usr/lib), and the native method initModel()
works fine as a standalone application.

However, when I deploy it as a web service (tomcat 6.0.26 + axis2 1.5.1 +
eclipse jee helios) to call the native method, I got the following error
(the first line means the .so was successfully loaded):

Load library successfully

[ERROR] com.model.modelJNI.initModel()V
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(
    at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(
    at org.apache.axis2.engine.AxisEngine.receive(
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(
    at org.apache.axis2.transport.http.AxisServlet.doPost(
    at javax.servlet.http.HttpServlet.service(
    at javax.servlet.http.HttpServlet.service(
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    at org.apache.catalina.core.StandardWrapperValve.invoke(
    at org.apache.catalina.core.StandardContextValve.invoke(
    at org.apache.catalina.core.StandardHostValve.invoke(
    at org.apache.catalina.valves.ErrorReportValve.invoke(
    at org.apache.catalina.core.StandardEngineValve.invoke(
    at org.apache.catalina.connector.CoyoteAdapter.service(
    at org.apache.coyote.http11.Http11Processor.process(
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Caused by: java.lang.UnsatisfiedLinkError: com.model.modelJNI.initModel()V
    at com.model.modelJNI.initModel(Native Method)
    at com.model.model.initModel(
    ... 25 more

Below is the body of

import com.model.*;

public class Eval {

  static void loadModel() {

    try {

        System.out.println("Load library successfully");

    } catch (UnsatisfiedLinkError e) {

        System.err.println("Native code library failed to load." + e);

  public void run() {


Do I miss anything here?  Any input is appreciated!


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message