基于jfinal调用大华SDK

十一月 26, 2020 2:18:04 下午 com.jfinal.core.ActionHandler error
严重: /hello
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at com.jfinal.aop.Invocation.invoke(Invocation.java:87)
	at com.jfinal.core.ActionHandler.handle(ActionHandler.java:82)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:492)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:165)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1195)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:654)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:317)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.jfinal.aop.Invocation.invoke(Invocation.java:73)
	... 19 more
Caused by: java.lang.NoClassDefFoundError: com/sun/jna/Library
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3245)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1416)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1920)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1794)
	at controller.DHUtils.<clinit>(DHUtils.java:18)
	at controller.HelloController.index(HelloController.java:15)
	... 24 more
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Library
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1951)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1794)
	... 33 more

各位大神好,我在调用大华SDK时,已经将大华提供的dll文件使用System.loadLibrary("xxxx");引入,然后调用大华的NetSDKLib接口时报出以上错误,本人从未使用过第三方SDK,不知是代码问题还是我的调用流程有问题,往各位大神指导!

评论区

杜福忠

2020-11-27 09:17

Caused by: java.lang.ClassNotFoundException: com.sun.jna.Library

马小酱

2020-11-27 10:20

你得找jar文件,dll文件时cs程序的

海哥

2020-11-27 12:16

添加下 jna 依赖

热门分享

扫码入社