Using my own groovy classes

Hi Teneo developers

I have written a Groovy class GroovyHttps and loaded it as a resource to reference in a flow like this:
List responseJson = GroovyHttps.getRequest(getUrl);

but get this error:

Flow [Get devices at address] (ID=6dd0ef3b-a013-4612-979d-71c9381cb0fa): Vertex [getDevicesAtAddress] (ID=e71ae784-f05b-454c-91d3-2d58c15b5ae4), Action script: Script syntax error: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Compilation incomplete: expected to find the class GroovyHttps in Script177.groovy, but the file contains the classes: Script177 1 error

I thought the Groovy classes we load via resources are in the same namespace as the Groovy snippets in a Script node?

Thanks

Kate

Hi. Yes, the Groovy classes you load via resources are in the same namespace as the Groovy snippets in a Script node. Is your class GroovyHttps defined like

public class GroovyHttps {
	public static getRequest(url) {
		...
	}
}

in the file GroovyHttps.groovy which is uploaded in the published location (folder) /script_lib in Resources? If not, please do it like this and restart the tryout before testing.

That works much better. We have the Groovy in a test harness to do integration testing so I also commented out our package line at the top of the file. Thanks, Alexander, for the speedy reply.