NutzCN Logo
问答 连接考勤机创建对象失败
发布于 2081天前 作者 读书人 1789 次浏览 复制 上一个帖子 下一个帖子
标签:

连接考勤机的时候报错 创建ZkemSDK 失败

Exception in thread "Thread-3" 
java.lang.ExceptionInInitializerError
	at cn.webro.callcom.CourseAction.run(CourseAction.java:17)
Caused by: com.jacob.com.ComFailException: Can't co-create object
	at com.jacob.com.Dispatch.createInstanceNative(Native Method)
	at com.jacob.com.Dispatch.<init>(Dispatch.java:99)
	at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58)
	at cn.webro.callcom.ZkemSDK.<clinit>(ZkemSDK.java:14)
	... 1 more
at cn.webro.callcom.CourseAction.run(CourseAction.java:17)
ZkemSDK sdk = new ZkemSDK();

完整的

package cn.webro.callcom;


import org.nutz.ioc.Ioc;
import org.nutz.ioc.IocException;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.Mvcs;
import cn.webro.callcom.ZkemSDK;
@IocBean
public class CourseAction extends Thread{
	Ioc ioc = Mvcs.ctx().getDefaultIoc();
	final PropertiesProxy conf=ioc.get(PropertiesProxy.class,"conf");
	@Override
	public void run() {
		try {
			ZkemSDK sdk = new ZkemSDK();

			//String deviceIp = "192.168.1.202";
			String deviceIp=conf.get("deviceIp");

			//String deviceIp = "192.168.1.201";

			boolean connFlag = sdk.connect(deviceIp, 4370);
			if (connFlag) {
				sdk.regEvent(deviceIp);
				//sdk.connect("192.168.1.201", 4370); // 如果是程序调用的这里能监控到OnConnected 事件
				//System.out.println("202");
			} else {
				connFlag = sdk.connect(deviceIp, 4370);
				System.out.println("连接失败");
			}
		} catch (IocException e) {
			e.printStackTrace();
		}
	}
}

at cn.webro.callcom.ZkemSDK.(ZkemSDK.java:14)

private static ActiveXComponent zkem = new ActiveXComponent("zkemkeeper.ZKEM.1");
5 回复

没放对地方, 反正没找到

先写个main方法跑通了

好了 jdk版本不对 1.7才行

添加回复
请先登陆
回到顶部