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

Hudson fails when restarted with Active Directory enabled.

    • 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.

          [JENKINS-2708] Hudson fails when restarted with Active Directory enabled.

          djcarr created issue -

          djcarr added a comment -

          wrong subcategory

          djcarr added a comment - wrong subcategory

          djcarr added a comment -

          wrong owner

          djcarr added a comment - wrong owner

          This doesn't make sense. When you stop Tomcat, its JVM exits. So there's nothing
          that "remembers" what the previous execution about.

          Whereas you report that the behavior differs with the same config.xml, depending
          on what its previous execution was like.

          Do you have other plugins installed? Perhaps there's some interference along
          that line?

          Kohsuke Kawaguchi added a comment - This doesn't make sense. When you stop Tomcat, its JVM exits. So there's nothing that "remembers" what the previous execution about. Whereas you report that the behavior differs with the same config.xml, depending on what its previous execution was like. Do you have other plugins installed? Perhaps there's some interference along that line?
          Kohsuke Kawaguchi made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Marked as closed because there's no further input from the reporter.

          If someone else sees a similar problem, please feel free to reopen.

          Kohsuke Kawaguchi added a comment - Marked as closed because there's no further input from the reporter. If someone else sees a similar problem, please feel free to reopen.
          Kohsuke Kawaguchi made changes -
          Resolution New: Postponed [ 6 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

          didi316 added a comment -

          This exception happens for me too now.
          I am running hudson on a tomcat 6 server and I restarted Hudson and the
          exception occurred. I furhter tried to restart tomcat but that didn't change
          anything too.

          A thing that I did (tried to remove the changes again but the exception still
          occurs) is that I changed the server.xml from tomcat by adding UTF8 stuff:

          from:
          <Connector port="8080" protocol="HTTP/1.1"
          connectionTimeout="20000"
          redirectPort="8443"/>
          to
          <Connector port="8080" protocol="HTTP/1.1"
          connectionTimeout="20000"
          redirectPort="8443"
          URIEncoding="UTF-8" />

          but I don't think that this had any influence...

          I have several other Plugins installed on my system (Perforce, Nant, MSBuild,
          Nunit, Disk Space, Additional Sidebar, Active Directory,...)

          didi316 added a comment - This exception happens for me too now. I am running hudson on a tomcat 6 server and I restarted Hudson and the exception occurred. I furhter tried to restart tomcat but that didn't change anything too. A thing that I did (tried to remove the changes again but the exception still occurs) is that I changed the server.xml from tomcat by adding UTF8 stuff: from: <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/> to <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> but I don't think that this had any influence... I have several other Plugins installed on my system (Perforce, Nant, MSBuild, Nunit, Disk Space, Additional Sidebar, Active Directory,...)
          didi316 made changes -
          Resolution Original: Postponed [ 6 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

          didi316 added a comment -

          I commented the following info in the config.xml and hudson starts up correctly
          again:
          <authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/>
          <securityRealm
          class="hudson.plugins.active_directory.ActiveDirectorySecurityRealm"/>

          but when trying to enable active directory again I get a 500 error in the UI

          javax.servlet.ServletException:
          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 C:\Dokumente und Einstellungen\Default
          User\.hudson\plugins\active-directory\WEB-INF\lib\com4j.dll already loaded in
          another classloader

          and further on - as it is already posted in this defect

          I'm using 1.309

          didi316 added a comment - I commented the following info in the config.xml and hudson starts up correctly again: <authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/> <securityRealm class="hudson.plugins.active_directory.ActiveDirectorySecurityRealm"/> but when trying to enable active directory again I get a 500 error in the UI javax.servlet.ServletException: 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 C:\Dokumente und Einstellungen\Default User\.hudson\plugins\active-directory\WEB-INF\lib\com4j.dll already loaded in another classloader and further on - as it is already posted in this defect I'm using 1.309

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

              Created:
              Updated: