inverse_loading 在 WASCE 3.0.0.3/Geronimo 3.0 中
inverse_loading in WASCE 3.0.0.3 / Geronimo 3.0
我正在尝试将 war 部署到 IBM Websphere Application Server Community Edition (WASCE) 3.0.0.3。我在 WASCE 3.0.0.3 附带的那些 jars 和来自我们的应用程序依赖项的 jars 之间遇到了一些 jars 冲突问题。最后,我通过在 geronimo-web.xml 中使用下面的 属性 来强制 WASCE 从我的应用程序加载 jar 来解决这个问题。
<import-package>!the.conflicting.jars</import-package>
但是,我想强制 WASCE 始终首先从我的应用程序中获取 jar,即反转默认类加载器行为以首先从应用程序加载。在这种情况下要更改的正确配置是什么?
经过一些搜索,WASCE 3.0 是基于 Geronimo 3.0 根据 link. I found setting <inverse-classloading>
in geronimo-web.xml may be helpful. But below two documents on Apache Geronimo 3.0 website 提到此功能在 Geronimo 3.0 上不再可用
在Migrating from G 2.x to G 3.x中说:
inverse-classloading Geronimo 3.0 does not support the element in the deployment plan.
The <sys:environment>
element contains the following elements:
...
The <inverse-classloading>
element can be used to specify that standard classloader delegation is to be reversed for this module. The Geronimo classloader delegation follows the Java EE 5 specifications, and the normal behavior is to load classes from a parent classloader (if available) before checking the current classloader. ...... ...... (Not supported in 3.0, use <import-package/>
instead)
那么,如果 <inverse-classloading>
不再可用,那么 WASCE 3.0.0.3 中这个 属性 的等价物是什么?或者我应该如何使用 <import-package/>
对所有重复的 jar 执行此操作?
在您提到的 link 中,您会找到以下部分
<sys:environment>
The <sys:environment>
XML element uses the Geronimo System namespace, which is used to specify the common elements for common libraries and module-scoped services, and is documented here:
http://geronimo.apache.org/schemas-3.0/docs/geronimo-module-1.2.xsd.html
The element contains the following elements:
The <moduleId>
element is used to provide the configuration name for the web application as deployed in the Geronimo server. It contains elements for the groupId, artifactId, version and module type. Module IDs are normally printed with slashes between the four components, such as GroupID/ArtifactID/Version/Type.
The <dependencies>
element is used to provide the configurations and third party libraries on which the web module is dependent upon. These configurations and libraries are made available to the web module via the Geronimo classloader hierarchy.
The <bundle-activator>
element is used to create Bundle-Activator header in the manifest file of the web application. It specifies the entry point of the web application as deployed in the Geronimo server.
The <bundle-classPath>
element is used to create Import-Package header in the manifest file of the web application. It contains a list of directories or embedded jar files, which are also called bundle resources and extend the classpath of the web application.
The <import-package>
element is used to create Import-Package header in the manifest file of the web application. It specifies a list of packages to be resolved before the web application is started. Use <import-package>!packagename</import-package>
to override the specific package in server.
The <export-package>
element is used to create Export-Package header in the manifest file of the web application. It specifies a list of packages to be exported.
The <require-bundle>
element is used create Require-Bundle header in the manifest file of the web application. It specifies a list of bundles to bind to regardless their packages.
The <dynamic-import-package>
element is used to create DynamicImport-Package header in the manifest file of the web application. It specifies a list of packaged to be imported dynamically, especially during class loading.
所以基本上,您需要添加以下指令,即
<sys:import-package>!package-class-name-here*</sys:import-package>
在 <sys:environment>
节中。通常在 Application Context-Root 指令之前。
如您所知,这是在应用程序 WAR/EAR 中嵌入的 geronimo-web.xml —— 如 link
中所述
我正在尝试将 war 部署到 IBM Websphere Application Server Community Edition (WASCE) 3.0.0.3。我在 WASCE 3.0.0.3 附带的那些 jars 和来自我们的应用程序依赖项的 jars 之间遇到了一些 jars 冲突问题。最后,我通过在 geronimo-web.xml 中使用下面的 属性 来强制 WASCE 从我的应用程序加载 jar 来解决这个问题。
<import-package>!the.conflicting.jars</import-package>
但是,我想强制 WASCE 始终首先从我的应用程序中获取 jar,即反转默认类加载器行为以首先从应用程序加载。在这种情况下要更改的正确配置是什么?
经过一些搜索,WASCE 3.0 是基于 Geronimo 3.0 根据 link. I found setting <inverse-classloading>
in geronimo-web.xml may be helpful. But below two documents on Apache Geronimo 3.0 website 提到此功能在 Geronimo 3.0 上不再可用
在Migrating from G 2.x to G 3.x中说:
inverse-classloading Geronimo 3.0 does not support the element in the deployment plan.
The
<sys:environment>
element contains the following elements:...
The
<inverse-classloading>
element can be used to specify that standard classloader delegation is to be reversed for this module. The Geronimo classloader delegation follows the Java EE 5 specifications, and the normal behavior is to load classes from a parent classloader (if available) before checking the current classloader. ...... ...... (Not supported in 3.0, use<import-package/>
instead)
那么,如果 <inverse-classloading>
不再可用,那么 WASCE 3.0.0.3 中这个 属性 的等价物是什么?或者我应该如何使用 <import-package/>
对所有重复的 jar 执行此操作?
在您提到的 link 中,您会找到以下部分
<sys:environment>
The
<sys:environment>
XML element uses the Geronimo System namespace, which is used to specify the common elements for common libraries and module-scoped services, and is documented here:http://geronimo.apache.org/schemas-3.0/docs/geronimo-module-1.2.xsd.html
The element contains the following elements:
The
<moduleId>
element is used to provide the configuration name for the web application as deployed in the Geronimo server. It contains elements for the groupId, artifactId, version and module type. Module IDs are normally printed with slashes between the four components, such as GroupID/ArtifactID/Version/Type.The
<dependencies>
element is used to provide the configurations and third party libraries on which the web module is dependent upon. These configurations and libraries are made available to the web module via the Geronimo classloader hierarchy.The
<bundle-activator>
element is used to create Bundle-Activator header in the manifest file of the web application. It specifies the entry point of the web application as deployed in the Geronimo server.The
<bundle-classPath>
element is used to create Import-Package header in the manifest file of the web application. It contains a list of directories or embedded jar files, which are also called bundle resources and extend the classpath of the web application.The
<import-package>
element is used to create Import-Package header in the manifest file of the web application. It specifies a list of packages to be resolved before the web application is started. Use<import-package>!packagename</import-package>
to override the specific package in server.The
<export-package>
element is used to create Export-Package header in the manifest file of the web application. It specifies a list of packages to be exported.The
<require-bundle>
element is used create Require-Bundle header in the manifest file of the web application. It specifies a list of bundles to bind to regardless their packages.The
<dynamic-import-package>
element is used to create DynamicImport-Package header in the manifest file of the web application. It specifies a list of packaged to be imported dynamically, especially during class loading.
所以基本上,您需要添加以下指令,即
<sys:import-package>!package-class-name-here*</sys:import-package>
在 <sys:environment>
节中。通常在 Application Context-Root 指令之前。
如您所知,这是在应用程序 WAR/EAR 中嵌入的 geronimo-web.xml —— 如 link
中所述