在 Mac OS X 上通过 Web 启动部署 QT Jambi 时出现问题
我有一个用 eclipse 构建的 Java 应用程序,它使用 QTJambi。从命令行运行应用程序效果很好。
java -d32 -XstartOnFirstThread -jar MyApplication.jar someArg
然而,事实证明,尝试使用 WebStart 部署应用程序很困难。我读了很多书,似乎很多人都在 Mac OS X 上遇到问题。问题似乎是本地库没有正确加载。下面提供了堆栈跟踪。
CWindow's _nativeHide encountered error: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.javaws.Launcher.invokeMainMethod(Launcher.java:1819) Caused by: java.lang.ExceptionInInitializerError at com.trolltech.qt.QtJambiObject.(QtJambiObject.java:60) at com.engage.agentdesktop.Application.main(Application.java:25) ... 5 more Caused by: java.lang.RuntimeException: Loading library failed, progress so far: No 'qtjambi-deployment.xml' found in classpath, loading libraries via 'java.library.path' Loading library: 'libQtCore.4.dylib'... - using 'java.library.path' at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(NativeLibraryManager.java:431) at com.trolltech.qt.internal.NativeLibraryManager.loadQtLibrary(NativeLibraryManager.java:355) at com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:140) at com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:136) at com.trolltech.qt.QtJambi_LibraryInitializer.(QtJambi_LibraryInitializer.java:56) ... 7 more Caused by: java.lang.RuntimeException: Library 'libQtCore.4.dylib' was not found in 'java.library.path'=/Users/smeatonj/Desktop/Engage Agent Desktop.app/Contents/Resources/Java:/System/Library/PrivateFrameworks/JavaApplicationLauncher.framework/Resources:.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java at com.trolltech.qt.internal.NativeLibraryManager.loadLibrary_helper(NativeLibraryManager.java:486) at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(NativeLibraryManager.java:426) ... 11 more
这是 webstart.jnlp 文件的摘录:
`[resources`] `[j2se version="1.5+"/`] `[jar href="${MEDIA_URL}application/webstart/MyApplication.jar" /`] .... `[jar href="${MEDIA_URL}application/webstart/MyApplication_lib/qtjambi-4.5.2_01.jar" /`] `[resources os="Mac OS X"`] `[j2se version="1.5+" java-vm-args="-d32 -XstartOnFirstThread"/`] `[jar href="${MEDIA_URL}application/webstart/MyApplication_lib/qtjambi-macosx-gcc-4.5.2_01.jar" /`] `[/resources`]
该错误告诉我在类路径中找不到 qtjambi-deployment.xml。我已经打开了 qtjambi-macosx-gcc-4.5.2_01.jar,那里肯定有 qtjambi-deployment.xml 文件。
资源 os="Max OS X" 节点肯定是由 JNLP 加载的,因为在此之前我收到了不同的错误,要求我将 -d32 放入 vm 参数中。有谁知道到底是什么原因导致这个错误?
编辑:
当网络启动到 Windows 时,应用程序运行良好。
I have a Java application, built with eclipse, that uses QTJambi. Running the application from the command line works perfectly.
java -d32 -XstartOnFirstThread -jar MyApplication.jar someArg
However, trying to deploy the application with WebStart is proving difficult. I've done a whole lot of reading and it seems many people have issues getting this to work on Mac OS X. The issue seems to be that the native libraries aren't being correctly loaded. The stack trace is provided below.
CWindow's _nativeHide encountered error: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.javaws.Launcher.invokeMainMethod(Launcher.java:1819) Caused by: java.lang.ExceptionInInitializerError at com.trolltech.qt.QtJambiObject.(QtJambiObject.java:60) at com.engage.agentdesktop.Application.main(Application.java:25) ... 5 more Caused by: java.lang.RuntimeException: Loading library failed, progress so far: No 'qtjambi-deployment.xml' found in classpath, loading libraries via 'java.library.path' Loading library: 'libQtCore.4.dylib'... - using 'java.library.path' at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(NativeLibraryManager.java:431) at com.trolltech.qt.internal.NativeLibraryManager.loadQtLibrary(NativeLibraryManager.java:355) at com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:140) at com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:136) at com.trolltech.qt.QtJambi_LibraryInitializer.(QtJambi_LibraryInitializer.java:56) ... 7 more Caused by: java.lang.RuntimeException: Library 'libQtCore.4.dylib' was not found in 'java.library.path'=/Users/smeatonj/Desktop/Engage Agent Desktop.app/Contents/Resources/Java:/System/Library/PrivateFrameworks/JavaApplicationLauncher.framework/Resources:.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java at com.trolltech.qt.internal.NativeLibraryManager.loadLibrary_helper(NativeLibraryManager.java:486) at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(NativeLibraryManager.java:426) ... 11 more
This is an extract of the webstart.jnlp file:
`[resources`] `[j2se version="1.5+"/`] `[jar href="${MEDIA_URL}application/webstart/MyApplication.jar" /`] .... `[jar href="${MEDIA_URL}application/webstart/MyApplication_lib/qtjambi-4.5.2_01.jar" /`] `[resources os="Mac OS X"`] `[j2se version="1.5+" java-vm-args="-d32 -XstartOnFirstThread"/`] `[jar href="${MEDIA_URL}application/webstart/MyApplication_lib/qtjambi-macosx-gcc-4.5.2_01.jar" /`] `[/resources`]
The error tells me that qtjambi-deployment.xml is not found in the classpath. I've opened up qtjambi-macosx-gcc-4.5.2_01.jar and there is definitely the qtjambi-deployment.xml file there.
The resources os="Max OS X" node is definitely being loaded by the JNLP, because I was receiving different errors before that required me to put -d32 into the vm args. Does anyone know what the hell could be causing this error?
Edit:
The application runs fine when webstarting to Windows.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于后来的人,这是我们发现的有关通过 Webstart 将 Jambi 部署到 Mac OS X 的信息
。从 Webstart 安装/启动时找不到 qtjambi-macosx-gcc-4.5.2_01。如果这个库在您的路径上,webstart 就能够找到它并使用它,并且将正确启动。此外,还有一些 JNLP 属性需要设置。
com.trolltech.launcher.webstart 属性需要通知 Jambi 库我们正在通过 webstart 启动,并以允许 webstart 工作的方式配置自身。不幸的是,目前它在 mac os x 上已经被破坏了。
QTJambi Community Port to 4.6 解决了上述问题,但引入了一个新问题。
http://qt.gitorious.org/qt-jambi/community-端口到4_6
http://sourceforge.net/apps/trac/qtjambi/ticket/37
我也调查了这个错误,它需要更改一行代码才能工作,即更改类加载器以与 webstart(更安全的类加载器)配合良好。我还没有尝试过,因为构建系统非常令人反感并且没有时间进行适当的调查。
因此,如果您在 Mac OSX 上使用 Webstart 部署 QT Jambi 应用程序时遇到问题,您现在知道原因了。如果有人愿意更改 4.6,请在此处发帖并更新此信息。或者,如果我有时间更改它,我也会在这里发布。
有用的参考:
http://doc .qt.nokia.com/qtjambi-4.3.5_01/com/trolltech/qt/qtjambi-systemproperties.html
For those that come after, this is the information that we discovered about deploying Jambi via webstart to Mac OS X.
qtjambi-macosx-gcc-4.5.2_01 can not be found when installing/launching from webstart. If this library is on your path, webstart is able to find it and use it, and will launch correctly. Further, there are some JNLP properties that need to be set.
The property com.trolltech.launcher.webstart is required to inform the Jambi libraries that we are starting via webstart, and to configure itself in such a way that allows webstart to work. Unfortunately, it's broken for mac os x at this point in time.
The QTJambi Community Port to 4.6 solves the above problem, but introduces a new problem.
http://qt.gitorious.org/qt-jambi/community-port-to-4_6
http://sourceforge.net/apps/trac/qtjambi/ticket/37
I've investigated this bug as well, and it requires changing one line of code to get working, namely, changing the class loader to play nice with webstart (more secure class loader). I haven't attempted yet, due to the build system being quite off putting and not having the time to investigate properly.
So, if you're having troubles deploying QT Jambi applications with webstart on Mac OSX, you now know why. If anyone gets around to changing 4.6, please post here and update this information. Alternatively, if I get around to changing it, I'll post here also.
Useful references:
http://doc.qt.nokia.com/qtjambi-4.3.5_01/com/trolltech/qt/qtjambi-systemproperties.html