[jboss-user] [Installation, Configuration & DEPLOYMENT] - java2ParentDelegation does not work

bemar do-not-reply at jboss.com
Fri Jan 9 04:11:57 EST 2009


Hi,

I've read the article http://www.jboss.org/community/docs/DOC-9288 about java2ParentDelegation to controll the
class loader and "force" it to use the libraries from the application libs instead of the jboss libs.

I've inserted the  

  | <?xml version="1.0"?>
  | <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
  | <jboss-app>
  |   <loader-repository>
  |   	Bemar:service=CronService
  |   	<loader-repository-config> 
  |     	java2ParentDelegation=false
  |     </loader-repository-config> 
  |   </loader-repository>
  |    
  |   <module>
  |     <service>Cron.sar</service>
  |   </module>
  |   <module>
  |     <service>Cron.jar</service>
  |   </module>
  | </jboss-app>
  | 
 into my jboss-app.xml but jboss is using already the library from the jboss lib.
 
 I've constructed the following test case:
 
 In the constructor of my main class (MainClass.java) I will call:

  |  logger.info(new TestLoad().getTestLoadString());
  | 
 getTestLoadString() is a method of class TestLoad in an external jar "ClassLoadTest.jar". I have two versions of it:
 
  |  TestLoad_1.0.java
  |  public class TestLoad {
  | 
  |   public TestLoad() {    
  |   }
  | 
  |   public String getTestLoadString(){
  |     return "1.0";
  |   }
  | }
  |  
 TestLoad_2.0.java
  |  public class TestLoad {
  | 
  |   public TestLoad() {    
  |   }
  | 
  |   public String getTestLoadString(){
  |     return "2.0";
  |   }
  | }
  | 
  
The 1.0 version is compiled directly into the ear file. The 2.0 version lies in the ...\server\default\lib directory.

But in every case the 2.0 version is taken. JBoss does not matter about the settings of the loader-repository.

Do I have do adjust further settings to prevent the parent lib loading?

Thx for your help

Greetings

Ben

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4200511#4200511

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4200511



More information about the jboss-user mailing list