OpenJPA
  1. OpenJPA
  2. OPENJPA-1631

MetaDataRepository preload doesn't load JAXB meta data

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.2, 2.0.0-beta3
    • Fix Version/s: 2.0.0
    • Component/s: None
    • Labels:
      None

      Description

      The MetaDataRepository preloading doesn't process JAXB xml meta data on EMF creation, resulting in a condition where multiple threads can trample on each other. AnnotationPersistenceXMLMetaDataParser.parse(..) isn't thread-safe and relied on the MetaDataRepository to enforce synchronization. After preloading is complete, all locks are removed from the MetaDataRepository and in turn AnnotationPersistenceXMLMetaDataParser can have some threading problems.

      Caused by: java.lang.NullPointerException
      at org.apache.openjpa.lib.util.J2DoPrivHelper$56.run(J2DoPrivHelper.java:1163)
      at org.apache.openjpa.lib.util.J2DoPrivHelper$56.run(J2DoPrivHelper.java:1161)
      at java.security.AccessController.doPrivileged(AccessController.java:202)
      at org.apache.openjpa.persistence.AnnotationPersistenceXMLMetaDataParser.parseXMLClassAnnotations(AnnotationPersistenceXMLMetaDataParser.java:175)
      at org.apache.openjpa.persistence.AnnotationPersistenceXMLMetaDataParser.parse(AnnotationPersistenceXMLMetaDataParser.java:163)
      at org.apache.openjpa.persistence.PersistenceMetaDataFactory.loadXMLMetaData(PersistenceMetaDataFactory.java:579)
      at org.apache.openjpa.meta.MetaDataRepository.getXMLMetaDataInternal(MetaDataRepository.java:2376)
      at org.apache.openjpa.meta.MetaDataRepository.getXMLMetaData(MetaDataRepository.java:2364)
      at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.traversePath(AbstractExpressionBuilder.java:315)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getPath(JPQLExpressionBuilder.java:1941)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getPathOrConstant(JPQLExpressionBuilder.java:1861)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:1169)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getValue(JPQLExpressionBuilder.java:2054)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getValue(JPQLExpressionBuilder.java:2040)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:1055)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getExpression(JPQLExpressionBuilder.java:1970)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.eval(JPQLExpressionBuilder.java:997)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.evalWhereClause(JPQLExpressionBuilder.java:668)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getQueryExpressions(JPQLExpressionBuilder.java:297)
      at org.apache.openjpa.kernel.jpql.JPQLParser.eval(JPQLParser.java:67)

        Issue Links

          Activity

          Hide
          ASF subversion and git services added a comment -

          Commit 1512501 from Heath Thomann in branch 'openjpa/branches/1.2.x'
          [ https://svn.apache.org/r1512501 ]

          OPENJPA-1631: Add synchronization to AnnotationPersistenceXMLMetaDataParser.parse() method to make it thread safe - back ported to 1.2.x Rick Curtis' trunk changes.

          Show
          ASF subversion and git services added a comment - Commit 1512501 from Heath Thomann in branch 'openjpa/branches/1.2.x' [ https://svn.apache.org/r1512501 ] OPENJPA-1631 : Add synchronization to AnnotationPersistenceXMLMetaDataParser.parse() method to make it thread safe - back ported to 1.2.x Rick Curtis' trunk changes.
          Hide
          Donald Woods added a comment -

          Don't need Fix Version of 2.1.0 since 2.0.0 hasn't been released yet....

          Show
          Donald Woods added a comment - Don't need Fix Version of 2.1.0 since 2.0.0 hasn't been released yet....
          Hide
          Rick Curtis added a comment -

          Committed revision 934480 to 2.0.x.

          Show
          Rick Curtis added a comment - Committed revision 934480 to 2.0.x.
          Hide
          Rick Curtis added a comment -

          Committed revision 934100 to trunk.

          Show
          Rick Curtis added a comment - Committed revision 934100 to trunk.
          Hide
          Catalina Wei added a comment -

          The patch looks good.

          Show
          Catalina Wei added a comment - The patch looks good.
          Hide
          Rick Curtis added a comment -

          Add synchronization to AnnotationPersistenceXMLMetaDataParser.parse() method to make it thread safe.

          Show
          Rick Curtis added a comment - Add synchronization to AnnotationPersistenceXMLMetaDataParser.parse() method to make it thread safe.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development