棘手的类路径问题
Tricky Classpath issue
在现有应用程序上工作,它作为一个巨大的 ear 文件在 Weblogic 上运行。
有我的组织编写的自定义代码,以及供应商编写的代码,它们在 weblogic 启动时都在同一个类路径上运行。
我们的一些自定义代码使用 spring 1.2,在最新版本的供应商代码中,他们使用 spring3。所以我们不能让耳朵完全工作,除非我们能让每个组件都达到它运行所需的 spring 版本。但是因为它们都使用启动 weblogic 的类路径,所以 spring1.2 或 spring 3.0 将首先取决于类路径中的顺序。
我卡住了吗?遗漏了什么?我从来没有在这个级别处理过类路径。
谢谢
Classloaders use a delegation model when loading a class. The classloader implementation first checks its cache to see if the requested class has already been loaded. This class verification improves performance in that its cached memory copy is used instead of repeated loading of a class from disk. If the class is not found in its cache, the current classloader asks its parent for the class. Only if the parent cannot load the class does the classloader attempt to load the class. If a class exists in both the parent and child classloaders, the parent version is loaded. This delegation model is followed to avoid multiple copies of the same form being loaded. Multiple copies of the same class can lead to a ClassCastException.
认为在 weblogic.xml 中设置以下内容可能会有所帮助
prefer-web-inf-classes 元素
weblogic.xml Web 应用程序部署描述符包含一个 prefer-web-inf-classes 元素(元素的子元素)。默认情况下,此元素设置为 False。将此元素设置为 True 会颠覆 class 加载程序委派模型,以便加载来自 Web 应用程序的 class 定义优先于更高级别 class 加载程序中的 class 定义。这允许 Web 应用程序使用自己的第三方版本 class,它也可能是 WebLogic Server 的一部分。参见 "weblogic.xml Deployment Descriptor Elements"。*
使用此功能时,必须注意不要将根据 Web 应用程序的 class 定义创建的实例与根据服务器定义创建的发布混在一起。如果混合使用此类实例,则会产生 ClassCastException。
参考下面的URL
在现有应用程序上工作,它作为一个巨大的 ear 文件在 Weblogic 上运行。
有我的组织编写的自定义代码,以及供应商编写的代码,它们在 weblogic 启动时都在同一个类路径上运行。
我们的一些自定义代码使用 spring 1.2,在最新版本的供应商代码中,他们使用 spring3。所以我们不能让耳朵完全工作,除非我们能让每个组件都达到它运行所需的 spring 版本。但是因为它们都使用启动 weblogic 的类路径,所以 spring1.2 或 spring 3.0 将首先取决于类路径中的顺序。
我卡住了吗?遗漏了什么?我从来没有在这个级别处理过类路径。
谢谢
Classloaders use a delegation model when loading a class. The classloader implementation first checks its cache to see if the requested class has already been loaded. This class verification improves performance in that its cached memory copy is used instead of repeated loading of a class from disk. If the class is not found in its cache, the current classloader asks its parent for the class. Only if the parent cannot load the class does the classloader attempt to load the class. If a class exists in both the parent and child classloaders, the parent version is loaded. This delegation model is followed to avoid multiple copies of the same form being loaded. Multiple copies of the same class can lead to a ClassCastException.
认为在 weblogic.xml 中设置以下内容可能会有所帮助
prefer-web-inf-classes 元素
weblogic.xml Web 应用程序部署描述符包含一个 prefer-web-inf-classes 元素(元素的子元素)。默认情况下,此元素设置为 False。将此元素设置为 True 会颠覆 class 加载程序委派模型,以便加载来自 Web 应用程序的 class 定义优先于更高级别 class 加载程序中的 class 定义。这允许 Web 应用程序使用自己的第三方版本 class,它也可能是 WebLogic Server 的一部分。参见 "weblogic.xml Deployment Descriptor Elements"。*
使用此功能时,必须注意不要将根据 Web 应用程序的 class 定义创建的实例与根据服务器定义创建的发布混在一起。如果混合使用此类实例,则会产生 ClassCastException。
参考下面的URL