users@glassfish.java.net

Glassfish/JNI : java.lang.UnsatisfiedLinkError

From: <forums_at_java.net>
Date: Fri, 16 Sep 2011 03:50:21 -0500 (CDT)

Hi,
I am trying to use a C++ library, wrapped with JNI, in an EJB application
deployed in Glassfish 3.
Actually, I have 3 files :
* QuantLib.lib : a C++ static library containing the business C++ code.
* QuanlibJNI.dll : a C++ dynamic library containg the JNI wrappers for the
former lib.
* quantlib.jar : a jar containing java wrappers for the JNI classes.
I put all of in the C:\glassfishv3\glassfish\lib directory.
I added a static block in the EJB code to load QuanlibJNI.dll like this :
  static {
    System.loadLibrary("QuanlibJNI");
  }
  The library seems to be properly loaded (there is no execptions).
  But when calling the a JAVA wrapper, which calls a JNI C++ wrapper, I have
a UnsatisfiedLinkError error.
  The full statcktrace is hereunder.
 
  On the other hand, when accessing the same classes with a simple java
main, it works well !
 
  Could you please help me ?
 
  Thanks,
  T.
 
javax.ejb.EJBException
    at
com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5119)
    at
com.sun.ejb.containers.BaseContainer.checkExceptionNoTx(BaseContainer.java:4948)
    at
com.sun.ejb.containers.BaseContainer.checkExceptionBeanMgTx(BaseContainer.java:4869)
    at
com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4769)
    at
com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2004)
    at
com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955)
    at
com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:208)
    at
com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:75)
    at $Proxy243.buildZeroCouponCurve(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie.dispatchToMethod(ReflectiveTie.java:146)
    at
com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:176)
    at
com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:682)
    at
com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:216)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1841)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1695)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1078)
    at
com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:221)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:797)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:561)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2558)
    at
com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:492)
    at
com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:528)
Caused by: java.lang.UnsatisfiedLinkError:
org.quantlib.QuantLibJNI.new_SimpleQuote(D)J
    at org.quantlib.QuantLibJNI.new_SimpleQuote(Native Method)
    at org.quantlib.SimpleQuote.<init>(SimpleQuote.java:39)
    at
com.ibaz.core.data.services.marketdata.yieldcurves.impl.YieldCurveCalculationServiceImpl.buildDepositRateHelper(YieldCurveCalculationServiceImpl.java:79)
    at
com.ibaz.core.data.services.marketdata.yieldcurves.impl.YieldCurveCalculationServiceImpl.buildZeroCouponCurve(YieldCurveCalculationServiceImpl.java:154)
    at
com.ibaz.core.data.services.marketdata.yieldcurves.impl.YieldCurveService.buildZeroCouponCurve(YieldCurveService.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056)
    at
org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128)
    at
com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5292)
    at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
    at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
    at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
    at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
    at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
    at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
    at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)
    at
com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5264)
    at
com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5252)
    at
com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:201)
    ... 19 more
   
   
   
 


--
[Message sent by forum member 'thysdrus']
View Post: http://forums.java.net/node/843720