[jboss-user] [Management, JMX/JBoss] - Interacting with the LoaderRepository MBean

miclopezalv do-not-reply at jboss.com
Mon Sep 18 09:54:08 EDT 2006


greetings,

i'm having a big problem with my application, because it has to be changing classes in a dynamic way, for example, the server is up and running, and someone creates a new .java archive, so, the app. has to compile it, and add it to the classpath, making it available for other module to use it.  I was trying using custom class loaders, but it doesn´t work because of the problems that usually arise when using different class loaders inside the AS (ClassCastException, LinkageException, etc.).    

Seen all this problems, i saw a posible solution in the UnifiedLoaderRepository, so my application can use the Repository that the server is actually using and load the classes it needs.  the question is: this kind of thing can be made?
how do i interact with the repository from a regular class, or and ejb3 session bean packaged in a regular .jar.?

I`m trying using something like:

MBeanServer server = MBeanServerLocator.locate();
try{
ObjectName  objectName = new      ObjectName("org.jboss.mx.loading:name=Default");		   
			   
   UnifiedLoaderRepository3MBean mbean =				      (UnifiedLoaderRepository3MBean)MBeanServerInvocationHandler.newProxyInstance(
				                                                   server,
				                                                   objectName,		                                                   UnifiedLoaderRepository3MBean.class,
				                                                   false);
System.out.println("obtaining class info: "+mbean.displayClassInfo("com.its.connection.ConnectionSetting")); 
			   
			}catch(Exception e){
				e.printStackTrace();
				
			}

any help mould be appreciated. 

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

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




More information about the jboss-user mailing list