[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Registering listener on KernelEventManager

adrian@jboss.org do-not-reply at jboss.com
Tue Mar 18 06:17:00 EDT 2008


"alesj" wrote : "alesj" wrote : 
  |   | Probably securely getting it off the target is what we need to do.
  |   | 
  | 
  |   |       // this already checks for permission
  |   |       return target.getClass().getClassLoader();
  |   | 

No. target.getClass().getClassLoader() is not correct (and is 
pretty much always wrong).  The TCL would be better, but not in the case.

The correct classloader (like all the other installs) 
is to use the classloader of the bean doing the install.

Otherwise how could this work if you used the classloader where the KernelEventRegistry
is located (i.e. the bootstrap classloader/classpath)


  | <deployment xmlns="urn:jboss:bean-deployer:2.0">
  |     <classloader><!-- something unreachable from the bootstrap classloader --></classloader>
  |     <bean name="StartupMonitor"
  |         class="org.jboss.test.profileservice.lib.startup.StartupMonitor">
  |               <install bean="jboss.kernel:service=KernelEventManager" method="registerListener">
  |                  <!-- registerListener(Object name, KernelEventListener listener, KernelEventFilter filter, Object han
  | dback) -->
  |                  <parameter>jboss.kernel:service=KernelEventManager</parameter>
  |                  <parameter><this/></parameter>
  |                  <parameter><null/></parameter>
  |                  <parameter><javabean class="from.my.classloader"/></parameter>
  |               </install>
  |    </bean>
  | </deployment>
  | 

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

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



More information about the jboss-dev-forums mailing list