Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-13187

Jar hell in classpath leads to failed tests in C++ and .NET suites

    XMLWordPrintableJSON

    Details

    • Type: Test
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.1
    • Fix Version/s: 2.9
    • Component/s: platforms
    • Labels:
      None
    • Environment:

      Apache Ignite TC.

      Description

      On some agents tests and examples start failing with this calltrace:

      [13:53:52]java.lang.NoSuchFieldError: logger
      [13:53:52]	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:723)
      [13:53:52]	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:881)
      [13:53:52]	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
      [13:53:52]	at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:381)
      [13:53:52]	at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:104)
      [13:53:52]	at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:98)
      [13:53:52]	at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:709)
      [13:53:52]	at org.apache.ignite.internal.IgnitionEx.loadConfiguration(IgnitionEx.java:767)
      [13:53:52]	at org.apache.ignite.internal.processors.platform.PlatformIgnition.configuration(PlatformIgnition.java:152)
      [13:53:52]	at org.apache.ignite.internal.processors.platform.PlatformIgnition.start(PlatformIgnition.java:67)
      

      The main reason of failure is jar-hell. When .NET or C++ tests are started, if IGNITE_NATIVE_TEST_CLASSPATH is set to true, source directory is iterated and files libs, target/classes etc.are added to classpath. But neither readdir(), FindNextFileA() or Directory.EnumerateDirectories() do guarantee any ordering. But in spring-data-2.0 and spring-data-2.2 there are different version of spring. So jar hell occurs and tests fails. 

      I created small patch that excluded spring-data from directories, that create classpath and tests start working.
      See links attached.

      diff --git a/modules/platforms/cpp/jni/os/linux/src/utils.cpp b/modules/platforms/cpp/jni/os/linux/src/utils.cpp
      index 1fcdb317d2..586c37d008 100644
      --- a/modules/platforms/cpp/jni/os/linux/src/utils.cpp
      +++ b/modules/platforms/cpp/jni/os/linux/src/utils.cpp
      @@ -183,7 +183,7 @@ namespace ignite
               {
                   std::string res;
       
      -            if (FileExists(path))
      +            if (FileExists(path) && (path.find("spring-data") == std::string::npos))
                   {
                       // 1. Append "target\classes".
                       std::string classesPath = path + "/target/classes";
      
      

        Attachments

          Activity

            People

            • Assignee:
              ivandasch Ivan Daschinskiy
              Reporter:
              ivandasch Ivan Daschinskiy
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m