“链接javax / xml / namespace / QName类时违反了加载器约束”来自Oracle 10g上的webapp [英] "loader constraints violated when linking javax/xml/namespace/QName class" from webapp on Oracle 10g

查看:795
本文介绍了“链接javax / xml / namespace / QName类时违反了加载器约束”来自Oracle 10g上的webapp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个可以部署在许多应用服务器上的Web应用程序,包括Oracle 10g。但是,在该平台上,我们遇到了类路径问题。 webapp使用JAXB 2,但Oracle 10g附带JAXB 1,这导致错误。为了解决这些问题,我们将Oracle配置为更喜欢我们的webapp中的类,但现在我们在尝试实例化JAXB上下文时遇到了上述错误。

We have a web application that can be deployed on many application servers, including Oracle 10g. On that platform, however, we are having classpath issues. The webapp uses JAXB 2, but Oracle 10g ships with JAXB 1, and this was causing errors. To get around those we configured Oracle to prefer classes in our webapp, but now we are getting the above error when attempting to instantiate a JAXB context.

查找loader违反约束异常 - 当一个已经加载了一个类加载器的类试图访问在同一个包中但由另一个类加载器加载的包私有的东西时,它似乎被抛出。我已经尝试删除我们的webapp中包含javax.xml.namespace.QName的任何jar,并且已经验证它是正在被拾取的Oracle中包含的实例,但是仍然会发生错误。有什么想法?

Looking up the "loader constraints violated" exception - it seems to be thrown when a class that has been loaded with one classloader attempts to access something that is package private in the same package but loaded by a different classloader. I have tried removing any jars in our webapp that include javax.xml.namespace.QName, and have verified that it is the instance included in Oracle that is being picked up, but the error still occurs. Any ideas?

(这是早期问题。)

推荐答案

这个课程是在那里有一半的WS Java库。从多个类加载器加载它然后比较它们非常容易,导致LinkageError。

This class is in half the WS Java libraries out there. It's really easy to load it from multiple classloaders and later compare them, causing a LinkageError.

一种有效的(但是大锤)技术来跟踪它是从类中修改类加载器用于转储此特定类在加载时加载哪个jar的Java源代码,然后在您的bootclasspath前加上修改后的版本:

One effective (but sledgehammer) technique to tracking this down is to modify Classloader from the Java source to dump which jar this particular class is loading from at load time, then prepend your bootclasspath with your modified version:

-Xbootclasspath / p:/ path / to / hackedBin

-Xbootclasspath/p:/path/to/hackedBin

这篇关于“链接javax / xml / namespace / QName类时违反了加载器约束”来自Oracle 10g上的webapp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆