Jboss 4.2类加载 [英] Jboss 4.2 Class Loading

查看:180
本文介绍了Jboss 4.2类加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 server / default / lib 中有一个jar,其中包含 Foo.class Bar.class

I have a jar in server/default/lib which contains Foo.class,Bar.class

我的应用程序/ WEB-INF / classes中有相同的类部署在 server / default / deploy

示例.class 使用 Foo.class 实例和 Bar.class 实例

现在的情况是 Example.class 应该使用 Foo.class 在我的应用程序中, Bar.class default / lib jar文件中。

Now the situation is that Example.class shoud use the Foo.class in my application and Bar.class in default/lib jar file.

即我的应用程序应该使用应用程序clases文件夹中的类,如果在类文件夹中找不到它,那么它应该使用 default / lib jar文件中的类。

i.e. my application should use the classes in the application clases folder if not found in classes folder then it should use the class in default/lib jar files.

我要定义 jboss-web.xml 文件

<jboss-web>
   <class-loading java2ClassLoadingCompliance="true">
   <loader-repository>
         com.example:eagle=web-360.jar
         <loader-repository-config>java2ParentDelegation=true</loader-repository-config>
      </loader-repository> 
   </class-loading>
</jboss-web>

web-360.jar 是jar这将是 default / lib
com.eagle:eagle 没有意义..

web-360.jar is the jar which will be default/lib. com.eagle:eagle has no significance..

推荐答案

查看 JBossClassLoadingUseCases 。您的情况似乎是用例4(即该类将从 default / lib 加载而不是 WEB-INF / classes

Have a look at JBossClassLoadingUseCases. Your situation seems to be Use Case 4 (i.e. the class will be loaded from default/lib in preference to WEB-INF/classes.

您似乎想要的是用例3(即 WEB-INF / classes 首选 default / lib ),在这种情况下,你应该从中省略 java2ParentDelegation = true config选项jboss-web.xml (或将其设置为 false ,这是默认值。)

What you seem to want is Use Case 3 (i.e. WEB-INF/classes preferred to default/lib), in which case you should omit the java2ParentDelegation=true config option from jboss-web.xml (or set it to false, which is the default).

这篇关于Jboss 4.2类加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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