JDO
  1. JDO
  2. JDO-706

No enhancer log output with maven 2

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JDO 3.1-rc1
    • Fix Version/s: JDO 3.1-rc1
    • Component/s: tck
    • Labels:
      None

      Description

      No log output for enhancement is produced. The following warnings are issued:

      [INFO] [jdo-exectck:enhance

      {execution: default-cli}

      ]
      log4j:WARN No appenders could be found for logger (DataNucleus.Enhancer).
      log4j:WARN Please initialize the log4j system properly.
      Enhancing classes for identity type datastoreidentity

      The classpath available to the enhancer does not provide access to the log properties file.

      1. jdo-706.patch
        3 kB
        Michelle Caisse
      2. jdo706.patch
        26 kB
        Michelle Caisse
      3. 20120410-211429.zip
        858 kB
        Michelle Caisse

        Activity

        Hide
        Michelle Caisse added a comment -

        The approach suggested to solving this problem is to manually add the log4j jar file to the class loader used to invoke JdoHelper.getEnhancer(ClassLoader) and to remove it from the project dependencies, so that log4j.properties file will be found in the root directory of the class loader used to load log4j. I have been able to make this approach work in a test environment; however, it entails removing springframework from the dependencies as well, since it has log4j as a transitive dependency. (To verify this, run mvn -X jdo-exectck:enhance.) I need input on how to proceed.

        Show
        Michelle Caisse added a comment - The approach suggested to solving this problem is to manually add the log4j jar file to the class loader used to invoke JdoHelper.getEnhancer(ClassLoader) and to remove it from the project dependencies, so that log4j.properties file will be found in the root directory of the class loader used to load log4j. I have been able to make this approach work in a test environment; however, it entails removing springframework from the dependencies as well, since it has log4j as a transitive dependency. (To verify this, run mvn -X jdo-exectck:enhance.) I need input on how to proceed.
        Hide
        Craig L Russell added a comment -

        From reading the log4j code, there are two places that log4j looks for the log4j.properties: the loader that loaded log4j itself; and the context class loader.

        We might have to look into the context class loader as the source for the log4j.properties.

        Show
        Craig L Russell added a comment - From reading the log4j code, there are two places that log4j looks for the log4j.properties: the loader that loaded log4j itself; and the context class loader. We might have to look into the context class loader as the source for the log4j.properties.
        Hide
        Michelle Caisse added a comment -

        log4j: Trying to find [log4j.xml] using context classloader org.codehaus.classworlds.RealmClassLoader@143d2a58.
        log4j: Trying to find [log4j.xml] using org.codehaus.classworlds.RealmClassLoader@143d2a58 class loader.
        log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
        log4j: Trying to find [log4j.properties] using context classloader org.codehaus.classworlds.RealmClassLoader@143d2a58.
        log4j: Trying to find [log4j.properties] using org.codehaus.classworlds.RealmClassLoader@143d2a58 class loader.
        log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
        log4j: Could not find resource: [null].
        log4j:WARN No appenders could be found for logger (DataNucleus.Enhancer).
        log4j:WARN Please initialize the log4j system properly.

        Show
        Michelle Caisse added a comment - log4j: Trying to find [log4j.xml] using context classloader org.codehaus.classworlds.RealmClassLoader@143d2a58. log4j: Trying to find [log4j.xml] using org.codehaus.classworlds.RealmClassLoader@143d2a58 class loader. log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource(). log4j: Trying to find [log4j.properties] using context classloader org.codehaus.classworlds.RealmClassLoader@143d2a58. log4j: Trying to find [log4j.properties] using org.codehaus.classworlds.RealmClassLoader@143d2a58 class loader. log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource(). log4j: Could not find resource: [null] . log4j:WARN No appenders could be found for logger (DataNucleus.Enhancer). log4j:WARN Please initialize the log4j system properly.
        Hide
        Craig L Russell added a comment -

        Can you try creating a class loader that has the log4j.properties (nothing else) and set it as the context class loader? I don't think anything else in the enhancer depends on the context class loader. The exectck creates a class loader from which to load the enhancer implementation, and then exectck passes another class loader to the enhancer implementation that contains the classes and metadata to enhance. So replacing the context class loader should be innocuous in this context.

        Show
        Craig L Russell added a comment - Can you try creating a class loader that has the log4j.properties (nothing else) and set it as the context class loader? I don't think anything else in the enhancer depends on the context class loader. The exectck creates a class loader from which to load the enhancer implementation, and then exectck passes another class loader to the enhancer implementation that contains the classes and metadata to enhance. So replacing the context class loader should be innocuous in this context.
        Hide
        Michelle Caisse added a comment -

        I have enhancement working with no errors or warnings now. I need to include tck/target/classes on the classpath. Without it, log4j complains that it can't find org.apache.jdo.tck.util.TCKFileAppender and the ri enhancer complains that it can't find org/apache/jdo/tck/util/DeepEquality.

        Show
        Michelle Caisse added a comment - I have enhancement working with no errors or warnings now. I need to include tck/target/classes on the classpath. Without it, log4j complains that it can't find org.apache.jdo.tck.util.TCKFileAppender and the ri enhancer complains that it can't find org/apache/jdo/tck/util/DeepEquality.
        Hide
        Michelle Caisse added a comment -

        Uploading a patch for safekeeping. This doesn't yet work, but I think it's close.

        Show
        Michelle Caisse added a comment - Uploading a patch for safekeeping. This doesn't yet work, but I think it's close.
        Hide
        Michelle Caisse added a comment -

        Runs with errors. 11/91 configurations fail. 7 failures, 34 errors out of 1724 tests. Repeated error:
        >> Error moving implementation log file Failed to delete original file 'C:\jdo_newest\datanucleus.txt' after copy to 'C:\jdo_newest\tck\target\logs\...-jdori.txt'

        Show
        Michelle Caisse added a comment - Runs with errors. 11/91 configurations fail. 7 failures, 34 errors out of 1724 tests. Repeated error: >> Error moving implementation log file Failed to delete original file 'C:\jdo_newest\datanucleus.txt' after copy to 'C:\jdo_newest\tck\target\logs\...-jdori.txt'
        Hide
        Michelle Caisse added a comment -

        I get the same errors with java 1.6.0_25. Error log files attached.

        Show
        Michelle Caisse added a comment - I get the same errors with java 1.6.0_25. Error log files attached.
        Hide
        Michelle Caisse added a comment -

        Running with correct versions of jars in top level lib/jdori/ resolves most, but not all test errors.
        asm-3.0.jar, datanucleus-core-3.0.9.jar, log4j-1.2.13.jar. datanucleus-api-jdo-3.0.7.jar, datanucleus-enhancer-3.0.1.jar, log4j.properties,datanucleus-api-jpa-3.0.8.jar datanucleus-rdbms-3.0.8.jar
        Still observer errors on pmf test, failure on jdoql test.

        Show
        Michelle Caisse added a comment - Running with correct versions of jars in top level lib/jdori/ resolves most, but not all test errors. asm-3.0.jar, datanucleus-core-3.0.9.jar, log4j-1.2.13.jar. datanucleus-api-jdo-3.0.7.jar, datanucleus-enhancer-3.0.1.jar, log4j.properties,datanucleus-api-jpa-3.0.8.jar datanucleus-rdbms-3.0.8.jar Still observer errors on pmf test, failure on jdoql test.
        Hide
        Michael Bouschen added a comment -

        I can run jdo-706.patch on Mac w/o any errors:
        Total tests run: 1798.
        All (117) configurations passed.

        However, on Windows I also see errors on pmf test and other test configurations.
        For some reason not all test configurations are executed. The summary at the bottom of the TCK-results.txt file lists less tests and less configurations:
        Total tests run: 1417. Failures: 0, Errors: 8.
        2 of 82 configurations failed.
        During the mvn install run I see errors on the commad line:
        *> Running tests for pm.conf with datastoreidentity on 'derby' mapping= ... Exception on command [java, -cp, /D:/users/michael/.m2/repository/org/apache/jdo/jdo-exectck/1.0-SNAPSHOT/jdo-exectck-1.0-SNAPSHOT.jar;/D:/users/michael/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar;...
        These tests do not occur in TCK-results.txt and there are no log files for these tests.

        Any idea what is different on Windows?

        Show
        Michael Bouschen added a comment - I can run jdo-706.patch on Mac w/o any errors: Total tests run: 1798. All (117) configurations passed. However, on Windows I also see errors on pmf test and other test configurations. For some reason not all test configurations are executed. The summary at the bottom of the TCK-results.txt file lists less tests and less configurations: Total tests run: 1417. Failures: 0, Errors: 8. 2 of 82 configurations failed. During the mvn install run I see errors on the commad line: *> Running tests for pm.conf with datastoreidentity on 'derby' mapping= ... Exception on command [java, -cp, /D:/users/michael/.m2/repository/org/apache/jdo/jdo-exectck/1.0-SNAPSHOT/jdo-exectck-1.0-SNAPSHOT.jar;/D:/users/michael/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar;... These tests do not occur in TCK-results.txt and there are no log files for these tests. Any idea what is different on Windows?
        Hide
        Michelle Caisse added a comment -

        Andy's guess that the issues on Windows have to do with its limitation on command length appears to be a good one. With a web search I find this, for example:

        "When I launch our application in Eclipse on Windows I receive the following error:

        Exception occured executing command line.

        Cannot run program .. : CreateProcess error=87, The parameter is incorrect

        I've solved this in the past by shortening the CLASSPATH.

        I've now come to a point where I can no longer shorten the CLASSPATH, and would like to know if there are any other workarounds.

        http://support.microsoft.com/kb/830473 seems to indicate that the max command prompt line length in windows xp is 8191 characters, and the only solution is to shorten folder names, reduce depth of folder trees, using parameter files, etc."

        exectck displays the command line for each test, so we can check that and see what might be truncated for the failing tests.

        Show
        Michelle Caisse added a comment - Andy's guess that the issues on Windows have to do with its limitation on command length appears to be a good one. With a web search I find this, for example: "When I launch our application in Eclipse on Windows I receive the following error: Exception occured executing command line. Cannot run program .. : CreateProcess error=87, The parameter is incorrect I've solved this in the past by shortening the CLASSPATH. I've now come to a point where I can no longer shorten the CLASSPATH, and would like to know if there are any other workarounds. http://support.microsoft.com/kb/830473 seems to indicate that the max command prompt line length in windows xp is 8191 characters, and the only solution is to shorten folder names, reduce depth of folder trees, using parameter files, etc." exectck displays the command line for each test, so we can check that and see what might be truncated for the failing tests.
        Hide
        Michelle Caisse added a comment -

        With the attached patch, all configurations and tests run on Windows, but there are still errors:
        Total tests run: 1798. Failures: 2, Errors: 12.
        4 of 117 configurations failed.

        I wonder if these have to do with the file separator character.

        Show
        Michelle Caisse added a comment - With the attached patch, all configurations and tests run on Windows, but there are still errors: Total tests run: 1798. Failures: 2, Errors: 12. 4 of 117 configurations failed. I wonder if these have to do with the file separator character.
        Hide
        Michael Bouschen added a comment -

        I get different results when running the latest patch on WIndows. Only pmf.conf is failing for applicationidentity and datastoreidentity:
        Total tests run: 1798. Failures: 0, Errors: 8.
        2 of 117 configurations failed.
        When running on mac all configurations pass.

        It looks like with the patch the datanucleus log file is generate with the expected filename (e.g. app-jdoql-datanucleus.txt). I think this is the reason for the error messages:
        Error moving implementation log file Source '/Users/mbouschen/Projects/JDO/workspace/jdo/trunk/datanucleus.txt' does not exist

        Show
        Michael Bouschen added a comment - I get different results when running the latest patch on WIndows. Only pmf.conf is failing for applicationidentity and datastoreidentity: Total tests run: 1798. Failures: 0, Errors: 8. 2 of 117 configurations failed. When running on mac all configurations pass. It looks like with the patch the datanucleus log file is generate with the expected filename (e.g. app-jdoql-datanucleus.txt). I think this is the reason for the error messages: Error moving implementation log file Source '/Users/mbouschen/Projects/JDO/workspace/jdo/trunk/datanucleus.txt' does not exist
        Hide
        Michelle Caisse added a comment -

        The patch (with some modifications) has been checked in, along with changes to AbstractGetPMF to fix the test errors due to mismatched file separator characters. To run the TCK, you must place the following files (or latest versions thereof) in the top-level lib/jdori:

        asm-3.0.jar
        datanucleus-core-3.0.9.jar
        log4j-1.2.13.jar
        datanucleus-api-jdo-3.0.7.jar
        datanucleus-enhancer-3.0.1.jar
        log4j.properties
        datanucleus-api-jpa-3.0.8.jar
        datanucleus-rdbms-3.0.8.jar

        Show
        Michelle Caisse added a comment - The patch (with some modifications) has been checked in, along with changes to AbstractGetPMF to fix the test errors due to mismatched file separator characters. To run the TCK, you must place the following files (or latest versions thereof) in the top-level lib/jdori: asm-3.0.jar datanucleus-core-3.0.9.jar log4j-1.2.13.jar datanucleus-api-jdo-3.0.7.jar datanucleus-enhancer-3.0.1.jar log4j.properties datanucleus-api-jpa-3.0.8.jar datanucleus-rdbms-3.0.8.jar
        Hide
        Andy Jefferson added a comment -

        Perhaps you should also remove connection pooling jar(s) from top-level pom.xml and put them into the "lib/jdori" area too? After all they are for use with the RI.

        All works on Linux

        Show
        Andy Jefferson added a comment - Perhaps you should also remove connection pooling jar(s) from top-level pom.xml and put them into the "lib/jdori" area too? After all they are for use with the RI. All works on Linux
        Hide
        Michelle Caisse added a comment -

        Patch removes connection pooling jars from maven dependencies, updates README.html

        Show
        Michelle Caisse added a comment - Patch removes connection pooling jars from maven dependencies, updates README.html
        Hide
        Andy Jefferson added a comment -

        Works fine with that patch. Thx.

        Before commit I would suggest the README.html is updated further to remove the "commons-dbcp", "commons-pool" jars since the "jdori-pmf.properties" (and the other two equivalents in src/conf) has selected C3P0 as the connection pool in use for the RI, so DBCP (commons-dbcp, commons-pool) is not needed at all

        Show
        Andy Jefferson added a comment - Works fine with that patch. Thx. Before commit I would suggest the README.html is updated further to remove the "commons-dbcp", "commons-pool" jars since the "jdori-pmf.properties" (and the other two equivalents in src/conf) has selected C3P0 as the connection pool in use for the RI, so DBCP (commons-dbcp, commons-pool) is not needed at all
        Hide
        Michael Bouschen added a comment -

        I could successfully run the patch on Mac and on Windows:
        Total tests run: 1798.
        All (117) configurations passed.
        I do not see any errors when running the query tests on Windows.

        Show
        Michael Bouschen added a comment - I could successfully run the patch on Mac and on Windows: Total tests run: 1798. All (117) configurations passed. I do not see any errors when running the query tests on Windows.
        Hide
        Michelle Caisse added a comment -

        Modified patch checked in.

        The issue remains open in the hope of finding a way to make it easier for users to obtain the jars that now must be manually copied to lib/jdori.

        Show
        Michelle Caisse added a comment - Modified patch checked in. The issue remains open in the hope of finding a way to make it easier for users to obtain the jars that now must be manually copied to lib/jdori.
        Hide
        Michael Bouschen added a comment -

        I checked in the patch adding a new module copyjdorijars.

        Show
        Michael Bouschen added a comment - I checked in the patch adding a new module copyjdorijars.

          People

          • Assignee:
            Michelle Caisse
            Reporter:
            Michelle Caisse
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development