Glassfish War 部署 JAR 未加载
我有一个非常烦人的问题。
所以我想在我的 java web 应用程序中包含 2 个 jar 文件(.war 文件) - 加载到 glassfish 版本 2.1 上。
这些文件是:
axis2-adb-1.4.1.jar 和 wstx-asl-3.2.4.jar。
在我的控制台应用程序中,我只需将它们添加到我的类路径中,它们就可以正常运行。但是,当我将其部署到 glassfish 时(jar 放置在 WEB-INF/lib/ 中),我得到以下信息:
java.lang.reflect.InitationTargetException
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: 无法调用 getTypeObject 扩展映射器类中的方法
我注意到在我的控制台应用程序中,当我从类路径中删除 wstx-asl-3.2.4.jar
时,我会得到完全相同的错误。所以我的感觉是这个罐子没有加载。
然后我继续将罐子重新包装在一起。我制作了这个大 axis2+wstx.jar 并将其加载到我的 glassfish 项目中。同样的错误...它肯定正在加载,因为如果没有 axis2 jar,它会更早地抛出 axis2 class not def 异常。
所以我的理论是 glassfish 正在延迟加载 jar,并且由于 axis2 jar 和我的主程序都不需要这个 wstx jar,因此它没有正确加载。但我可能完全错了。
我真的希望有人能帮助我解决这个问题。
I have a very annoying problem.
So I want to include 2 jar files in my java web application (.war file) - to be loaded on glassfish version 2.1.
The files are:
axis2-adb-1.4.1.jar
and wstx-asl-3.2.4.jar
.
In my console application, I simply add these to my classpath and they run fine. However, when I deploy this to glassfish (jars are placed in WEB-INF/lib/
) I get this:
java.lang.reflect.InvocationTargetException
org.apache.axis2.AxisFault:
org.apache.axis2.databinding.ADBException:
Can not invoke the getTypeObject
method in the extension mapper class
I noticed that in my console application, when I removed wstx-asl-3.2.4.jar
from my classpath, I would get this exact same error. So my feeling is that this jar is not loaded some how.
I then moved on to repackaging the jars together. I made this big axis2+wstx.jar and loaded it into my glassfish project. Same error... It is definately loading since without the axis2 jar it would throw a axis2 class not def exception way earlier.
So my theory is that glassfish is loading the jars lazily and since neither the axis2 jar nor my main program requires this wstx jar, it is not loaded correctly. But I am probably totally wrong.
I really hope someone could help me out with this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 GF v2 b49 开始,Woodstox 与 sjsxp 仍然是默认解析器。要启用 Woodstox,请在服务器端设置以下系统属性:
更多详细信息,请参见 Glassfish v2 中的 Woodstox。
如果使用集成的 Woodstox 不能满足您的要求,那么可以尝试通过设置
delegate="false 来激活
。像这样的东西:sun-web.xml
文件中的“类加载委托功能”class-loader
元素中的“Starting with GF v2 b49, Woodstox is integrated as part of Glassfish along with sjsxp which remains the default parser. To enable Woodstox set the following system properties on the server side:
More details in Woodstox in Glassfish v2.
If using the integrated Woodstox doesn't meet your requirements, then maybe try to activate the "class loading delegation feature" in the
sun-web.xml
file by setting by settingdelegate="false"
in theclass-loader
element. Something like that:我认为两个罐子里都有相同的类。并且以某种方式首先加载没有 getTypeObject 方法的类。如果有机会更改类路径中加载的 jar 的顺序,那将会有所帮助。
I think that there is the same class in both of jars. And somehow class without getTypeObject method is loaded as first. If there is chance to change the order of loaded jars in classpath it would help.