[jboss-user] [JBoss Microcontainer Development] New message: "Re: JBREFLECT-5 - Implementing generics in JavassistClassInfo"

Kabir Khan do-not-reply at jboss.com
Tue Mar 16 08:27:31 EDT 2010


User development,

A new message was posted in the thread "JBREFLECT-5 - Implementing generics in JavassistClassInfo":

http://community.jboss.org/message/532254#532254

Author  : Kabir Khan
Profile : http://community.jboss.org/people/kabir.khan@jboss.com

Message:
--------------------------------------------------------------
I am trying out the javassist implementation in kernel now. The first stumbling block is this
 
java.lang.RuntimeException: Unable to create a KernelInitializer based on the specified KernelConfig
 at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:156)
 at org.jboss.kernel.KernelFactory.assembleNewKernel(KernelFactory.java:99)
 at org.jboss.kernel.KernelFactory.newInstance(KernelFactory.java:67)
 at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.bootstrap(AbstractBootstrap.java:114)
 at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83)
 at org.jboss.test.kernel.bootstrap.test.BootstrapTestCase.testBasicBootstrap(BootstrapTestCase.java:76)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at junit.framework.TestCase.runTest(TestCase.java:168)
 at junit.framework.TestCase.runBare(TestCase.java:134)
 at junit.framework.TestResult$1.protect(TestResult.java:110)
 at junit.framework.TestResult.runProtected(TestResult.java:128)
 at junit.framework.TestResult.run(TestResult.java:113)
 at junit.framework.TestCase.run(TestCase.java:124)
 at junit.framework.TestSuite.runTest(TestSuite.java:232)
 at junit.framework.TestSuite.run(TestSuite.java:227)
 at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
 at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
 at junit.framework.TestResult.runProtected(TestResult.java:128)
 at junit.extensions.TestSetup.run(TestSetup.java:27)
 at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
 at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
 at java.security.AccessController.checkPermission(AccessController.java:546)
 at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
 at org.jboss.reflect.plugins.javassist.JavassistTypeInfo.getClassLoader(JavassistTypeInfo.java:211)
 at org.jboss.classadapter.plugins.BasicClassAdapter.getClassLoader(BasicClassAdapter.java:70)
 at org.jboss.beans.info.plugins.AbstractBeanInfoFactory.getBeanInfo(AbstractBeanInfoFactory.java:136)
 at org.jboss.beans.info.plugins.AbstractBeanInfoFactory.getBeanInfo(AbstractBeanInfoFactory.java:124)
 at org.jboss.config.plugins.AbstractConfiguration.getBeanInfo(AbstractConfiguration.java:69)
 at org.jboss.kernel.plugins.config.AbstractKernelConfig.getBeanInfo(AbstractKernelConfig.java:65)
 at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.getImplementation(PropertyKernelConfig.java:184)
 at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.createKernelInitializer(PropertyKernelConfig.java:121)
 at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:150)
 ... 28 more
 
JavassistTypeInfo:
 
   /** The get classloader permission */
   private static final RuntimePermission GET_CLASSLOADER_PERMISSION = new RuntimePermission("getClassLoader");
..
   public ClassLoader getClassLoader()
   {
      // looks like Javassist ClassPool::getClassLoader
      // doesn't check for security, so we should
      SecurityManager sm = System.getSecurityManager();
      if (sm != null)
         sm.checkPermission(GET_CLASSLOADER_PERMISSION);
 
      return JavassistUtil.getClassLoader(ctClass);
   }
 

 
In the introspection implementation this simply delegates to Class.getClassLoader()
 
    public ClassLoader getClassLoader() {
        ClassLoader cl = getClassLoader0();
        if (cl == null)
            return null;
 
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            ClassLoader ccl = ClassLoader.getCallerClassLoader();
            if (ccl != null && ccl != cl && !cl.isAncestor(ccl)) {
                sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
            }
        }
        return cl;
    }

 
getClassLoader() gets called quite a bit, and I am unsure how best to handle this?

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/532254#532254




More information about the jboss-user mailing list