OpenJPA
  1. OpenJPA
  2. OPENJPA-2172

openjpa-all jar is missing slf4j runtime dependency

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0, 2.2.1, 2.3.0
    • Fix Version/s: 2.2.2, 2.3.0
    • Component/s: samples, validation
    • Labels:
      None

      Description

      I just tried the JSE version of the OpenBooks example (../openjpa-examples/openbooks) and it turns out that we're missing the SLF4J runtime dependency in our openjpa-all jar file. This SLF4J dependency comes about because of our dependency on Bean Validation (bval). We're pulling in the SLF4J API from slf4j-api, but we're missing the runtime from slf4j-simple.

      There are two resolutions to this. We can modify the ../openjpa-all/pom.xml to include the following dependency:

      <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>$

      {slf4jVersion}

      </version>
      </dependency>

      Or, we can tell OpenJPA that OpenBooks does not depend on bean validation (which it doesn't). We can do this via this additional configuration property in the persistence.xml for the OpenBooks sample:

      <validation-mode>NONE</validation-mode>

      The most complete solution is to modify the pom.xml when building the openjpa-all jar. The unfortunate thing with this approach is that we have already released 2.2.0 which already is missing this slf4j runtime. Maybe we'll just have to add a "readme" to that download. We can fix it in 2.2.x and trunk though. And, if somebody hits this with the 2.2.0 release, hopefully they are not using bean validation and they can set the validation-mode to NONE.

        Issue Links

          Activity

          Hide
          Kevin Sutter added a comment -

          Based on a note from Sven Vollbehr <sven@vollbehr.eu>...

          You reported in https://issues.apache.org/jira/browse/OPENJPA-2172 that the openjpa-all.jar should include the slf4j runtime binding also. This has the following side effect. Should I want to configure SLF4J as my logging backend and then use another runtime binding, say slf4j-jdk14. Having the runtime binding in openjpa-all.jar gives me totally random results due to the following error:

          SLF4J: Class path contains multiple SLF4J bindings.
          SLF4J: Found binding in [jar:file:/C:/Users/Sven/.m2/repository/org/apache/openjpa/openjpa-all/2.2.1/openjpa-all-2.2.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
          SLF4J: Found binding in [jar:file:/C:/Users/Sven/.m2/repository/org/slf4j/slf4j-jdk14/1.7.2/slf4j-jdk14-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
          SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

          SLF4J does not support multiple bindings so having the runtime binding included in openjpa-all jar file is so not working here. Since the runtime binding is included INSIDE the jar file it cannot be excluded either. Clearly not a good thing to include it in the openjpa-all jar file wouldn’t you agree?

          Can you please re-open this issue?

          Show
          Kevin Sutter added a comment - Based on a note from Sven Vollbehr <sven@vollbehr.eu>... You reported in https://issues.apache.org/jira/browse/OPENJPA-2172 that the openjpa-all.jar should include the slf4j runtime binding also. This has the following side effect. Should I want to configure SLF4J as my logging backend and then use another runtime binding, say slf4j-jdk14. Having the runtime binding in openjpa-all.jar gives me totally random results due to the following error: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/Sven/.m2/repository/org/apache/openjpa/openjpa-all/2.2.1/openjpa-all-2.2.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/Users/Sven/.m2/repository/org/slf4j/slf4j-jdk14/1.7.2/slf4j-jdk14-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J does not support multiple bindings so having the runtime binding included in openjpa-all jar file is so not working here. Since the runtime binding is included INSIDE the jar file it cannot be excluded either. Clearly not a good thing to include it in the openjpa-all jar file wouldn’t you agree? Can you please re-open this issue?
          Hide
          ASF subversion and git services added a comment -

          Commit 1468067 from kwsutter
          [ https://svn.apache.org/r1468067 ]

          OPENJPA-2172. Remove the dependency on the slf4j runtime bundle from openjpa-all.jar. Also, modified the persistence.xml files for the OpenBooks sample to set the Validation-Mode to None (since it's not being used). This way, we can avoid the dependency altogether.

          Show
          ASF subversion and git services added a comment - Commit 1468067 from kwsutter [ https://svn.apache.org/r1468067 ] OPENJPA-2172 . Remove the dependency on the slf4j runtime bundle from openjpa-all.jar. Also, modified the persistence.xml files for the OpenBooks sample to set the Validation-Mode to None (since it's not being used). This way, we can avoid the dependency altogether.
          Hide
          ASF subversion and git services added a comment -

          Commit 1468106 from kwsutter
          [ https://svn.apache.org/r1468106 ]

          OPENJPA-2172. Modified the persistence.xml files to indicate the use of the 2.0 XSD files (in order to properly detect and support the <validation-mode> element).

          Show
          ASF subversion and git services added a comment - Commit 1468106 from kwsutter [ https://svn.apache.org/r1468106 ] OPENJPA-2172 . Modified the persistence.xml files to indicate the use of the 2.0 XSD files (in order to properly detect and support the <validation-mode> element).
          Hide
          ASF subversion and git services added a comment -

          Commit 1468108 from kwsutter
          [ https://svn.apache.org/r1468108 ]

          OPENJPA-2172. Remove the dependency on the slf4j runtime bundle from openjpa-all.jar. Also, modified the persistence.xml files for the OpenBooks sample to set the Validation-Mode to None (since it's not being used). This way, we can avoid the dependency altogether. This also required the update to the persistence.xml files to point at the JPA 2.0 xsd files.

          Show
          ASF subversion and git services added a comment - Commit 1468108 from kwsutter [ https://svn.apache.org/r1468108 ] OPENJPA-2172 . Remove the dependency on the slf4j runtime bundle from openjpa-all.jar. Also, modified the persistence.xml files for the OpenBooks sample to set the Validation-Mode to None (since it's not being used). This way, we can avoid the dependency altogether. This also required the update to the persistence.xml files to point at the JPA 2.0 xsd files.
          Hide
          ASF subversion and git services added a comment -

          Commit 1468447 from kwsutter
          [ https://svn.apache.org/r1468447 ]

          OPENJPA-2172. In order to pass the TCK, we needed to add the slf4j dependency into the TCK pom.xml.

          Show
          ASF subversion and git services added a comment - Commit 1468447 from kwsutter [ https://svn.apache.org/r1468447 ] OPENJPA-2172 . In order to pass the TCK, we needed to add the slf4j dependency into the TCK pom.xml.
          Hide
          ASF subversion and git services added a comment -

          Commit 1468449 from kwsutter
          [ https://svn.apache.org/r1468449 ]

          OPENJPA-2172. In order to pass the TCK, we needed to add the slf4j dependency into the TCK pom.xml.

          Show
          ASF subversion and git services added a comment - Commit 1468449 from kwsutter [ https://svn.apache.org/r1468449 ] OPENJPA-2172 . In order to pass the TCK, we needed to add the slf4j dependency into the TCK pom.xml.

            People

            • Assignee:
              Kevin Sutter
              Reporter:
              Kevin Sutter
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development