Unable to resolve a class .... ?

27 views
Skip to first unread message

Charles Moulliard

unread,
Dec 15, 2020, 10:08:31 AM12/15/20
to job-dsl-plugin
Hi,

How can I resolve/debug such a problem reported by a FreeStyleJob which executes a Groovy shell script ?

[workspace] $ /var/lib/jenkins/tools/hudson.plugins.groovy.GroovyInstallation/groovy-3.0.7/bin/groovy -Duser=$user /var/lib/jenkins/jobs/hello-from-class-dsl-helloFreeStyleJob/workspace/hudson17976851361499776611.groovy
ERROR: ld.so: object 'libnss_wrapper.so' from LD_PRELOAD cannot be preloaded: ignored.
Picked up JAVA_TOOL_OPTIONS: -XX:+UnlockExperimentalVMOptions -Dsun.zip.disableMemoryMapping=true
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/var/lib/jenkins/jobs/hello-from-class-dsl-helloFreeStyleJob/workspace/hudson17976851361499776611.groovy: 1: unable to resolve class utilities.Hello
 @ line 1, column 1.
   import utilities.Hello
   ^

1 error

Build step 'Execute Groovy script' marked build as failure
Finished: FAILURE

Groovy Job and groovy script to be executed are defined under the same path

sh-4.2$ ls -la /var/lib/jenkins/jobs/hello-from-class-dsl-helloFreeStyleJob/workspace/jobs/
total 24
drwxr-xr-x. 3 1001 root  213 Dec 15 14:59 .
drwxr-xr-x. 5 1001 root  170 Dec 15 15:00 ..
-rw-r--r--. 1 1001 root  124 Dec 15 14:59 sayHelloFromClass.groovy
-rw-r--r--. 1 1001 root  638 Dec 15 14:59 sayHelloFromClassJob.groovy
drwxr-xr-x. 2 1001 root   26 Dec 15 14:59 utilities

and Hello class is declared under utilities

ls -la /var/lib/jenkins/jobs/hello-from-class-dsl-helloFreeStyleJob/workspace/jobs/utilities/
total 4
drwxr-xr-x. 2 1001 root  26 Dec 15 14:59 .
drwxr-xr-x. 3 1001 root 213 Dec 15 14:59 ..
-rw-r--r--. 1 1001 root 125 Dec 15 14:59 Hello.groovy

Job - sayHelloFromClass.groovy declaration is 

import utilities.Hello

String userName = ${user} ?: "Charles"
println "UserName property: ${userName}"
Hello.message(userName);

Cheers

Charles

Reply all
Reply to author
Forward
0 new messages