Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-58530

Library(JollyDay)'s properties file cannot be found by WebAppClassLoader in Jenkins runtime.

    Details

    • Similar Issues:

      Description

      I'm trying to use [JollyDay |https://github.com/svendiedrichsen/jollyday]to provide ability to get holidays, but its day-calculate algorithm is based on some .porperties file(typically Jollyday.properties). These files can be found in running unit test, but when running it in jenkins, they're missed.

      When looking at the stack trace, this lib is using current thread's context classloader ( WebappClassLoader)  to get resource, but the loader returned null.

      However, using HolidayCalendar(one class of JollyDay).class.getClassLoader().getResource() works fine.( But the returned URL is from my system maven repo)

      Are there anything I missed to do, like mvn install? I tryed that, but it's not the cause.

      PS, are all the temp file in the "target" dir? I guess it's because there is no jollyday.properties in the dir.

      Should I add some more config to include it? But I'm not quite clear about how to handle this.

       

      Stack Trace:

      Caused by: java.lang.NullPointerExceptionCaused by: java.lang.NullPointerException at de.jollyday.configuration.impl.DefaultConfigurationProvider.getProperties(DefaultConfigurationProvider.java:59) at de.jollyday.configuration.ConfigurationProviderManager.addInternalConfigurationProviderProperies(ConfigurationProviderManager.java:63) at de.jollyday.configuration.ConfigurationProviderManager.mergeConfigurationProperties(ConfigurationProviderManager.java:57) at de.jollyday.HolidayManager.createManager(HolidayManager.java:163) at de.jollyday.HolidayManager.getInstance(HolidayManager.java:148) at de.jollyday.HolidayManager.getInstance(HolidayManager.java:124) at org.jenkinsci.plugins.workinghours.WorkingHoursUI.getRegionHolidays(WorkingHoursUI.java:84) at org.jenkinsci.plugins.workinghours.WorkingHoursUI.doDynamic(WorkingHoursUI.java:64) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343) ... 64 more

        Attachments

          Activity

          Show
          dnusbaum Devin Nusbaum added a comment - The workaround mentioned in https://jenkins.io/doc/developer/plugin-development/dependencies-and-class-loading/#context-class-loaders might help.
          Hide
          jeffpearce Jeff Pearce added a comment -

          Thanks, Devin Nusbaum - that was the problem

          Show
          jeffpearce Jeff Pearce added a comment - Thanks, Devin Nusbaum - that was the problem

            People

            • Assignee:
              jeffpearce Jeff Pearce
              Reporter:
              shenjack Jack Shen
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: