<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Issues using Javassist TypeInfoFactory in other projects
</h3>
<span style="margin-bottom: 10px;">
reply from <a href="http://community.jboss.org/people/kabir.khan%40jboss.com">Kabir Khan</a> in <i>JBoss Microcontainer Development</i> - <a href="http://community.jboss.org/message/534489#534489">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p><p>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:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>1545 ERROR [AbstractKernelController] Error installing to Instantiated: name=VFSBean1 state=Described</p><p>java.lang.RuntimeException: java.security.PrivilegedActionException: javassist.CannotCompileException: by java.security.AccessControlExcepti</p><p>on: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.makeClass(JavassistMemberFactory.java:296)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.createJavassistConstructor(JavassistMemberFactory.java:213)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.JavassistReflectionFactory.createConstructor(JavassistReflectionFactory.java:108)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.JavassistConstructorInfo.newInstance(JavassistConstructorInfo.java:146)</p><p><span> </span>at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:81)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.DispatchJoinPoint.run(DispatchJoinPoint.java:47)</p><p><span> </span>at java.security.AccessController.doPrivileged(Native Method)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:54)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:67)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:1)</p><p><span> </span>at org.jboss.dependency.plugins.action.SimpleControllerContextAction.secureInstallAction(SimpleControllerContextAction.java:67)</p><p><span> </span>at org.jboss.dependency.plugins.action.AccessControllerContextAction$1.run(AccessControllerContextAction.java:80)</p><p><span> </span>at java.security.AccessController.doPrivileged(Native Method)</p><p><span> </span>at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:103)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:377)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:103)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:97)</p><p><span> </span>at org.jboss.test.kernel.dependency.support.TestUtil.install(TestUtil.java:99)</p><p><span> </span>at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.install(OldAbstractKernelDependencyTest.java:112)</p><p><span> </span>at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.assertInstall(OldAbstractKernelDependencyTest.java:130)</p><p><span> </span>at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.assertInstall(OldAbstractKernelDependencyTest.java:123)</p><p><span> </span>at org.jboss.test.kernel.dependency.test.ConstructorClassLoaderTestCase.testConstructorClassLoaderReinstall(ConstructorClassLoaderTestCase.</p><p>java:231)</p><p><span> </span>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p><span> </span>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p><p><span> </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p><span> </span>at java.lang.reflect.Method.invoke(Method.java:597)</p><p><span> </span>at junit.framework.TestCase.runTest(TestCase.java:168)</p><p><span> </span>at junit.framework.TestCase.runBare(TestCase.java:134)</p><p><span> </span>at junit.framework.TestResult$1.protect(TestResult.java:110)</p><p><span> </span>at junit.framework.TestResult.runProtected(TestResult.java:128)</p><p><span> </span>at junit.framework.TestResult.run(TestResult.java:113)</p><p><span> </span>at junit.framework.TestCase.run(TestCase.java:124)</p><p><span> </span>at junit.framework.TestSuite.runTest(TestSuite.java:232)</p><p><span> </span>at junit.framework.TestSuite.run(TestSuite.java:227)</p><p><span> </span>at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)</p><p><span> </span>at junit.extensions.TestSetup$1.protect(TestSetup.java:23)</p><p><span> </span>at junit.framework.TestResult.runProtected(TestResult.java:128)</p><p><span> </span>at junit.extensions.TestSetup.run(TestSetup.java:27)</p><p><span> </span>at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)</p><p><span> </span>at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)</p><p>Caused by: java.security.PrivilegedActionException: javassist.CannotCompileException: by java.security.AccessControlException: access denied</p><p> (java.lang.RuntimePermission accessClassInPackage.sun.reflect)</p><p><span> </span>at java.security.AccessController.doPrivileged(Native Method)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.makeClass(JavassistMemberFactory.java:281)</p><p><span> </span>... 55 more</p><p>Caused by: javassist.CannotCompileException: by java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClass</p><p>InPackage.sun.reflect)</p><p><span> </span>at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169)</p><p><span> </span>at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:136)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory$1.run(JavassistMemberFactory.java:285)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory$1.run(JavassistMemberFactory.java:1)</p><p><span> </span>... 57 more</p><p>Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect)</p><p><span> </span>at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)</p><p><span> </span>at java.security.AccessController.checkPermission(AccessController.java:546)</p><p><span> </span>at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)</p><p><span> </span>at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1512)</p><p><span> </span>at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:327)</p><p><span> </span>at java.lang.ClassLoader.loadClass(ClassLoader.java:250)</p><p><span> </span>at org.jboss.test.classloading.vfs.VFSClassLoader.loadClass(VFSClassLoader.java:55)</p><p><span> </span>at java.lang.ClassLoader.loadClass(ClassLoader.java:250)</p><p><span> </span>at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)</p><p><span> </span>at java.lang.ClassLoader.defineClass1(Native Method)</p><p><span> </span>at java.lang.ClassLoader.defineClass(ClassLoader.java:698)</p><p><span> </span>at java.lang.ClassLoader.defineClass(ClassLoader.java:544)</p><p><span> </span>at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)</p><p><span> </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p><span> </span>at java.lang.reflect.Method.invoke(Method.java:597)</p><p><span> </span>at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181)</p><p><span> </span>at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163)</p><p><span> </span>... 60 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I tried adding a privileged block to FactoryHelper, but still get the same error</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>1545 ERROR [AbstractKernelController] Error installing to Instantiated: name=VFSBean1 state=Described</p><p>java.lang.RuntimeException: java.security.PrivilegedActionException: javassist.CannotCompileException: by java.security.AccessControlExcepti</p><p>on: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.makeClass(JavassistMemberFactory.java:296)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.createJavassistConstructor(JavassistMemberFactory.java:213)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.JavassistReflectionFactory.createConstructor(JavassistReflectionFactory.java:108)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.JavassistConstructorInfo.newInstance(JavassistConstructorInfo.java:146)</p><p><span> </span>at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:81)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.DispatchJoinPoint.run(DispatchJoinPoint.java:47)</p><p><span> </span>at java.security.AccessController.doPrivileged(Native Method)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:54)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:67)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:1)</p><p><span> </span>at org.jboss.dependency.plugins.action.SimpleControllerContextAction.secureInstallAction(SimpleControllerContextAction.java:67)</p><p><span> </span>at org.jboss.dependency.plugins.action.AccessControllerContextAction$1.run(AccessControllerContextAction.java:80)</p><p><span> </span>at java.security.AccessController.doPrivileged(Native Method)</p><p><span> </span>at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:103)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:377)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894)</p><p><span> </span>at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:103)</p><p><span> </span>at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:97)</p><p><span> </span>at org.jboss.test.kernel.dependency.support.TestUtil.install(TestUtil.java:99)</p><p><span> </span>at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.install(OldAbstractKernelDependencyTest.java:112)</p><p><span> </span>at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.assertInstall(OldAbstractKernelDependencyTest.java:130)</p><p><span> </span>at org.jboss.test.kernel.dependency.test.OldAbstractKernelDependencyTest.assertInstall(OldAbstractKernelDependencyTest.java:123)</p><p><span> </span>at org.jboss.test.kernel.dependency.test.ConstructorClassLoaderTestCase.testConstructorClassLoaderReinstall(ConstructorClassLoaderTestCase.</p><p>java:231)</p><p><span> </span>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p><span> </span>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p><p><span> </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p><span> </span>at java.lang.reflect.Method.invoke(Method.java:597)</p><p><span> </span>at junit.framework.TestCase.runTest(TestCase.java:168)</p><p><span> </span>at junit.framework.TestCase.runBare(TestCase.java:134)</p><p><span> </span>at junit.framework.TestResult$1.protect(TestResult.java:110)</p><p><span> </span>at junit.framework.TestResult.runProtected(TestResult.java:128)</p><p><span> </span>at junit.framework.TestResult.run(TestResult.java:113)</p><p><span> </span>at junit.framework.TestCase.run(TestCase.java:124)</p><p><span> </span>at junit.framework.TestSuite.runTest(TestSuite.java:232)</p><p><span> </span>at junit.framework.TestSuite.run(TestSuite.java:227)</p><p><span> </span>at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)</p><p><span> </span>at junit.extensions.TestSetup$1.protect(TestSetup.java:23)</p><p><span> </span>at junit.framework.TestResult.runProtected(TestResult.java:128)</p><p><span> </span>at junit.extensions.TestSetup.run(TestSetup.java:27)</p><p><span> </span>at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)</p><p><span> </span>at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)</p><p><span> </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)</p><p>Caused by: java.security.PrivilegedActionException: javassist.CannotCompileException: by java.security.AccessControlException: access denied</p><p> (java.lang.RuntimePermission accessClassInPackage.sun.reflect)</p><p><span> </span>at java.security.AccessController.doPrivileged(Native Method)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory.makeClass(JavassistMemberFactory.java:281)</p><p><span> </span>... 55 more</p><p>Caused by: javassist.CannotCompileException: by java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClass</p><p>InPackage.sun.reflect)</p><p><span> </span>at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169)</p><p><span> </span>at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:136)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory$1.run(JavassistMemberFactory.java:285)</p><p><span> </span>at org.jboss.reflect.plugins.javassist.bytecode.JavassistMemberFactory$1.run(JavassistMemberFactory.java:1)</p><p><span> </span>... 57 more</p><p>Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.reflect)</p><p><span> </span>at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)</p><p><span> </span>at java.security.AccessController.checkPermission(AccessController.java:546)</p><p><span> </span>at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)</p><p><span> </span>at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1512)</p><p><span> </span>at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:327)</p><p><span> </span>at java.lang.ClassLoader.loadClass(ClassLoader.java:250)</p><p><span> </span>at org.jboss.test.classloading.vfs.VFSClassLoader.loadClass(VFSClassLoader.java:55)</p><p><span> </span>at java.lang.ClassLoader.loadClass(ClassLoader.java:250)</p><p><span> </span>at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)</p><p><span> </span>at java.lang.ClassLoader.defineClass1(Native Method)</p><p><span> </span>at java.lang.ClassLoader.defineClass(ClassLoader.java:698)</p><p><span> </span>at java.lang.ClassLoader.defineClass(ClassLoader.java:544)</p><p><span> </span>at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)</p><p><span> </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p><span> </span>at java.lang.reflect.Method.invoke(Method.java:597)</p><p><span> </span>at javassist.util.proxy.SecurityActions$6.run(SecurityActions.java:124)</p><p><span> </span>at java.security.AccessController.doPrivileged(Native Method)</p><p><span> </span>at javassist.util.proxy.SecurityActions.invokeMethod(SecurityActions.java:121)</p><p><span> </span>at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181)</p><p><span> </span>at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Is there any way around this other than adding a properties file for the test containing the permission?</p></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/534489#534489">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Microcontainer Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2115">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>