If your constructor takes a custom object as a parameter the class of that parameter also needs a @DataBoundConstructor annotation.
/B On Mon, Aug 17, 2015 at 6:41 AM, Irfan Sayed <[email protected]> wrote: > thanks. > it worked and moved ahead however, now it is failing while submitting the > job config please refer below the stack trace > > javax.servlet.ServletException: java.lang.InstantiationError: Unrecognized > constructor parameter: class > org.jenkinsci.plugins.deployment.DeploymentTrigger > at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:795) > at org.kohsuke.stapler.Stapler.invoke(Stapler.java:875) > 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:745) > at org.kohsuke.stapler.Stapler.invoke(Stapler.java:875) > at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648) > at org.kohsuke.stapler.Stapler.service(Stapler.java:237) > 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:96) > at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88) > at > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) > at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48) > 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.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46) > at > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065) > at > hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) > 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:203) > 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.lang.InstantiationError: Unrecognized constructor parameter: > class org.jenkinsci.plugins.deployment.DeploymentTrigger > at > hudson.util.XStream2$AssociatedConverterImpl.findConverter(XStream2.java:326) > at > hudson.util.XStream2$AssociatedConverterImpl.canConvert(XStream2.java:354) > > in the code, @DataBoundConstructor is already annotated for main public class > still class is not able initialize somehow > > please help me with some pointers. Thanks > > > > On Sun, Aug 16, 2015 at 3:14 PM, Oleg Nenashev <[email protected]> > wrote: > >> if i just return null , will it work ? >> >> >> No. A descriptor instance should be returned. Old implementation is: >> >> @Override >> public XX getDescriptor() { >> final Jenkins jenkins = Jenkins.getInstance(); >> if (jenkins == null) { >> throw new IllegalStateException("Jenkins is not >> ready or has been already shut down"); >> } >> return (XXX) jenkins.getDescriptorOrDie(getClass()); >> } >> >> >> >> >> суббота, 15 августа 2015 г., 21:03:42 UTC+3 пользователь Irfan Sayed >> написал: >> >>> Hi, >>> >>> I am developing one custom plugin which triggers the build based on some >>> condition. >>> i just looked at the code which you have written as a reference and got >>> some doubts. >>> just wanted to have your suggestion on that >>> >>> in the FilesFoundTriggerConfig class, i have found this : >>> >>> @Override public Descriptor<FilesFoundTriggerConfig> getDescriptor() { >>> return getClassDescriptor(); } >>> when i used the getClassDescriptor , i am not able to resolve the same >>> in eclipse >>> i am developing this plugin against Jenkins version 1.580.1 >>> i have already imported all the Jenkins packages but still not able to >>> resolve >>> further, if i just return null , will it work ? is there any specific >>> reason to return getClassDescriptor >>> can you please help me in some pointers ? >>> >>> Regards, >>> Irfan >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-dev/15a6beb7-97f3-4183-9a2d-ec0900f17186%40googlegroups.com >> <https://groups.google.com/d/msgid/jenkinsci-dev/15a6beb7-97f3-4183-9a2d-ec0900f17186%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/CACGLCJZLFg36ptq_qQT4gdxVvr9L%3DdSUv3f0jxtxoHMYonJjBw%40mail.gmail.com > <https://groups.google.com/d/msgid/jenkinsci-dev/CACGLCJZLFg36ptq_qQT4gdxVvr9L%3DdSUv3f0jxtxoHMYonJjBw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Robert Sandell *Software Engineer* *CloudBees Inc.* -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS2Tp1hMwFstdXgoveJFhieacoPWK%2Bpkbrydf8bnH2K-mw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
