Jenkins setup:
Jenkins: 2.414.1
OS: Linux - 3.10.0-1160.90.1.el7.x86_64
Java: 11.0.19 - Red Hat, Inc. (OpenJDK 64-Bit Server VM)
---
Office-365-Connector:4.20.2
Parameterized-Remote-Trigger:3.2.0
analysis-model-api:11.15.0
ansible:253.v4fe719ffdd8a_
ansicolor:1.0.4
ant:497.v94e7d9fffa_b_9
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
audit-trail:361.v82cde86c784e
authentication-tokens:1.53.v1c90fd9191a_b_
aws-bucket-credentials:1.0.0
aws-java-sdk:1.12.406-370.v8f993c987059
aws-java-sdk-cloudformation:1.12.406-370.v8f993c987059
aws-java-sdk-codebuild:1.12.406-370.v8f993c987059
aws-java-sdk-ec2:1.12.406-370.v8f993c987059
aws-java-sdk-ecr:1.12.406-370.v8f993c987059
aws-java-sdk-ecs:1.12.406-370.v8f993c987059
aws-java-sdk-efs:1.12.406-370.v8f993c987059
aws-java-sdk-elasticbeanstalk:1.12.406-370.v8f993c987059
aws-java-sdk-iam:1.12.406-370.v8f993c987059
aws-java-sdk-logs:1.12.406-370.v8f993c987059
aws-java-sdk-minimal:1.12.406-370.v8f993c987059
aws-java-sdk-sns:1.12.406-370.v8f993c987059
aws-java-sdk-sqs:1.12.406-370.v8f993c987059
aws-java-sdk-ssm:1.12.406-370.v8f993c987059
azure-ad:449.v92b_39a_d8e523
azure-sdk:157.v855da_0b_eb_dc2
badge:1.9.1
bootstrap4-api:4.6.0-6
bootstrap5-api:5.3.2-3
bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9
branch-api:2.1128.v717130d4f816
build-monitor-plugin:1.14-745.ve2023a_305f40
build-pipeline-plugin:2.0.1
build-timeout:1.32
build-timestamp:1.0.3
build-with-parameters:76.v9382db_f78962
caffeine-api:3.1.8-133.v17b_1ff2e0599
change-assembly-version-plugin:1.10
checks-api:2.0.2
chromedriver:1.2
cloudbees-folder:6.858.v898218f3609d
cobertura:1.17
code-coverage-api:4.99.0
codebeamer-xunit-importer:1.9
codebeamer-xunit-uploader:1.1.4
codesonar:3.5.0
command-launcher:107.v773860566e2e
commons-httpclient3-api:3.1-3
commons-lang3-api:3.13.0-62.v7d18e55f51e2
commons-text-api:1.11.0-95.v22a_d30ee5d36
conditional-buildstep:1.4.3
config-file-provider:959.vcff671a_4518b_
configuration-as-code:1775.v810dc950b_514
copyartifact:722.v0662a_9b_e22a_c
coverage:1.10.0
credentials:1319.v7eb_51b_3a_c97b_
credentials-binding:642.v737c34dea_6c2
cucumber-living-documentation:3.2
cucumber-perf:2.0.9
cucumber-reports:5.8.1
cucumber-testresult-plugin:0.10.1
cucumber-trends-report:1.3
cvs:2.19.1
data-tables-api:1.13.6-5
depgraph-view:1.0.5
display-url-api:2.200.vb_9327d658781
docker-commons:439.va_3cb_0a_6a_fb_29
docker-java-api:3.2.13-68.va_875df25a_b_45
docker-plugin:1.3.0
docker-workflow:563.vd5d2e5c4007f
dtkit-api:3.0.2
durable-task:547.vd1ea_007d100c
echarts-api:5.4.0-7
email-ext:2.104
embeddable-build-status:467.v4a_954796e45d
envinject:2.908.v66a_774b_31d93
envinject-api:1.199.v3ce31253ed13
environment-variable-page-decoration:1.3.0
extended-choice-parameter:376.v2e02857547b_a_
extended-read-permission:53.v6499940139e5
extensible-choice-parameter:1.8.1
external-monitor-job:215.v2e88e894db_f8
favorite:2.4.3
file-parameters:316.va_83a_1221db_a_7
font-awesome-api:6.5.1-2
forensics-api:2.3.0
fxcop-runner:1.1
gatling:1.3.0
git:5.2.1
git-client:4.6.0
git-parameter:0.9.19
git-server:114.v068a_c7cc2574
gitlab-api:5.3.0-91.v1f9a_fda_d654f
gitlab-logo:1.1.2
gitlab-merge-request-jenkins:2.0.0
gitlab-plugin:1.8.0
gradle:2.9
greenballs:1.15.1
groovy:457.v99900cb_85593
groovy-postbuild:228.vcdb_cf7265066
gson-api:2.10.1-15.v0d99f670e0a_7
h2-api:11.1.4.199-12.v9f4244395f7a_
handy-uri-templates-2-api:2.1.8-30.v7e777411b_148
harbor-plugin:1.1
htmlpublisher:1.32
http-post:1.2
http_request:1.18
instance-identity:185.v303dc7c645f9
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.16.1-373.ve709c6871598
jacoco:3.3.5
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:243.vb_b_503b_b_45537
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.9-1
jdepend:1.3.1
jdk-tool:73.vddf737284550
jersey2-api:2.41-133.va_03323b_a_1396
jira:3.12
jjwt-api:0.11.5-77.v646c772fddb_0
jobConfigHistory:1229.v3039470161a_d
joda-time-api:2.12.6-21.vca_fd74418fb_7
jquery:1.12.4-1
jquery3-api:3.7.1-1
jsch:0.2.16-86.v42e010d9484b_
json-api:20231013-17.v1c97069404b_e
json-path-api:2.9.0-33.v2527142f2e1d
jsunit:1.6
junit:1259.v65ffcef24a_88
kubernetes:4029.v5712230ccb_f8
kubernetes-client-api:6.10.0-240.v57880ce8b_0b_2
kubernetes-credentials:0.11
last-changes:2.7.11
locale:314.v22ce953dfe9e
m2release:0.16.4
mailer:463.vedf8358e006b_
managed-scripts:1.5.6
mapdb-api:1.0.9-28.vf251ce40855d
matrix-auth:3.2.1
matrix-combinations-parameter:1.3.3
matrix-project:822.824.v14451b_c0fd42
maven-artifact-choicelistprovider:1.17
maven-invoker-plugin:2.5
maven-metadata-plugin:2.2
maven-plugin:3.23
metadata:1.1.0b
metrics:4.2.21-449.v6960d7c54c69
mina-sshd-api-common:2.12.0-90.v9f7fb_9fa_3d3b_
mina-sshd-api-core:2.12.0-90.v9f7fb_9fa_3d3b_
msbuild:1.30
mstestrunner:1.5.0
nested-view:1.33
next-build-number:1.8
nexus-jenkins-plugin:3.16.481.ved9f5106e132
nodejs:1.6.1
nodelabelparameter:1.12.0
nuget:1.1
okhttp-api:4.11.0-172.vda_da_1feeb_c6e
pam-auth:1.10
parameter-separator:87.va_1816d0b_39d1
parameterized-scheduler:255.v73827fcdf618
parameterized-trigger:787.v665fcf2a_830b_
permissive-script-security:0.7
pipeline-build-step:486.vd08f550cceee
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:629.vb_5627b_ee2104
pipeline-input-step:466.v6d0a_5df34f81
pipeline-maven:1279.v5d711113020f
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2150.v4cfd8916915c
pipeline-model-definition:2.2118.v31fd5b_9944b_5
pipeline-model-extensions:2.2150.v4cfd8916915c
pipeline-multibranch-defaults:2.1
pipeline-rest-api:2.31
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2118.v31fd5b_9944b_5
pipeline-stage-view:2.31
pipeline-utility-steps:2.16.0
pitmutation:1.0-18
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.8.0
popper-api:1.16.1-3
popper2-api:2.11.6-4
postbuild-task:1.9
postbuildscript:3.2.0-550.v88192b_d3e922
powershell:2.1
prism-api:1.29.0-8
publish-over:0.22
pubsub-light:1.18
python:1.3
rebuild:330.v645b_7df10e2a_
repository-connector:2.2.1
resource-disposer:0.23
role-strategy:689.v731678c3e0eb_
run-condition:1.7
run-condition-extras:0.3
scm-api:676.v886669a_199a_a_
script-security:1321.va_73c0795b_923
selenium:3.141.59
selenium-aes:0.5
seleniumhtmlreport:1.1
simple-theme-plugin:160.vb_76454b_67900
snakeyaml-api:2.2-111.vc6598e30cc65
sonar:2.17.1
sqlplus-script-runner:2.0.25
sse-gateway:1.26
ssh:2.6.1
ssh-agent:346.vda_a_c4f2c8e50
ssh-credentials:308.ve4497b_ccd8f4
ssh-slaves:2.948.vb_8050d697fec
ssh-steps:2.0.68.va_d21a_12a_6476
sshd:3.322.v159e91f6a_550
structs:325.vcb_307d2a_2782
subversion:2.17.3
testcomplete-xunit:1.1
testcomplete11-xunit:1.1
thinBackup:1.18
timestamper:1.26
token-macro:400.v35420b_922dcb_
trilead-api:2.133.vfb_8a_7b_9c5dd1
uno-choice:2.8.1
variant:60.v7290fc0eb_b_cd
warnings-ng:10.7.0
windows-exe-runner:35.vea_7d292d39a_2
winrm-client:1.0
workflow-aggregator:596.v8c21c963d92d
workflow-api:1291.v51fd2a_625da_7
workflow-basic-steps:1042.ve7b_140c4a_e0c
workflow-cps:3837.v305192405b_c0
workflow-cps-global-lib:609.vd95673f149b_b
workflow-cps-global-lib-http:2.23.0
workflow-durable-task-step:1327.ve57634fb_09ce
workflow-job:1385.vb_58b_86ea_fff1
workflow-multibranch:770.v1a_d0708dd1f6
workflow-scm-step:415.v434365564324
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:865.v43e78cc44e0d
ws-cleanup:0.45
xray-connector:2.6.1
xunit:3.1.3
xvfb:1.2
We have a problem with our pipeline to load postgresql driver from a sharedlib.
In our sharedlib I have this code:
@Grapes([
@Grab(group = 'org.apache.commons', module = 'commons-lang3', version = '3.6'),
@Grab(group = 'org.postgresql', module = 'postgresql', version = '42.3.1')]
)
import com.cloudbees.groovy.cps.NonCPS
import org.apache.commons.lang3.StringUtils
import groovy.sql.Sql
import org.postgresql.largeobject.LargeObject
import org.postgresql.largeobject.LargeObjectManager
import hudson.FilePath
import jenkins.model.Jenkins
class Utilities implements Serializable {
Script script
def executeSequenceAndQueryPostgreSQL(String host, String dbName, String username, String password, String sequenceName) {
def sql = Sql.newInstance("jdbc:postgresql://${host}:5432/${dbName}", username, password, "org.postgresql.Driver")
def result = sql.firstRow("SELECT nextval('${sequenceName}');")
sql.close()
return result.nextval
}
}
My pipeline:
def call(Closure context) {
def config = [
env: env
]
context.delegate = config
context.resolveStrategy = Closure.DELEGATE_FIRST
context()
pipeline {
agent { label 'build'}
stages {
stage('Deployment number assignement') {
steps {
script {
def sequenceName = "sequence"
deploymentNumber = utils.executeSequenceAndQueryPostgreSQL(host, dbName, username, password, sequenceName)
println("deploymentNumber: " + deploymentNumber)
}
}
}
.
.
.
When my pipeline invoque this method I have this problem:
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: c6bd3350-a644-4713-ad3d-b62048b3a045
java.sql.SQLException: No suitable driver found for jdbc:postgresql://host:5432/db
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
I understand that the postgresql jar is not in the class path of jenkins.
My jar is installed with grape in $jankins_home/.groovy/grapes/org.postgresql/postgresql/jars
I putted this path in the “Additional groovy classpath” in System configuration, in the paths setted in the variable java.library.path, in the home of jenkins but it’s not detected.
When I copied the jar in the lib directory of the unzipped war “/var/lib/jenkins/%C/jenkins/war/WEB-INF/lib/” and restarted jenkins it works.
I don’t find solution how set my custom jars in the jenkins classpath without copying them on the lib directory in the unzipped war.
Have you a solution for me please?
Thanks