ASF Bugzilla – Attachment 22319 Details for
Bug 45485
Agent.java is sole dependency on jmxtools.jar with Java 5+
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Agent.java rewritten with reflection
log4j-agent-without-jmxtools.patch (text/plain), 1.53 KB, created by
Thorbjørn Ravn Andersen
on 2008-07-25 10:30:14 UTC
(
hide
)
Description:
Agent.java rewritten with reflection
Filename:
MIME Type:
Creator:
Thorbjørn Ravn Andersen
Created:
2008-07-25 10:30:14 UTC
Size:
1.53 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P log4j-trunk >Index: src/main/java/org/apache/log4j/jmx/Agent.java >=================================================================== >--- src/main/java/org/apache/log4j/jmx/Agent.java (revision 679732) >+++ src/main/java/org/apache/log4j/jmx/Agent.java (working copy) >@@ -17,10 +17,9 @@ > > package org.apache.log4j.jmx; > >-import javax.management.ObjectName; > import javax.management.MBeanServer; > import javax.management.MBeanServerFactory; >-import com.sun.jdmk.comm.HtmlAdaptorServer; >+import javax.management.ObjectName; > > import org.apache.log4j.Logger; > >@@ -37,7 +36,14 @@ > void start() { > > MBeanServer server = MBeanServerFactory.createMBeanServer(); >- HtmlAdaptorServer html = new HtmlAdaptorServer(); >+ //HtmlAdaptorServer html = new HtmlAdaptorServer(); >+ Object html; >+ try { >+ html = Class.forName("com.sun.jdmk.comm.HtmlAdaptorServer").newInstance(); >+ } catch (Exception e) { >+ log.error("cannot get HtmlAdaptorServer instance", e); >+ return; >+ } > > try { > log.info("Registering HtmlAdaptorServer instance."); >@@ -47,9 +53,14 @@ > server.registerMBean(hdm, new ObjectName("log4j:hiearchy=default")); > > } catch(Exception e) { >- log.error("Problem while regitering MBeans instances.", e); >+ log.error("Problem while registering MBeans instances.", e); > return; > } >- html.start(); >+ try { >+ html.getClass().getMethod("start", null).invoke(html, null); >+ } catch (Exception e) { >+ log.error("cannot invoke html.start()", e); >+ return; >+ } > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45485
:
22319
|
22340
|
22389