Skip to end of metadata
Go to start of metadata

Symptom

Your Jenkins spits out a stack trace indicating that some classes are missing its descriptor, like the following.

Sometimes the InvocationTargetException is quite lengthy, so scroll down to see the nested cause that shows the class name that's missing Descriptor.

Nov 29, 2011 4:20:09 PM hudson.ExpressionFactory2$JexlExpression evaluate
WARNING: Caught exception evaluating: descriptor.getPropertyType(instance,field).itemTypeDescriptorOrDie. Reason: java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
	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.apache.commons.jexl.util.PropertyExecutor.execute(PropertyExecutor.java:125)
	at org.apache.commons.jexl.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:314)
	at org.apache.commons.jexl.parser.ASTArrayAccess.evaluateExpr(ASTArrayAccess.java:185)
	at org.apache.commons.jexl.parser.ASTIdentifier.execute(ASTIdentifier.java:75)
	at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
	at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
	at org.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
	at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
	at hudson.ExpressionFactory2$JexlExpression.evaluate(ExpressionFactory2.java:72)
	at org.apache.commons.jelly.tags.core.CoreTagLibrary$3.run(CoreTagLibrary.java:134)
	at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
	at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
	at org.apache.commons.jelly.tags.core.WhenTag.doTag(WhenTag.java:46)
	at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:270)
        ...
Caused by: java.lang.AssertionError: class hudson.plugins.git.GitPublisher$TagToPush is missing its descriptor
	at jenkins.model.Jenkins.getDescriptorOrDie(Jenkins.java:1042)
	at hudson.model.Descriptor$PropertyType.getItemTypeDescriptorOrDie(Descriptor.java:187)
	... 183 more

What does this mean?

This error is complaining that you are using some of the form tags incorrectly. It is currently a warning and non-fatal because otherwise it'll break too many plugins.

What the error is saying that you have some model classes that are used for form binding (those classes that are used in your constructor with the @DataBoundConstructor annotation), and those classes aren't Describable, when they should — making them Describable allows you to define help files, form validation check methods, and so on correctly.

Solution

Make those model classes Describable of themselves. That is, have them extend AbstractDescribableImpl, then define a nested Descriptor for itself. Since these are nested auxiliary desriptors, getDisplayName() can return the empty string.

class TagToPush extends AbstractDescribableImpl<TagToPush> {
    @DataBoundConstructor
    public TagToPush(...) { ... }

    ....

    @Extension
    public static class DescriptorImpl extends Descriptor<TagToPush> {
        public String getDisplayName() { return ""; }
    }
}

See a real world example for the complete example.

  • No labels