Discussions

EJB design: JNI call from EJB Session Bean

  1. JNI call from EJB Session Bean (2 messages)

    Hi, I need to call a 3rd party C++ api which is in a Shared library, from my stateless session bean flow. I am using weblogic and Websphere I know that EJB specs does not recommend laoding native libraries. Still, I plan to design in such a way that the native methods will be called directly from my flowcontroller. This is because we are never going to shift platform in near future. I did some testing, and found that the library loading fails by saying it is not in java.libraray.path. Eventhough, it is in LD_LIBRARY_PATH. Anyone knows whether is is supported to load a library from session bean flow? Should i load in StartUp class? If this is not supported, i may need to change the design to do RMI from EJB, and then load and call native APIs from there. Can anyone suggest a good design for this Any help is appreciated. Kindly request to share some toughts Thanks
  2. Re: JNI call from EJB Session Bean[ Go to top ]

    Use System.load(String) function to load DLL's from a absolute destination. Some examples http://www.inonit.com/cygwin/jni/helloWorld/load.html How to agree this with EJB's in a Application Server is out of my mind. I think to accessing files from an EJB directly is not a good idea. Maybe writing an own ResourceAdpater can help. See http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1//index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/cdat_resourcead.html Best Regards Matthias
  3. Thanks Matthias, After using system.load, i think it is better now. It tried loading the library. It looks better now. The failure now is more related to the format. It is something else i guess. Exception in thread "main" java.lang.UnsatisfiedLinkError: /custom/lib/libcrpr9FlLoader.sl: specified file is not a shared library, or a format error was detected. at java.lang.ClassLoader$NativeLibrary.load(Native Method)