Hello everyone
I am currently trying to deploy a script pair using the scheduled tasks module. I created a couple of script in groovy and they work correctly, but when I deploy it in CUBA PLATAFORM, I get an error loading the libraries.
Basically what I need to do is shoot a get or post to services inside my backoffice.
I enclose the script code that I am using. Thanks to everyone beforehand.
@Grab (group = ‘org.apache.httpcomponents’, module = ‘httpclient’, version = ‘4.5.2’)
@Grab (group = ‘org.postgresql’, module = ‘postgresql’, version = ‘9.4-1205-jdbc42’)
@GrabConfig (systemClassLoader = true)
import org.apache.http.client.methods. *
import org.apache.http.impl.client. *
import groovy.sql.Sql
try {
def urlDB = ‘jdbc: postgresql: // xxxxxxx’ /
def user = ‘user’
def password = ‘password’
def driver = ‘org.postgresql.Driver’
def url = ‘’
def sql = Sql.newInstance (urlDB, user, password, driver)
sql.eachRow (’’ ‘SELECT * FROM configuration WHERE key =?’ ‘’, [‘bo_url_cleanup’]) {config ->
url = config.value
}
sql.close ()
def post = new HttpPost (url)
def client = HttpClientBuilder.create (). build ()
def response = client.execute (post)
def bufferedReader = new BufferedReader (new InputStreamReader (response.getEntity (). getContent ()))
def jsonResponse = bufferedReader.getText ()
println (“response: \ n” + jsonResponse)
return “response: \ n” + jsonResponse
} catch (Exception e) {
println (“Exception: $ {e}”)
return “Exception: $ {e}”
}
Cuba returns the following error I guess they are by the libraries @Grab, but I don’t know how I should load them. Help me pleeeese…
java.lang.NoClassDefFoundError: org/apache/ivy/core/settings/IvySettings