Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Requirement files" field does not work #8

Closed
thellef opened this issue Mar 5, 2015 · 1 comment · Fixed by #9
Closed

"Requirement files" field does not work #8

thellef opened this issue Mar 5, 2015 · 1 comment · Fixed by #9

Comments

@thellef
Copy link
Contributor

thellef commented Mar 5, 2015

Even if entering the name of an existing file in the workspace, there's a yellow text below the field (after tab'ing out) that says "file does not yet exist".
If I then proceed to save the configuration with a filename in that field, I get a Jenkins Oops page with this stack trace (here shown for the case where the file really doesn't exist):

javax.servlet.ServletException: java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.chroot.builders.ChrootBuilder from {"chrootName":"test-pbuilder","clear":false,"loginAsRoot":false,"command":"pwd\nls -lA\nenv|sort\nsleep 300","packagesFile":"install-me.txt","additionalPackages":"","ignoreExit":false,"noUpdate":false,"forceInstall":false,"stapler-class":"org.jenkinsci.plugins.chroot.builders.ChrootBuilder","kind":"org.jenkinsci.plugins.chroot.builders.ChrootBuilder"}
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    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.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:370)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.chroot.builders.ChrootBuilder from {"chrootName":"test-pbuilder","clear":false,"loginAsRoot":false,"command":"pwd\nls -lA\nenv|sort\nsleep 300","packagesFile":"install-me.txt","additionalPackages":"","ignoreExit":false,"noUpdate":false,"forceInstall":false,"stapler-class":"org.jenkinsci.plugins.chroot.builders.ChrootBuilder","kind":"org.jenkinsci.plugins.chroot.builders.ChrootBuilder"}
    at hudson.model.Descriptor.newInstance(Descriptor.java:577)
    at hudson.model.Descriptor.newInstancesFromHeteroList(Descriptor.java:915)
    at hudson.model.Descriptor.newInstancesFromHeteroList(Descriptor.java:900)
    at hudson.util.DescribableList.rebuildHetero(DescribableList.java:203)
    at hudson.model.Project.submit(Project.java:232)
    at hudson.model.Job.doConfigSubmit(Job.java:1188)
    at hudson.model.AbstractProject.doConfigSubmit(AbstractProject.java:785)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    ... 48 more
Caused by: java.lang.IllegalArgumentException: Failed to instantiate class org.jenkinsci.plugins.chroot.builders.ChrootBuilder from {"chrootName":"test-pbuilder","clear":false,"loginAsRoot":false,"command":"pwd\nls -lA\nenv|sort\nsleep 300","packagesFile":"install-me.txt","additionalPackages":"","ignoreExit":false,"noUpdate":false,"forceInstall":false,"stapler-class":"org.jenkinsci.plugins.chroot.builders.ChrootBuilder","kind":"org.jenkinsci.plugins.chroot.builders.ChrootBuilder"}
    at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:598)
    at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:400)
    at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:396)
    at hudson.model.Descriptor.newInstance(Descriptor.java:568)
    ... 64 more
Caused by: java.lang.IllegalArgumentException: java.io.FileNotFoundException: File 'install-me.txt' does not exist
    at org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:462)
    at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:699)
    at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:81)
    at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:596)
    ... 67 more
Caused by: java.io.FileNotFoundException: File 'install-me.txt' does not exist
    at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:299)
    at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1711)
    at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1748)
    at org.jenkinsci.plugins.chroot.builders.ChrootBuilder.<init>(ChrootBuilder.java:92)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:447)
    ... 70 more

Instead of "crashing", I would expect the plugin to accept the filename and allow the file to be created either from source control or generation.
I have this same error on two different installations. This one here is running Jenkins LTS 1.596.1 and chroot plugin SNAPSHOT. Other installation is running with plugin 0.1.4.

@thellef
Copy link
Contributor Author

thellef commented Mar 12, 2015

The error comes when filling the list packagesFromFile in ChrootBuilder. The list is a private member and not used anywhere in the class. I tried removing it; then the plugin works for me. I'll make a pull request later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant