0
我在Glassfish上部署的Spring Web應用程序中使用System.loadLib()在我的應用程序中加載.so(jni共享庫)。 。但是當System.loadLibrary執行服務器時突然停止服務器日誌中沒有任何異常!在部署在glassfish web服務器上的spring web應用程序中使用共享庫(.so)
是什麼問題? 我的代碼:
@Controller
@RequestMapping(value = "/getdata", method = RequestMethod.POST)
public class temperatureController {
@RequestMapping(value = "/temp" , method = RequestMethod.GET)
public @ResponseBody
float getTemperature(){
System.err.print("beforeeeeeeeeeeeN");
NativeClass n = new NativeClass();
System.err.print("beforeeeeeeeeeeeLoadLib");
try {
System.loadLibrary("NativeClass");
System.err.print("LoadedintempClass");
}
catch (Throwable e){
System.err.print("not loaded in temp class");
e.printStackTrace();
}
System.err.print("afteeeeeeeerLoadLib");
float temp = n.getTemperature(); // invoke the native method
System.err.print("tttttttttt");
System.err.print(temp);
return temp ;
}
服務器日誌:
[2016-05-30T19:40:36.364+0000] [glassfish 4.1] [SEVERE] [] [] [tid: _ThreadID=27 _ThreadName=Thread-9] [timeMillis: 1464637236364] [levelValue: 1000] [[
beforeeeeeeeeeeeN]]
[2016-05-30T19:40:36.391+0000] [glassfish 4.1] [SEVERE] [] [] [tid: _ThreadID=27 _ThreadName=Thread-9] [timeMillis: 1464637236391] [levelValue: 1000] [[
beforeeeeeeeeeeeLoadLib]]