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

Can't create or modify jobs with jobConfigHistory plugin testing with "mvn hpi:run"

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • Mac OS X 10.5.8, 4GB RAM, Java 1.6.
      Firefox 3.5.7
      Also seen on red-hat linux running jdk 1.6.
      Also seen on Windows XP running jdk 1.6.
      Also seen on MacOSX 10.6.6 running jdk 1.6

      I am running the jobConfigHistory plugin with mvn hpi:run from within IntelliJ IDEA 9.
      I cannot create a new job or modify an existing job; I get a 500 error every time.
      To reproduce:
      1) Run with mvn hpi:run
      2) go to http://localhost:8080/view/All/newJob
      3) enter a unique job name
      4) click "Build a free-style software project"
      5) click OK

      My browser then goes to http://localhost:8080/view/All/createItem
      and contains this stack trace (there's more bug report after the stack trace):

      HTTP ERROR: 500

      Operation Changed on noon36 did not succeed

      RequestURI=/view/All/createItem
      Caused by:

      java.lang.RuntimeException: Operation Changed on noon36 did not succeed
      at hudson.plugins.jobConfigHistory.ConfigHistoryListenerHelper.createNewHistoryEntry(ConfigHistoryListenerHelper.java:123)
      at hudson.plugins.jobConfigHistory.JobConfigHistorySaveableListener.onChange(JobConfigHistorySaveableListener.java:27)
      at hudson.model.listeners.SaveableListener.fireOnChange(SaveableListener.java:80)
      at hudson.model.AbstractItem.save(AbstractItem.java:220)
      at hudson.model.Hudson.createProject(Hudson.java:1975)
      at hudson.model.Hudson.createProject(Hudson.java:1952)
      at hudson.model.Hudson.doCreateItem(Hudson.java:2518)
      at hudson.model.AllView.doCreateItem(AllView.java:73)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:185)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:101)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:54)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:74)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:492)
      at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:180)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:492)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:408)
      at org.kohsuke.stapler.Stapler.service(Stapler.java:117)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:94)
      at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:86)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
      at org.mortbay.jetty.Server.handle(Server.java:285)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:628)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
      at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
      Caused by: java.io.IOException: Failed to detect encoding of /Users/bshine/src/os-hudson/plugins/jobConfigHistory/./work/jobs/noon36/config.xml
      at hudson.XmlFile.sniffEncoding(XmlFile.java:272)
      at hudson.XmlFile.readRaw(XmlFile.java:197)
      at hudson.XmlFile.writeRawTo(XmlFile.java:214)
      at hudson.XmlFile.asString(XmlFile.java:205)
      at hudson.plugins.jobConfigHistory.ConfigHistoryListenerHelper.createNewHistoryEntry(ConfigHistoryListenerHelper.java:103)
      ... 50 more

      Caused by:

      java.io.IOException: Failed to detect encoding of /Users/bshine/src/os-hudson/plugins/jobConfigHistory/./work/jobs/noon36/config.xml
      at hudson.XmlFile.sniffEncoding(XmlFile.java:272)
      at hudson.XmlFile.readRaw(XmlFile.java:197)
      at hudson.XmlFile.writeRawTo(XmlFile.java:214)
      at hudson.XmlFile.asString(XmlFile.java:205)
      at hudson.plugins.jobConfigHistory.ConfigHistoryListenerHelper.createNewHistoryEntry(ConfigHistoryListenerHelper.java:103)
      at hudson.plugins.jobConfigHistory.JobConfigHistorySaveableListener.onChange(JobConfigHistorySaveableListener.java:27)
      at hudson.model.listeners.SaveableListener.fireOnChange(SaveableListener.java:80)
      at hudson.model.AbstractItem.save(AbstractItem.java:220)
      at hudson.model.Hudson.createProject(Hudson.java:1975)
      at hudson.model.Hudson.createProject(Hudson.java:1952)
      at hudson.model.Hudson.doCreateItem(Hudson.java:2518)
      at hudson.model.AllView.doCreateItem(AllView.java:73)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:185)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:101)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:54)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:74)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:492)
      at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:180)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:492)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:408)
      at org.kohsuke.stapler.Stapler.service(Stapler.java:117)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:94)
      at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:86)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
      at org.mortbay.jetty.Server.handle(Server.java:285)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:628)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
      at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)

      Powered by Jetty://
      ...
      After doing this, while the browser is still on the 500 page, I examine the file on disk:
      ~/src/os-hudson/hudson/main $ ls -l /Users/bshine/src/os-hudson/plugins/jobConfigHistory/./work/jobs/noon36/config.xml
      rw-rr- 1 bshine users 406 Feb 3 12:36 /Users/bshine/src/os-hudson/plugins/jobConfigHistory/./work/jobs/noon36/config.xml

      Actually looking at the contents of the file, it looks reasonable:
      ore /Users/bshine/src/os-hudson/plugins/jobConfigHistory/./work/jobs/noon36/config.xml
      <?xml version='1.0' encoding='UTF-8'?>
      <project>
      <keepDependencies>false</keepDependencies>
      <properties/>
      <scm class="hudson.scm.NullSCM"/>
      <canRoam>false</canRoam>
      <disabled>false</disabled>
      <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
      <triggers class="vector"/>
      <concurrentBuild>false</concurrentBuild>
      <builders/>
      <publishers/>
      <buildWrappers/>
      </project>

      Returning to http://localhost:8080/ the job I just created ("noon36") does not exist in the list of jobs.

          [JENKINS-5488] Can't create or modify jobs with jobConfigHistory plugin testing with "mvn hpi:run"

          I get a similar error message on Windows as well:

          Caused by: java.io.IOException: Failed to detect encoding of c:\Dev\ws\hudson-jobConfigHistory\.\work\jobs\noon36\config.xml
          	at hudson.XmlFile.sniffEncoding(XmlFile.java:272)
          	at hudson.XmlFile.readRaw(XmlFile.java:197)
          	at hudson.XmlFile.writeRawTo(XmlFile.java:214)
          	at hudson.XmlFile.asString(XmlFile.java:205)
          	at hudson.plugins.jobConfigHistory.ConfigHistoryListenerHelper.createNewHistoryEntry(ConfigHistoryListenerHelper.java:103)
          	... 46 more
          

          However this seems to be connected to hpi:run (the plugin is running fine with winstone and the testcases are handling job creation as well) and my first guess would be that encoding issues of the hpi:run mode

          Mirko Friedenhagen added a comment - I get a similar error message on Windows as well: Caused by: java.io.IOException: Failed to detect encoding of c:\Dev\ws\hudson-jobConfigHistory\.\work\jobs\noon36\config.xml at hudson.XmlFile.sniffEncoding(XmlFile.java:272) at hudson.XmlFile.readRaw(XmlFile.java:197) at hudson.XmlFile.writeRawTo(XmlFile.java:214) at hudson.XmlFile.asString(XmlFile.java:205) at hudson.plugins.jobConfigHistory.ConfigHistoryListenerHelper.createNewHistoryEntry(ConfigHistoryListenerHelper.java:103) ... 46 more However this seems to be connected to hpi:run (the plugin is running fine with winstone and the testcases are handling job creation as well) and my first guess would be that encoding issues of the hpi:run mode

          Setting the priority from blocker to major as only the invocation via hpi:run seems to be affected.

          Mirko Friedenhagen added a comment - Setting the priority from blocker to major as only the invocation via hpi:run seems to be affected.

          Same issue on MacOSX:

          [mirko@borg hudson-jobConfigHistory]$ mvn hpi:run
          [INFO] Scanning for projects...
          [INFO] ------------------------------------------------------------------------
          [INFO] Building Hudson Job Configuration History Plugin
          [INFO]    task-segment: [hpi:run]
          [INFO] ------------------------------------------------------------------------
          [INFO] Preparing hpi:run
          [INFO] [enforcer:display-info {execution: default}]
          [INFO] Maven Version: 2.2.1
          [INFO] JDK Version: 1.6.0_17 normalized as: 1.6.0-17
          [INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.6.2
          [INFO] [localizer:generate {execution: default}]
          [INFO] [resources:resources {execution: default-resources}]
          [INFO] Using 'UTF-8' encoding to copy filtered resources.
          [INFO] Copying 7 resources
          ...
          Caused by: java.io.IOException: Failed to detect encoding of /Users/mirko/Documents/workspace/hudson-jobConfigHistory/./work/jobs/noon36/config.xml
          	at hudson.XmlFile.sniffEncoding(XmlFile.java:272)
          	at hudson.XmlFile.readRaw(XmlFile.java:197)
          	at hudson.XmlFile.writeRawTo(XmlFile.java:214)
          	at hudson.XmlFile.asString(XmlFile.java:205)
          	at hudson.plugins.jobConfigHistory.ConfigHistoryListenerHelper.createNewHistoryEntry(ConfigHistoryListenerHelper.java:103)
          

          Mirko Friedenhagen added a comment - Same issue on MacOSX: [mirko@borg hudson-jobConfigHistory]$ mvn hpi:run [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Hudson Job Configuration History Plugin [INFO] task-segment: [hpi:run] [INFO] ------------------------------------------------------------------------ [INFO] Preparing hpi:run [INFO] [enforcer:display-info {execution: default }] [INFO] Maven Version: 2.2.1 [INFO] JDK Version: 1.6.0_17 normalized as: 1.6.0-17 [INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.6.2 [INFO] [localizer:generate {execution: default }] [INFO] [resources:resources {execution: default -resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 7 resources ... Caused by: java.io.IOException: Failed to detect encoding of /Users/mirko/Documents/workspace/hudson-jobConfigHistory/./work/jobs/noon36/config.xml at hudson.XmlFile.sniffEncoding(XmlFile.java:272) at hudson.XmlFile.readRaw(XmlFile.java:197) at hudson.XmlFile.writeRawTo(XmlFile.java:214) at hudson.XmlFile.asString(XmlFile.java:205) at hudson.plugins.jobConfigHistory.ConfigHistoryListenerHelper.createNewHistoryEntry(ConfigHistoryListenerHelper.java:103)

          I stepped with remote debugging through mvn hpi:run and the locator injected in the inner class DefaultHandler of hudson.XmlFile.sniffEncoding is not an instance of org.xml.sax.ext.Locator2.

          Mirko Friedenhagen added a comment - I stepped with remote debugging through mvn hpi:run and the locator injected in the inner class DefaultHandler of hudson.XmlFile.sniffEncoding is not an instance of org.xml.sax.ext.Locator2 .

          Mirko Friedenhagen added a comment - - edited

          I now stepped in hudson.plugins.jobConfigHistory.JobConfigHistoryJobListenerTest.testCreation() and the locator had the same class org.apache.xerces.parsers.AbstractSAXParser$LocatorProxy (which here implemented the org.xml.sax.ext.Locator2 interface}} as the one in the mvn hpi:run invocation.

          Mirko Friedenhagen added a comment - - edited I now stepped in hudson.plugins.jobConfigHistory.JobConfigHistoryJobListenerTest.testCreation() and the locator had the same class org.apache.xerces.parsers.AbstractSAXParser$LocatorProxy (which here implemented the org.xml.sax.ext.Locator2 interface}} as the one in the mvn hpi:run invocation.

          Mirko Friedenhagen added a comment - - edited

          With mvn hpi:run the fLocator field of org.apache.xerces.parsers.AbstractSAXParser$LocatorProx is of type org.apache.xerces.impl.XMLEntityManager$EntityScanner whereas in the unittest invocation it is of type org.apache.xerces.impl.XMLEntityScanner.

          Interestingly during my debug session of mvn hpi:run in Eclipse the class org.apache.xerces.impl.XMLEntityManager$EntityScanner could not be found.

          Mirko Friedenhagen added a comment - - edited With mvn hpi:run the fLocator field of org.apache.xerces.parsers.AbstractSAXParser$LocatorProx is of type org.apache.xerces.impl.XMLEntityManager$EntityScanner whereas in the unittest invocation it is of type org.apache.xerces.impl.XMLEntityScanner . Interestingly during my debug session of mvn hpi:run in Eclipse the class org.apache.xerces.impl.XMLEntityManager$EntityScanner could not be found.

          This is propably the same bug.

          Mirko Friedenhagen added a comment - This is propably the same bug.

          Code changed in hudson
          User: : mfriedenhagen
          Path:
          trunk/hudson/plugins/jobConfigHistory/src/main/java/hudson/plugins/jobConfigHistory/ConfigHistoryListenerHelper.java
          http://jenkins-ci.org/commit/27236
          Log:
          Workaround for JENKINS-5488.
          The real error is probably in the core.
          Diffing configurations still fails during hudson.XmlFile.sniffEncoding().

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mfriedenhagen Path: trunk/hudson/plugins/jobConfigHistory/src/main/java/hudson/plugins/jobConfigHistory/ConfigHistoryListenerHelper.java http://jenkins-ci.org/commit/27236 Log: Workaround for JENKINS-5488 . The real error is probably in the core. Diffing configurations still fails during hudson.XmlFile.sniffEncoding().

          I think this is actually a bug in the core, http://fisheye.jenkins-ci.org/changelog/Hudson/?cs=27236 is a workaround for the copy process, however diffing still fails.

          Mirko Friedenhagen added a comment - I think this is actually a bug in the core, http://fisheye.jenkins-ci.org/changelog/Hudson/?cs=27236 is a workaround for the copy process, however diffing still fails.

          I close this bug, as it is a bug in the core and not in this plugin.
          @bshine: if you think this is not correct, please reopen this issue.

          Mirko Friedenhagen added a comment - I close this bug, as it is a bug in the core and not in this plugin. @bshine: if you think this is not correct, please reopen this issue.

            mfriedenhagen Mirko Friedenhagen
            bshine bshine
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: