Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

HELP! Can't co-create object

Help
Zap Dap
2012-02-02
2013-05-20
  • Zap Dap
    Zap Dap
    2012-02-02

    hi

    I moved from 32 bit Vista to 64 bit Windows 7 because the PC was broken. I use Java JDK 7, Groovy 1.8.4 + Scriptom. Scriptom uses Jacob. I tried three Jacob versions, including the newest one. I does not work anymore. With my Vista PC there were no problems.
    I copied both dll files to c:\windows\system32. Rebooting Windows 7 didn't help.

    This is my Groovy test script. This is a Scriptom example.

    import org.codehaus.groovy.scriptom.*

    Scriptom.inApartment
    {
      def scriptControl = new ActiveXObject("ScriptControl")
      scriptControl.Language = "JScript"
      println scriptControl.Eval('2.0 + 2.0;')
    }

    I started it in Eclipse Indigo and got:

    Caught: org.codehaus.groovy.scriptom.ActiveXObject$CreationException: Could not create ActiveX object: 'ScriptControl'; Can't co-create object
    org.codehaus.groovy.scriptom.ActiveXObject$CreationException: Could not create ActiveX object: 'ScriptControl'; Can't co-create object
    at TestWindow2$_run_closure1.doCall(TestWindow2.groovy:5)
    at TestWindow2$_run_closure1.doCall(TestWindow2.groovy)
    at TestWindow2.run(TestWindow2.groovy:3)
    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)
    … 3 more

    Same error with my Groovy code. (My .NET  COM-capable DLL was registered by me using REGASM). There's nothing to register with REGSVR32.
    I've found no solution for this problem in the web. Help!

    Regardz

     
  • MJW
    MJW
    2012-02-02

    Are you running a 64 bit JDK on your new machine? The DLLs are 32 bit, so you'll need to run a 32 bit JDK.  You might also want to try turning off User Account Control ( http://en.wikipedia.org/wiki/User_Account_Control ) in case it is interfering with the process.

     
  • Zap Dap
    Zap Dap
    2012-02-03

    Using JRE6 32 bit and copying the jacob dll from windows\system32 to the Java project folder makes the Groovy script work again. Thank you. :-)
    But my program does not work. I change everything (even Eclipse) to 32 bit and Java 6.

    I wonder why Jacob does not work with 64 bit because there is a jacob x64 dll available.

     
  • Zap Dap
    Zap Dap
    2012-02-03

    Oh no, installing Eclipse 32 bit with all plugins again is too much work.
    Now I looking for a solution for the "Unsupported major.minor version 51.0" problem…

     
  • Zap Dap
    Zap Dap
    2012-02-03

    Now there is only JRE 7 64 bit installed. No other Java JRE or JDK. Eclipse works. A simple Java class can be started. But Scriptom (Jacob) based Code does not work.

    Is there a way to use Jacob with Java 7 64 bit?

     
  • MJW
    MJW
    2012-02-03

    Sorry, I haven't yet tried the 64 bit solution. One thing to verify is that you do in fact have the 64 bit dll in the classpath, and that you do not also have the 32 bit version in the classpath (at an earlier discovery location).

     
  • Zap Dap
    Zap Dap
    2012-02-03

    Now I have only jacob-1.16-M2-x64.dll in the Java project folder and no Jacob file in windows\system32. It doesn't work:
    Exception in thread "main" org.codehaus.groovy.scriptom.ActiveXObject$CreationException: Could not create ActiveX object: '…….'; Can't co-create object
    at org.codehaus.groovy.scriptom.ActiveXObject.<init>(ActiveXObject.java:147)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:54)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
    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 org.codehaus.groovy.scriptom.ActiveXObject.<init>(ActiveXObject.java:142)

     
  • MJW
    MJW
    2012-02-03

    Make sure you're using the 64 bit scriptom DLL. And, if you're in an application server environment, you need to put the DLLs in the common classloader area so that only a single instance is used across all applications (at least, that's the case for jacob dll).

     
  • Zap Dap
    Zap Dap
    2012-02-04

    There are no Scriptom 1.6.0 DLLs - only JARs. And there is only one Scriptom. No difference is made between 32 and 64 bit.

    I use Scriptom on client side.

     
  • clay_shooter
    clay_shooter
    2012-05-22

    Can you submit a change request with your Dispatch.cpp change in stackoverflow?  I'd like to add that extra debug output to the next release.

     
  • clay_shooter
    clay_shooter
    2012-05-22

    You shouldn't have to copy DLLs.  I'd think you should search to make sure it's not picking up the wrong versions. 

    You actually changed a couple things, OS, possibly security setup and maybe moved your app from 32 bit to 64 bit.  I had a problem where I'd moved from 32bit to 64bit windows install and my demo broke because I'd installed 64 bit Office instead of 32 bit.

     
  • Zap Dap
    Zap Dap
    2012-05-22

    hi r3

    my status hasn't changed. I still got the problem. My software is built with 32 bit JDK. But I use 64 bit Eclipse.

    greetz

     
  • Zap Dap
    Zap Dap
    2012-05-22

    … and it works with 32 bit.