com.jacob.com.ComFailException:无法共同创建对象 [英] com.jacob.com.ComFailException: Can't co-create object

查看:469
本文介绍了com.jacob.com.ComFailException:无法共同创建对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用侨光加载体系认证。它的工作很好,当我使用运行code 公共静态无效的主要(字符串ARGS [])或者说简单的Java程序,但是当我尝试使用运行code小程序我收到提示如下...

  com.jacob.com.ComFailException:无法共同创建对象
    在com.jacob.com.Dispatch.createInstanceNative(本机方法)
    在com.jacob.com.Dispatch<&初始化GT;(Dispatch.java:99)
    在com.jacob.activeX.ActiveXComponent<&初始化GT;(ActiveXComponent.java:58)
    在com.digicorp.root.SystemWrapper $ 1.run(SystemWrapper.java:23)
    在java.security.AccessController.doPrivileged(本机方法)
    在com.digicorp.root.SystemWrapper<&初始化GT;(SystemWrapper.java:19)
    在com.digicorp.applet.DigitalCertificateApplet.ActiveXObject(DigitalCertificateApplet.java:56)
    在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
    在sun.reflect.NativeMethodAccessorImpl.invoke(来源不明)
    在sun.reflect.DelegatingMethodAccessorImpl.invoke(来源不明)
    在java.lang.reflect.Method.invoke(来源不明)
    在sun.plugin.javascript.Trampoline.invoke(来源不明)
    在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
    在sun.reflect.NativeMethodAccessorImpl.invoke(来源不明)
    在sun.reflect.DelegatingMethodAccessorImpl.invoke(来源不明)
    在java.lang.reflect.Method.invoke(来源不明)
    在sun.plugin.javascript.JSClassLoader.invoke(来源不明)
    在sun.plugin2.liveconnect.JavaClass $ MethodInfo.invoke(来源不明)
    在sun.plugin2.liveconnect.JavaClass $ MemberBundle.invoke(来源不明)
    在sun.plugin2.liveconnect.JavaClass.invoke0(来源不明)
    在sun.plugin2.liveconnect.JavaClass.invoke(来源不明)
    在sun.plugin2.main.client.LiveConnectSupport $ PerAppletInfo $ DefaultInvocationDelegate.invoke(来源不明)
    在sun.plugin2.main.client.LiveConnectSupport $ PerAppletInfo $ 3.run(来源不明)
    在java.security.AccessController.doPrivileged(本机方法)
    在sun.plugin2.main.client.LiveConnectSupport $ PerAppletInfo.doObjectOp(来源不明)
    在sun.plugin2.main.client.LiveConnectSupport $ PerAppletInfo $ LiveConnectWorker.run(来源不明)
    在java.lang.Thread.run(来源不明)

我也用 HTTP: //netheadaches.word$p$pss.com/2012/04/22/jacob-cant-co-create-object/ 以解决上述问题。它解决了简单的Java程序,但同时使用的小程序同样code给错误。

有什么具体的事情我必须保持在我的脑海,而使用侨光的小程序。我使用雅各布 - 1.17

ActiveXComponent补偿=新ActiveXComponent(Encryption.LoadCertificate);

和在什么地方找到在互联网上...

  activeXObj =(ActiveXComponent)在AccessController.doPrivileged(新的PrivilegedAction<对象>()
              {
                公共对象的run()
                {
                  返回新ActiveXComponent(SystemWrapper.currentObjName);
                }
              });


解决方案

你看看小程序的例子雅各来了吗? <一href=\"http://sourceforge.net/projects/jacob-project/files/jacob-project/1.17/jacob-1.17_src.zip/download\"相对=nofollow>下载来源和看一看吧。你可以找到它:
样本\\ COM \\雅各布\\样本\\小程序。还有在那里一个readme.txt文件。它描述了所有参与使雅各运行在一个小程序的步骤。简而言之:


  1. 指定的JNLP文件的本地库(与nativelib HREF)

  2. 登入所有罐子(由于Java 1.7.0_17这已成为强制性的)

  3. 设置的权限/使用策略文件

I'm using jacob to load system certificate. Its working fine when I run code using public static void main(String args[]) or say simple Java program but when I try to run code using Applet I'm getting error as follow...

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 com.digicorp.root.SystemWrapper$1.run(SystemWrapper.java:23)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.digicorp.root.SystemWrapper.<init>(SystemWrapper.java:19)
    at com.digicorp.applet.DigitalCertificateApplet.ActiveXObject(DigitalCertificateApplet.java:56)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.plugin.javascript.Trampoline.invoke(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
    at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown Source)
    at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown Source)
    at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source)
    at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source)
    at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDelegate.invoke(Unknown Source)
    at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source)
    at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I also used http://netheadaches.wordpress.com/2012/04/22/jacob-cant-co-create-object/ to solve above problem. It solved for simple java program but while using applet same code giving error.

Is there any specific things I have to keep in my mind while using jacob for applet. I'm using jacob-1.17

ActiveXComponent comp=new ActiveXComponent("Encryption.LoadCertificate");

and found somewhere on internet...

 activeXObj = (ActiveXComponent)AccessController.doPrivileged(new PrivilegedAction<Object>()
              {
                public Object run()
                {
                  return new ActiveXComponent(SystemWrapper.currentObjName);
                }
              });

解决方案

Did you take a look at the applet example coming with Jacob? Download the source and take a look at it. You can find it in: samples\com\jacob\samples\applet. There is also a readme.txt file in there. It describes all the steps involved to make jacob run in an applet. In short:

  1. specify the native lib in the jnlp file (with nativelib href)
  2. sign all jars (since java 1.7.0_17 this has become mandatory)
  3. set the permissions / use a policy file

这篇关于com.jacob.com.ComFailException:无法共同创建对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆