如何配置JBOSS以在Web应用程序中使用xml lib?

时间:2022-12-10 07:18:25

JBOSS is throwing a:

JBOSS扔了一个:

java.lang.NoSuchMethodError: org.w3c.dom.Document.getDocumentURI()Ljava/lang/String;

Error when loading a wsdl. Can I configure it to prefer the library in my WAR instead of the system or app server lib?

加载wsdl时出错。我可以将它配置为更喜欢我的WAR中的库而不是系统或应用服务器库吗?

1 个解决方案

#1


The app server should already be using any JARs in WEB-INF/lib, along with the system and app server library paths - the standard approach to this is that the ClassLoader for WEB-INF/lib delegates class loading to the app server lib, which delegates class loading to the server lib, and only if the parent classloader cannot find the class does it attempt to load it's own classes.

应用服务器应该已经在WEB-INF / lib中使用任何JAR,以及系统和应用服务器库路径 - 标准方法是WEBLIN / lib的ClassLoader将类加载到app服务器lib,它将类加载委托给服务器lib,并且只有当父类加载器找不到类时它才会尝试加载它自己的类。

In other words, if you place the same class in WEB-INF/lib and the app server's lib, the latter JAR will always be used. This means it is possible to create conflicts by having classes with the same names but different versions available in both WEB-INF/lib and the app server's lib - are you sure this isn't what's causing your issues? Can you resolve the conflict?

换句话说,如果将相同的类放在WEB-INF / lib和app服务器的lib中,则将始终使用后一个JAR。这意味着可以通过在WEB-INF / lib和app服务器的lib中使用具有相同名称但不同版本的类来创建冲突 - 您确定这不是导致问题的原因吗?你能解决冲突吗?

Some app servers (not sure about JBoss, but I know WebSphere allows it) lets you configure the classloader so that the child loader is checked first (child-first vs parent-first), but this type of configuration can cause other issues.

一些应用服务器(不确定JBoss,但我知道WebSphere允许它)允许您配置类加载器,以便首先检查子加载器(子优先与父优先),但这种类型的配置可能会导致其他问题。

#1


The app server should already be using any JARs in WEB-INF/lib, along with the system and app server library paths - the standard approach to this is that the ClassLoader for WEB-INF/lib delegates class loading to the app server lib, which delegates class loading to the server lib, and only if the parent classloader cannot find the class does it attempt to load it's own classes.

应用服务器应该已经在WEB-INF / lib中使用任何JAR,以及系统和应用服务器库路径 - 标准方法是WEBLIN / lib的ClassLoader将类加载到app服务器lib,它将类加载委托给服务器lib,并且只有当父类加载器找不到类时它才会尝试加载它自己的类。

In other words, if you place the same class in WEB-INF/lib and the app server's lib, the latter JAR will always be used. This means it is possible to create conflicts by having classes with the same names but different versions available in both WEB-INF/lib and the app server's lib - are you sure this isn't what's causing your issues? Can you resolve the conflict?

换句话说,如果将相同的类放在WEB-INF / lib和app服务器的lib中,则将始终使用后一个JAR。这意味着可以通过在WEB-INF / lib和app服务器的lib中使用具有相同名称但不同版本的类来创建冲突 - 您确定这不是导致问题的原因吗?你能解决冲突吗?

Some app servers (not sure about JBoss, but I know WebSphere allows it) lets you configure the classloader so that the child loader is checked first (child-first vs parent-first), but this type of configuration can cause other issues.

一些应用服务器(不确定JBoss,但我知道WebSphere允许它)允许您配置类加载器,以便首先检查子加载器(子优先与父优先),但这种类型的配置可能会导致其他问题。