[jboss-user] [JBoss Microcontainer Development] - Issues using Javassist TypeInfoFactory in other projects
Kabir Khan
do-not-reply at jboss.com
Mon Mar 29 15:16:58 EDT 2010
Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] replied to the discussion
"Issues using Javassist TypeInfoFactory in other projects"
To view the discussion, visit: http://community.jboss.org/message/534489#534489
--------------------------------------------------------------
I am getting some failures in tests that have their own classloader when security is enabled, and am unsure where to put the privileged block? Initially I got this error:
1545 ERROR [AbstractKernelController] Error installing to Instantiated: name=VFSBean1 state=Described
java.lang.RuntimeException: java.security.PrivilegedActionException: javassist.CannotCompileException: by java.security.AccessControlExcepti
on: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.makeClass(JavassistMemberFactory.java:296)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.createJavassistConstructor(JavassistMemberFactory.java:213)
at org.jboss.reflect.plugins.javassist.JavassistReflectionFactory.createConstructor(JavassistReflectionFactory.java:108)
at org.jboss.reflect.plugins.javassist.JavassistConstructorInfo.newInstance(JavassistConstructorInfo.java:146)
at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:81)
at org.jboss.kernel.plugins.dependency.DispatchJoinPoint.run(DispatchJoinPoint.java:47)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:54)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)
at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:67)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:1)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.secureInstallAction(SimpleControllerContextAction.java:67)
at org.jboss.dependency.plugins.action.AccessControllerContextAction$1.run(AccessControllerContextAction.java:80)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:103)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:377)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083)
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:103)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:97)
at org.jboss.test.kernel.dependency.support.TestUtil.install(TestUtil.java:99)
at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.install(OldAbstractKernelDependencyTest.java:112)
at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.assertInstall(OldAbstractKernelDependencyTest.java:130)
at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.assertInstall(OldAbstractKernelDependencyTest.java:123)
at org.jboss.test.kernel.dependency.test.ConstructorClassLoaderTestCase.testConstructorClassLoaderReinstall(ConstructorClassLoaderTestCase.
java:231)
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.PrivilegedActionException: javassist.CannotCompileException: by java.security.AccessControlException: access denied
(java.lang.RuntimePermission accessClassInPackage.sun.reflect)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.makeClass(JavassistMemberFactory.java:281)
... 55 more
Caused by: javassist.CannotCompileException: by java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClass
InPackage.sun.reflect)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:136)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory$1.run(JavassistMemberFactory.java:285)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory$1.run(JavassistMemberFactory.java:1)
... 57 more
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect)
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 java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1512)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:327)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at org.jboss.test.classloading.vfs.VFSClassLoader.loadClass(VFSClassLoader.java:55)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:698)
at java.lang.ClassLoader.defineClass(ClassLoader.java:544)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163)
... 60 more
I tried adding a privileged block to FactoryHelper, but still get the same error
1545 ERROR [AbstractKernelController] Error installing to Instantiated: name=VFSBean1 state=Described
java.lang.RuntimeException: java.security.PrivilegedActionException: javassist.CannotCompileException: by java.security.AccessControlExcepti
on: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.makeClass(JavassistMemberFactory.java:296)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.createJavassistConstructor(JavassistMemberFactory.java:213)
at org.jboss.reflect.plugins.javassist.JavassistReflectionFactory.createConstructor(JavassistReflectionFactory.java:108)
at org.jboss.reflect.plugins.javassist.JavassistConstructorInfo.newInstance(JavassistConstructorInfo.java:146)
at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:81)
at org.jboss.kernel.plugins.dependency.DispatchJoinPoint.run(DispatchJoinPoint.java:47)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:54)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)
at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:67)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:1)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.secureInstallAction(SimpleControllerContextAction.java:67)
at org.jboss.dependency.plugins.action.AccessControllerContextAction$1.run(AccessControllerContextAction.java:80)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:103)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:377)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083)
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:103)
at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:97)
at org.jboss.test.kernel.dependency.support.TestUtil.install(TestUtil.java:99)
at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.install(OldAbstractKernelDependencyTest.java:112)
at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.assertInstall(OldAbstractKernelDependencyTest.java:130)
at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.assertInstall(OldAbstractKernelDependencyTest.java:123)
at org.jboss.test.kernel.dependency.test.ConstructorClassLoaderTestCase.testConstructorClassLoaderReinstall(ConstructorClassLoaderTestCase.
java:231)
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.PrivilegedActionException: javassist.CannotCompileException: by java.security.AccessControlException: access denied
(java.lang.RuntimePermission accessClassInPackage.sun.reflect)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.makeClass(JavassistMemberFactory.java:281)
... 55 more
Caused by: javassist.CannotCompileException: by java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClass
InPackage.sun.reflect)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:136)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory$1.run(JavassistMemberFactory.java:285)
at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory$1.run(JavassistMemberFactory.java:1)
... 57 more
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect)
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 java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1512)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:327)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at org.jboss.test.classloading.vfs.VFSClassLoader.loadClass(VFSClassLoader.java:55)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:698)
at java.lang.ClassLoader.defineClass(ClassLoader.java:544)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javassist.util.proxy.SecurityActions$6.run(SecurityActions.java:124)
at java.security.AccessController.doPrivileged(Native Method)
at javassist.util.proxy.SecurityActions.invokeMethod(SecurityActions.java:121)
at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163)
Is there any way around this other than adding a properties file for the test containing the permission?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/534489#534489]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2115]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100329/10320dd1/attachment.html
More information about the jboss-user
mailing list