Jenkins seams to ignore the system CLASSPATH parameter from /etc/environment or /etc/profile.d/jdk.sh. I try to run a Groovy script in Scriptler but i get this error:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321
I have installed the MySQL Database Plugin in Jenkins already (https://wiki.jenkins-ci.org/display/JENKINS/MySQL+Database+Plugin) but still the MySQL driver can not by loaded found in Jenkins Console nor Scriptler:
import groovy.sql.Sql
Sql.newInstance("jdbc:mysql://HOST:3306/DB", "USER", "PASS", "com.mysql.jdbc.Driver")
After i set the CLASSPATH under Jenkis "Global properties" > "Environment variables" to
Name CLASSPATH
Value .:/var/lib/jenkins/plugins/database-mysql/WEB-INF/lib/mysql-connector-java-5.1.21.jar
Jenkins is able to run Jobs but still Jenkins Script Console / Scriptler can not find the jar file.