From: Thomas C. <tc...@Se...> - 2002-03-04 20:53:34
|
Hi. I am having a problem with the XSLTProcessor and HTTPAdaptor. My project uses a custom class loader for all classes. Setting up the objects works fine: MBeanServer mbs = ...; // the loader is already registered with the mbean server ObjectName loaderName = new ObjectName("Test:loader=MyClassLoader"); // create HTTP adaptor // ObjectName adapterName = new ObjectName("Test:helper=OpenJMXHttpAdaptor"); mbs.createMBean("openjmx.adaptor.http.HttpAdaptor", adapterName, loaderName); // create/setup XSL transformer // ObjectName xslProcessorName = new ObjectName("Test:helper=XSLTProcessor"); mbs.createMBean("openjmx.adaptor.http.XSLTProcessor", xslProcessorName, loaderName); mbs.setAttribute(xslProcessorName, new Attribute("File", "c:\\appserver\\dev\\xsl\\")); mbs.setAttribute(xslProcessorName, new Attribute("UseCache", Boolean.FALSE)); mbs.setAttribute(adapterName, new Attribute("ProcessorName", xslProcessorName)); The problem is when I try to invoke the HTTP adaptor. The preProcess method throws an exception that I have traced to the isInstanceOf method. During preProcess, the HTTP adaptor makes the isInstanceOf call to make sure the XSL processor implements "openjmx.adaptor.http.ProcessorMBean". However, without my class loader, this class cannot be loaded. The problem is not specific to the HTTP adaptor -- it looks like isInstanceOf will NEVER work when using custom class loaders. The short-term solution for me is to comment out the isInstanceOf calls in the HttpAdaptor source (which are a bit redundant anyway, IMO). The long term solution seems to be better handling of custom class loaders. Specifically, maybe the MBeanServer can maintain the relationship between the ObjectName of a managed bean and the ObjectName of the class loader that was used to load that bean. I am new to MX4J (and JMX), so I may be missing something. I appreciate any help you can provide. Thanks, -Tom O p t i m i z i n g e B u s i n e s s Tom Carter Sr. Software Developer Research & Development tc...@se... |