OpenJPA
  1. OpenJPA
  2. OPENJPA-2238

IllegalAccessError when trying to proxy a default scoped Class

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0, 2.3.0
    • Fix Version/s: 2.3.0
    • Component/s: kernel
    • Labels:
      None

      Description

      When trying to create a proxy for a type that is package protected, you'll get a IllegalAccessError when trying load the created proxy.

      The root issue is that we create all of our proxies in the org.apache.openjpa.util package, and if the default scoped type isn't in that package, we can't dynamically generate a subclass.

      <openjpa-2.3.0-SNAPSHOT-r422266:1361564M nonfatal general error> org.apache.openjpa.util.GeneralException: org.apache.openjpa.util.org$apache$openjpa$util$custom$CustomProxyDefaultScopeType$8$proxy
      at org.apache.openjpa.util.GeneratedClasses.loadBCClass(GeneratedClasses.java:71)
      at org.apache.openjpa.util.ProxyManagerImpl.getFactoryProxyBean(ProxyManagerImpl.java:475)
      at org.apache.openjpa.util.ProxyManagerImpl.newCustomProxy(ProxyManagerImpl.java:326)
      at org.apache.openjpa.util.TestProxyManager.testProxyCustomDefaultScopedType(TestProxyManager.java:356)
      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:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      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.lang.IllegalAccessError: class org.apache.openjpa.util.org$apache$openjpa$util$custom$CustomProxyDefaultScopeType$8$proxy cannot access its superclass org.apache.openjpa.util.custom.CustomProxyDefaultScopeType
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
      at serp.bytecode.BCClassLoader.findClass(BCClassLoader.java:50)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at org.apache.openjpa.util.GeneratedClasses.loadBCClass(GeneratedClasses.java:67)
      ... 21 more

        Activity

          People

          • Assignee:
            Rick Curtis
            Reporter:
            Rick Curtis
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development