9

Using the com4j and iTunes wrappers i can start an instance of iTunes

 ClassFactory.createiTunesApp();

from my application and use the api successfully.

But if iTunes is already running independently then it fails with

com4j.ExecutionException: com4j.ComException: 80080005 CoCreateInstance failed : Server execution failed : .\com4j.cpp:153
    at com4j.ComThread.execute(ComThread.java:236)
    at com4j.Task.execute(Task.java:26)
    at com4j.COM4J.createInstance(COM4J.java:99)
    at com4j.COM4J.createInstance(COM4J.java:74)
    at com.jthink.songkong.itunes.ClassFactory.createiTunesApp(ClassFactory.java:16)
    at com.jthink.songkong.ituneshelper.WindowsITunesModelCreator.createITunesModelInternal(WindowsITunesModelCreator.java:42)
    at com.jthink.songkong.ituneshelper.ITunesModelCreator.createITunesModel(ITunesModelCreator.java:263)
    at com.jthink.songkong.ituneshelper.ITunesModelCreator.run(ITunesModelCreator.java:227)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: com4j.ComException: 80080005 CoCreateInstance failed : Server execution failed : .\com4j.cpp:153
    at com4j.Native.createInstance(Native Method)
    at com4j.COM4J$CreateInstanceTask.call(COM4J.java:119)
    at com4j.COM4J$CreateInstanceTask.call(COM4J.java:106)
    at com4j.Task.invoke(Task.java:50)
    at com4j.ComThread.run0(ComThread.java:172)
    at com4j.ComThread.run(ComThread.java:153)

because iTunes is already running so is there a way I can just connect to an existing iTunes instance rather than trying to create a new one if iTunes is already running ?

Paul Taylor
  • 13,411
  • 42
  • 184
  • 351

1 Answers1

-1

There is no current solution as the application you are using does not support 64-bit as its a 32-bit application. Already this problem is issued in Xira Dashboard: https://java.net/jira/browse/COM4J-80

Presumably this is the same problem as others have had when trying to run on Windows XP / Server 2003 and above when the customer is running 64-bit and the development environment is 32-bit.

Actually this problem does not occur using a 32-bit JVM.

SkyWalker
  • 28,384
  • 14
  • 74
  • 132
  • Actually you are wrong here, used to not support 64bit but has for a number of years, please see http://kohsuke.org/2012/04/27/com4j-updates/. It works fine on 64bit as long as iTunes not already open – Paul Taylor Apr 27 '17 at 20:13