2008-05-21
关于jboss与j2ee1.4不友好的问题。
关键字: java.lang.linkageerror
今天在做项目的时候,来了个奇怪的异常,具体异常如下:
google了一会发现原来是jboss的类加载器的问题。因为同一个类被不同的类加载器所加载导致的,所以要按照一下步骤来修改几个配置文件就OK了。
First, edit the conf/jboss-service.xml file and set the NamingService CallByValue to true:
Second, edit the deploy/ear-deployer.xml file and set the Isolated and CallByValue attributes to true:
Last, edit the deploy/jbossweb-tomcat50.sar/META-INF/jboss-service.xml file and set the Java2ClassLoadingCompliance and UseJBossWebLoader attributes to false:
注意:如果是在jboss-4.2.1.GA下,第三步可以不用改了,默认就是false.
java.lang.LinkageError: loader constraint violation:
google了一会发现原来是jboss的类加载器的问题。因为同一个类被不同的类加载器所加载导致的,所以要按照一下步骤来修改几个配置文件就OK了。
First, edit the conf/jboss-service.xml file and set the NamingService CallByValue to true:
<mbean code="org.jboss.naming.NamingService"
name="jboss:service=Naming">
<!-- The call by value mode. true if all lookups are unmarshalled using
the caller's TCL, false if in VM lookups return the value by reference.
-->
<attribute name="CallByValue">true</attribute>
...
</mbean>
Second, edit the deploy/ear-deployer.xml file and set the Isolated and CallByValue attributes to true:
<server>
<!-- EAR deployer, remove if you are not using ear deployments -->
<mbean code="org.jboss.deployment.EARDeployer"
name="jboss.j2ee:service=EARDeployer">
<!-- A flag indicating if ear deployments should have their own scoped
class loader to isolate their classes from other deployments.
-->
<attribute name="Isolated">true</attribute>
<!-- A flag indicating if the ear components should have in VM call
optimization disabled.
-->
<attribute name="CallByValue">true</attribute>
</mbean>
</server>
Last, edit the deploy/jbossweb-tomcat50.sar/META-INF/jboss-service.xml file and set the Java2ClassLoadingCompliance and UseJBossWebLoader attributes to false:
<server>
<mbean code="org.jboss.web.tomcat.tc5.Tomcat5"
name="jboss.web:service=WebServer">
<!-- Get the flag indicating if the normal Java2 parent first class
loading model should be used over the servlet 2.3 web container first
model.
-->
<attribute name="Java2ClassLoadingCompliance">false</attribute>
<attribute name="LenientEjbLink">true</attribute>
<!-- A flag indicating if the JBoss Loader should be used. This loader
uses a unified class loader as the class loader rather than the tomcat
specific class loader.
-->
<attribute name="UseJBossWebLoader">false</attribute>
...
注意:如果是在jboss-4.2.1.GA下,第三步可以不用改了,默认就是false.
发表评论
- 浏览: 72510 次
- 性别:

- 来自: 厦门大学

- 详细资料
搜索本博客
我的相册
Head first design patterns
共 29 张
共 29 张
最近加入圈子
链接
最新评论
-
老天对中国真他妈太不公了 ...
中国的百姓真的很无辜啊!哎
-- by 小嘴冰凉 -
“cannot simultaneously ...
谢谢你,很强悍。。。
-- by lchlrb -
老天对中国真他妈太不公了 ...
天地不仁,以万物为刍狗
-- by Eastsun -
老天对中国真他妈太不公了 ...
老天,你他妈睁大眼睛看着,我们中国人怎么和你做斗争。想打垮我们,老子告诉你,门都 ...
-- by 狂放不羁 -
老天对中国真他妈太不公了 ...
什么样子的祸事都往中国头上砸,妈的。又雪灾,又胶济铁路,有512大地震,再加上法 ...
-- by 狂放不羁






评论排行榜