9

使用 com4j 和 iTunes 包装器,我可以启动一个 iTunes 实例

 ClassFactory.createiTunesApp();

从我的应用程序并成功使用 api。

但是,如果 iTunes 已经独立运行,那么它会失败

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)

因为 iTunes 已经在运行,所以有没有一种方法可以连接到现有的 iTunes 实例,而不是在 iTunes 已经在运行时尝试创建一个新实例?

4

1 回答 1

-1

当前没有解决方案,因为您使用的应用程序不支持 64 位,因为它是 32 位应用程序。这个问题已经在 Xira Dashboard 中发布:https ://java.net/jira/browse/COM4J-80

想必这和其他人在客户运行 64 位且开发环境为 32 位时尝试在 Windows XP / Server 2003 及更高版本上运行时遇到的问题相同。

实际上,使用 32 位 JVM 不会出现此问题。

于 2017-04-27T18:37:45.717 回答