OpenJPA
  1. OpenJPA
  2. OPENJPA-1121

Enums cause a ClassNotFoundException in the MappingTool

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.3.0, 2.0.0-M3
    • Component/s: jpa, tooling
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      see: http://n2.nabble.com/mapping-tool---enums--trunk-td2138657.html#a2138657

      ant trace:
      Buildfile: C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build.xml
      clean:
      [delete] Deleting directory C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build
      init:
      build:
      [mkdir] Created dir: C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build\model
      [mkdir] Created dir: C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build\java
      [mkdir] Created dir: C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build\conf
      [javac] Compiling 3 source files to C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build\model
      [javac] Compiling 1 source file to C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build\java
      [copy] Copying 1 file to C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build\conf
      schema:
      [mkdir] Created dir: C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build\sql
      [openjpa:mappingtool] 10 default TRACE [main] openjpa.Runtime - Setting the following properties from "file:/C:/Development/projects/oopex/projectroot/image/openjpa1-jpa/fields-enum/build/conf/META-INF/persistence.xml" into configuration:

      {openjpa.ConnectionPassword=, openjpa.ConnectionDriverName=org.h2.Driver, javax.persistence.provider=org.apache.openjpa.persistence.PersistenceProviderImpl, openjpa.MetaDataFactory=jpa(Types=oopex.openjpa1.jpa.fields.model.Person), openjpa.jdbc.Schema=TEST, openjpa.Log=File=stdout, DefaultLevel=WARN, Runtime=TRACE, SQL=TRACE, DataCache=TRACE, Tool=INFO, openjpa.jdbc.DBDictionary=oracle(MaxEmbeddedBlobSize=-1), openjpa.ConnectionUserName=sa, openjpa.ConnectionURL=jdbc:h2:tcp://localhost:9092/sample, openjpa.Id=default}

      [openjpa:mappingtool] 36 default INFO [main] openjpa.Tool - No targets were given. Running on all classes listed in your configuration, or all persistent classes in the classpath if no classes are configured. Use -help to display tool usage information.
      [openjpa:mappingtool] 48 default TRACE [main] openjpa.Runtime - No cache marshaller found for id org.apache.openjpa.conf.MetaDataCacheMaintenance.
      [openjpa:mappingtool] 259 default INFO [main] openjpa.Tool - Mapping tool running on type "class oopex.openjpa1.jpa.fields.model.Person" with action "buildSchema".
      [openjpa:mappingtool] 259 default TRACE [main] openjpa.Runtime - No cache marshaller found for id org.apache.openjpa.conf.MetaDataCacheMaintenance.
      [openjpa:mappingtool] java.lang.NoClassDefFoundError: Loopex/openjpa1/jpa/fields/enums/State;
      [openjpa:mappingtool] at java.lang.Class.getDeclaredFields0(Native Method)
      [openjpa:mappingtool] at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
      [openjpa:mappingtool] at java.lang.Class.getDeclaredFields(Class.java:1743)
      [openjpa:mappingtool] at org.apache.openjpa.lib.util.J2DoPrivHelper$7.run(J2DoPrivHelper.java:270)
      [openjpa:mappingtool] at java.security.AccessController.doPrivileged(Native Method)
      [openjpa:mappingtool] at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.getAccessType(PersistenceMetaDataDefaults.java:262)
      [openjpa:mappingtool] at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.getAccessType(PersistenceMetaDataDefaults.java:250)
      [openjpa:mappingtool] at org.apache.openjpa.meta.AbstractMetaDataDefaults.populate(AbstractMetaDataDefaults.java:155)
      [openjpa:mappingtool] at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.populate(PersistenceMetaDataDefaults.java:227)
      [openjpa:mappingtool] at org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.java:794)
      [openjpa:mappingtool] at org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.java:780)
      [openjpa:mappingtool] at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.getMetaData(AnnotationPersistenceMetaDataParser.java:657)
      [openjpa:mappingtool] at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:480)
      [openjpa:mappingtool] at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:352)
      [openjpa:mappingtool] at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:229)
      [openjpa:mappingtool] at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:474)
      [openjpa:mappingtool] at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:294)
      [openjpa:mappingtool] at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:285)
      [openjpa:mappingtool] at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:676)
      [openjpa:mappingtool] at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:748)
      [openjpa:mappingtool] at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:646)
      [openjpa:mappingtool] at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1072)
      [openjpa:mappingtool] at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java:205)
      [openjpa:mappingtool] at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)
      [openjpa:mappingtool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      [openjpa:mappingtool] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [openjpa:mappingtool] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      [openjpa:mappingtool] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      [openjpa:mappingtool] at java.lang.reflect.Method.invoke(Method.java:597)
      [openjpa:mappingtool] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      [openjpa:mappingtool] at org.apache.tools.ant.Task.perform(Task.java:348)
      [openjpa:mappingtool] at org.apache.tools.ant.Target.execute(Target.java:357)
      [openjpa:mappingtool] at org.apache.tools.ant.Target.performTasks(Target.java:385)
      [openjpa:mappingtool] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
      [openjpa:mappingtool] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
      [openjpa:mappingtool] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      [openjpa:mappingtool] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
      [openjpa:mappingtool] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
      [openjpa:mappingtool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
      [openjpa:mappingtool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
      [openjpa:mappingtool] Caused by: java.lang.ClassNotFoundException: oopex.openjpa1.jpa.fields.enums.State
      [openjpa:mappingtool] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1383)
      [openjpa:mappingtool] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1324)
      [openjpa:mappingtool] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1072)
      [openjpa:mappingtool] at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
      [openjpa:mappingtool] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      [openjpa:mappingtool] at java.lang.Class.forName0(Native Method)
      [openjpa:mappingtool] at java.lang.Class.forName(Class.java:247)
      [openjpa:mappingtool] at org.apache.openjpa.lib.util.TemporaryClassLoader.loadClass(TemporaryClassLoader.java:77)
      [openjpa:mappingtool] at org.apache.openjpa.lib.util.TemporaryClassLoader.loadClass(TemporaryClassLoader.java:44)
      [openjpa:mappingtool] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      [openjpa:mappingtool] ... 40 more

      BUILD FAILED
      C:\Development\projects\oopex\projectroot\image\openjpa1-jpa\fields-enum\build.xml:91: java.lang.NoClassDefFoundError: Loopex/openjpa1/jpa/fields/enums/State;

      Total time: 2 seconds

      1. TemporaryClassLoader.patch
        1 kB
        Frank Schwarz
      2. fields-enum-trunk.zip
        19 kB
        Frank Schwarz
      3. fields-enum.zip
        27 kB
        Frank Schwarz

        Activity

        Hide
        Frank Schwarz added a comment -

        reproducer

        Show
        Frank Schwarz added a comment - reproducer
        Hide
        Pinaki Poddar added a comment -

        works on trunk.
        Possible to switch to tunk and verify?

        Show
        Pinaki Poddar added a comment - works on trunk. Possible to switch to tunk and verify?
        Hide
        Frank Schwarz added a comment -

        Also with trunk (r800568)

        java.lang.NoClassDefFoundError: Loopex/openjpa2/jpa2/fields/enums/State;
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
        at java.lang.Class.getDeclaredFields(Class.java:1743)
        at org.apache.openjpa.lib.util.J2DoPrivHelper$7.run(J2DoPrivHelper.java:292)
        at org.apache.openjpa.lib.util.J2DoPrivHelper$7.run(J2DoPrivHelper.java:290)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.determineImplicitAccessType(PersistenceMetaDataDefaults.java:339)
        at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.determineAccessType(PersistenceMetaDataDefaults.java:308)
        at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.populate(PersistenceMetaDataDefaults.java:250)
        at org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.java:809)
        at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.getMetaData(AnnotationPersistenceMetaDataParser.java:744)
        at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:545)
        at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:416)
        at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:260)
        at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:489)
        at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:309)
        at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:289)
        at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:676)
        at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:748)
        at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:646)
        at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1072)
        at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java:205)
        at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:171)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        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 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.Main.runBuild(Main.java:758)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
        Caused by: java.lang.ClassNotFoundException: oopex.openjpa2.jpa2.fields.enums.State
        at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
        at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
        at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1088)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at org.apache.openjpa.lib.util.TemporaryClassLoader.loadClass(TemporaryClassLoader.java:77)
        at org.apache.openjpa.lib.util.TemporaryClassLoader.loadClass(TemporaryClassLoader.java:44)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 40 more

        Show
        Frank Schwarz added a comment - Also with trunk (r800568) java.lang.NoClassDefFoundError: Loopex/openjpa2/jpa2/fields/enums/State; at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2291) at java.lang.Class.getDeclaredFields(Class.java:1743) at org.apache.openjpa.lib.util.J2DoPrivHelper$7.run(J2DoPrivHelper.java:292) at org.apache.openjpa.lib.util.J2DoPrivHelper$7.run(J2DoPrivHelper.java:290) at java.security.AccessController.doPrivileged(Native Method) at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.determineImplicitAccessType(PersistenceMetaDataDefaults.java:339) at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.determineAccessType(PersistenceMetaDataDefaults.java:308) at org.apache.openjpa.persistence.PersistenceMetaDataDefaults.populate(PersistenceMetaDataDefaults.java:250) at org.apache.openjpa.meta.MetaDataRepository.addMetaData(MetaDataRepository.java:809) at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.getMetaData(AnnotationPersistenceMetaDataParser.java:744) at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:545) at org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:416) at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:260) at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:489) at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:309) at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:289) at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:676) at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:748) at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:646) at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1072) at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java:205) at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:171) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) 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 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.apache.tools.ant.Main.runBuild(Main.java:758) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Caused by: java.lang.ClassNotFoundException: oopex.openjpa2.jpa2.fields.enums.State at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400) at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1088) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at org.apache.openjpa.lib.util.TemporaryClassLoader.loadClass(TemporaryClassLoader.java:77) at org.apache.openjpa.lib.util.TemporaryClassLoader.loadClass(TemporaryClassLoader.java:44) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 40 more
        Hide
        Frank Schwarz added a comment -

        Patch attached. This is a hack of the hack from bug OPENJPA-646.

        Show
        Frank Schwarz added a comment - Patch attached. This is a hack of the hack from bug OPENJPA-646 .
        Hide
        Jan-Kees van Andel added a comment -

        Same issue here, I'm using 2.0.0-M3.

        It's currently preventing me of using any annotations in my entities.

        Show
        Jan-Kees van Andel added a comment - Same issue here, I'm using 2.0.0-M3. It's currently preventing me of using any annotations in my entities.

          People

          • Assignee:
            Donald Woods
            Reporter:
            Frank Schwarz
          • Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development