Java 高级成像不适用于 Mac 上 Glassfish 中的 EJB 模块,但显示在 EAR 中
我正在开发一个使用 Geotools 的应用程序,该应用程序又使用 Java 高级成像 (JAI) API 在 Glassfish 下运行。当我从 Netbeans 作为 EJB jar 文件运行应用程序时,由于 CDI 扫描期间出现 ClassNotFoundException,它无法部署:
com.google.common.collect.ComputationException: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class org.autogena.skyserver.data.filetypes.SwathFile
at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:218)
....
Caused by: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class org.autogena.skyserver.data.filetypes.SwathFile
at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:189)
.....
Caused by: java.lang.NoClassDefFoundError: javax/media/jai/PropertySource
at java.lang.ClassLoader.defineClass1(Native Method)
....
Caused by: java.lang.ClassNotFoundException: javax.media.jai.PropertySource
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
但是,如果我将 EJB 模块打包到 EAR 文件中,那么我不会收到上面的异常,并且它似乎会加载好的。
由于在 Mac 上,JAI 核心类位于系统扩展库中,我很困惑它为什么没有显示在类路径上。
在类加载方面,EJB jar 和 EAR 文件之间是否有区别,或者这在 Glassfish / Weld 中是一个很大的区别吗?
想想看 - glassfish 是如何找到我的项目使用的库的 - 它们似乎没有被打包到 ejb jar 文件中 - netbeans 是否在幕后做了一些聪明的事情,但不知何故出现了偏差?
谢谢, 乔什
I'm developing an application that uses the Geotools, which in turn uses the Java Advanced imaging (JAI) API to run under Glassfish. When I run my application from Netbeans as an EJB jar file it fails to deploy because of a ClassNotFoundException during CDI scanning :
com.google.common.collect.ComputationException: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class org.autogena.skyserver.data.filetypes.SwathFile
at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:218)
....
Caused by: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class org.autogena.skyserver.data.filetypes.SwathFile
at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:189)
.....
Caused by: java.lang.NoClassDefFoundError: javax/media/jai/PropertySource
at java.lang.ClassLoader.defineClass1(Native Method)
....
Caused by: java.lang.ClassNotFoundException: javax.media.jai.PropertySource
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
However, if I package the EJB module into an EAR file then I don't get the exception above and it seems to load ok.
Since on the Mac the JAI core classes are in the system extension library I'm baffled how it's not showing up on the classpath.
Is there a difference between an EJB jar and and EAR file when it comes to class loading, or is this a big in Glassfish / Weld?
Come to think of it - how is glassfish finding the libraries my prject uses anyway - they don't seem to be packaged into the ejb jar file - is netbeans doing something clever under the hood here that's going somehow askew?
thanks,
Josh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在 Glassfish 上配置 CLASSPATH 以便使用 JAI 库。
Try to configure the CLASSPATH on Glassfish in order to use the JAI libraries.