0

groovy pipeline script error

I created simple pipeline job and added below groovy script in that and getting below error, Please help. it's working in htttp://server/script window but now working in pipeline job.

 

Code : 

println 'test'

 

Error :

java.lang.NoClassDefFoundError: org/jenkinsci/plugins/workflow/graph/StepNode
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at jenkins.util.AntClassLoader.defineClassFromData(AntClassLoader.java:1139)
	at hudson.ClassicPluginStrategy$AntClassLoader2.defineClassFromData(ClassicPluginStrategy.java:884)
	at jenkins.util.AntClassLoader.getClassFromStream(AntClassLoader.java:1310)
	at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1366)
	at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
	at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at jenkins.util.AntClassLoader.defineClassFromData(AntClassLoader.java:1139)
	at hudson.ClassicPluginStrategy$AntClassLoader2.defineClassFromData(ClassicPluginStrategy.java:884)
	at jenkins.util.AntClassLoader.getClassFromStream(AntClassLoader.java:1310)
	at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1366)
	at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
	at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.$initialize(CpsScript.java:79)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:481)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:213)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Caused by: java.lang.ClassNotFoundException: org.jenkinsci.plugins.workflow.graph.StepNode
	at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1376)
	at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
	at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 23 more
Finished: FAILURE

3 comments

  • 0
    Avatar
    Denys Digtiar

    The missing class is provided by the Pipeline: API plugin. Please make sure that it is present in your installation and that all plugins are loading successfully. 

    Also, note that Jenkins Pipeline and Jenkins Script Console are two absolutely different things. What runs in Script Console will not necessarily run as Jenkins Pipeline. Please refer to Pipeline documentation https://jenkins.io/doc/book/pipeline/

  • 0
    Avatar
    Karthik R

    Thanks Denys.

    I installed latest plugin Pipeline: API, but it's still throwing above error.

    How to make sure all plugins are loaded successfully ? It's showing in Manage plugins as Available.

  • 0
    Avatar
    Denys Digtiar

    Hi Karthik,

    The installed plugins appear in Installed tab not in Available. You might want to double check if the Pipelin:API plugin was installed. It might require the restart.

    If any of the plugins fail to load you will see it at the top of the "Manage Jenkins" page.

Please sign in to leave a comment.