I have a failing test in the JMX server code [1]:
(deftest dynamic-mbean
(let [mbean-name "clojure.contrib.test_contrib.test_jmx:name=Foo"]
(jmx/register-mbean
(jmx/dynamic-mbean
(ref {:string-attribute "a-string"}))
mbean-name)
(is (= "a-string" (jmx/read mbean-name :string-attribute)))))
The weird thing is, the same exact code works from the REPL. The
second weird thing is, the error is a permissions error (and no
SecurityManager is installed).
In the interest of decency, I will show only a fraction of the stack
trace:
actual: java.security.AccessControlException: access denied
(javax.management.MBeanTrustPermission register)
[java] at java.security.AccessControlContext.checkPermission
(AccessControlContext.java:264)
java.lang.SecurityManager.checkPermission (SecurityManager.java:568)
com
.sun
.jmx
.interceptor.DefaultMBeanServerInterceptor.checkMBeanTrustPermission
(DefaultMBeanServerInterceptor.java:1724)
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean
(DefaultMBeanServerInterceptor.java:335)
com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean
(JmxMBeanServer.java:497)
sun.reflect.NativeMethodAccessorImpl.invoke0
(NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke (Method.java:585)
clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:90)
clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:28)
clojure.contrib.jmx/register_mbean (server.clj:17)
Since the code works at the REPL, I suspect a classloader issue. Am I
right? If so, can I change the classloader used by Clojure's proxy
function?
Stu
[1]
http://github.com/richhickey/clojure-contrib/commit/5c2276dede95163b99327e77c21adf95825e0b51
. Note this is on the jmx branch.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---