The language I'm using is Java (Groovy).
I'm using javax.JMS to send a file over a JMS WebLogic queue. Immediately after successfully sending the JMS message (separately verified), I call close() methods from my QueueSession instance and then from my QueueConnection instance.
After all this, I try to connect to redis using jedis (which works perfectly in every other context) and I immediately get this error message:
java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:585)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.checkMBeanTrustPermission(DefaultMBeanServerInterceptor.java:1848)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:322)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at org.apache.commons.pool2.impl.BaseGenericObjectPool.jmxRegister(BaseGenericObjectPool.java:883)
at org.apache.commons.pool2.impl.BaseGenericObjectPool.<init>(BaseGenericObjectPool.java:130)
at org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:107)
at redis.clients.util.Pool.initPool(Pool.java:44)
at redis.clients.util.Pool.<init>(Pool.java:23)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:185)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:162)
at redis.clients.jedis.JedisPool.<init>(JedisPool.java:28)
at sun.reflect.GeneratedConstructorAccessor46.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:255)
at com.<mysoftware>.core.Ecosystem.createRedisConnection(Ecosystem.groovy:93)
which is when I call new JedisPool(...) - Again, I never have issues with JedisPool. I only have this issue after sending a file over the JMS queue.
How can I solve this issue? I've seen that someone on SO suggests adding a line to java.policy file, but can I do this in my program? I don't want to add new very specific steps to my software's installation process.