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

Hudson fails when restarted with Active Directory enabled.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Platform: All, OS: All

      Hudson = 1.262
      Access Control = Active Directory
      Authorization = Matrix based Security

      I restart Hudson by doing the following:
      net stop "Apache Tomcat"
      net start "Apache Tomcat"

      After a restart, any attempt to access Hudson produces the following error:

      org.springframework.beans.factory.BeanCreationException: Error creating bean
      with name 'activeDirectory': Instantiation of bean failed; nested exception is
      org.springframework.beans.BeanInstantiationException: Could not instantiate bean
      class [hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider]:
      Constructor threw exception; nested exception is java.lang.UnsatisfiedLinkError:
      Native Library D:\HudsonData\plugins\active-directory\WEB-INF\lib\com4j.dll
      already loaded in another classloader
      at
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:917)
      at
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:873)
      at
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:514)
      at
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
      at java.security.AccessController.doPrivileged(Native Method)
      at
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
      at
      org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
      at
      org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
      at
      org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:413)
      at
      org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:735)
      at
      org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
      at
      hudson.util.spring.DefaultRuntimeSpringConfiguration.getApplicationContext(DefaultRuntimeSpringConfiguration.java:94)
      at hudson.util.spring.BeanBuilder.createApplicationContext(BeanBuilder.java:387)
      at
      hudson.plugins.active_directory.ActiveDirectorySecurityRealm.createSecurityComponents(ActiveDirectorySecurityRealm.java:57)
      at hudson.model.Hudson.setSecurityRealm(Hudson.java:1135)
      at hudson.model.Hudson.load(Hudson.java:1483)
      at hudson.model.Hudson.(Hudson.java:378)
      at hudson.WebAppMain$2.run(WebAppMain.java:156)
      Caused by: org.springframework.beans.BeanInstantiationException: Could not
      instantiate bean class
      [hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider]:
      Constructor threw exception; nested exception is java.lang.UnsatisfiedLinkError:
      Native Library D:\HudsonData\plugins\active-directory\WEB-INF\lib\com4j.dll
      already loaded in another classloader
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:98)
      at
      org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
      at
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:911)
      ... 19 more
      Caused by: java.lang.UnsatisfiedLinkError: Native Library
      D:\HudsonData\plugins\active-directory\WEB-INF\lib\com4j.dll already loaded in
      another classloader
      at java.lang.ClassLoader.loadLibrary0(Unknown Source)
      at java.lang.ClassLoader.loadLibrary(Unknown Source)
      at java.lang.Runtime.load0(Unknown Source)
      at java.lang.System.load(Unknown Source)
      at com4j.COM4J.loadNativeLibrary(COM4J.java:430)
      at com4j.COM4J.(COM4J.java:386)
      at
      hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.(ActiveDirectoryAuthenticationProvider.java:45)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:83)
      ... 21 more

      The only workaround I've found is to:

      1. edit config.xml and either set "<useSecurity>false</useSecurity>" or remove
      the following element:

      <securityRealm
      class="hudson.plugins.active_directory.ActiveDirectorySecurityRealm">
      <domain></domain>
      </securityRealm>

      2. Restart Hudson again. It works now, but naturally the security system is
      missing.

      3. Restore the original config.xml.

      4. Restart Hudson a second time. Hudson now works correctly, until the next
      restart.

            Unassigned Unassigned
            djcarr djcarr
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: