Rion Williams
02/26/2024, 3:17 PM<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-template-json</artifactId>
</dependency>
Additionally, I’ve also included the appropriate reference which should be available on the classpath for the pods as well via an initContainer and the pipeline.classpaths configuration:
spec:
image: flink:1.17
flinkVersion: v1_17
flinkConfiguration:
...
pipeline.classpaths: file:///opt/flink/external/log4j-layout-template-json-2.17.1.jar
...
jobManager:
...
podTemplate:
apiVersion: v1
kind: Pod
metadata:
name: job-manager
spec:
initContainers:
- name: copy-job-contents
image: {{ $values.image }}
volumeMounts:
- mountPath: /opt/flink/jars
name: jars
- mountPath: /opt/flink/external
name: external
command: ["/bin/sh", "-c"]
args:
# Copy logging dependency and executable jar from base image
- cp /flink/lib/log4j-layout-template-json-2.17.1.jar /opt/flink/external/log4j-layout-template-json-2.17.1.jar; cp /opt/flink-vvp/ica-flink-risk-scoring.jar /opt/flink/jars/ica-flink-risk-scoring.jar
When I attempt to use the following logConfiguration:
logConfiguration:
...
appender.console.layout.type = JsonTemplateLayout
It immediately encounters an error when running the pods related to the job:
ERROR Unable to locate plugin for JsonTemplateLayoutGyula Fóra
02/26/2024, 3:53 PMRion Williams
02/26/2024, 3:58 PM/opt/flink/lib directory. I can see all of the usual files available on the classpath however in the logs:
org.apache.flink.runtime.entrypoint.ClusterEntrypoint [] - Classpath: /opt/flink/lib/flink-cep-1.17.2.jar:/opt/flink/lib/flink-connector-files-1.17.2.jar:/opt/flink/lib/flink-csv-1.17.2.jar:/opt/flink/lib/flink-json-1.17.2.jar:/opt/flink/lib/flink-scala_2.12-1.17.2.jar:/opt/flink/lib/flink-table-api-java-uber-1.17.2.jar:/opt/flink/lib/flink-table-planner-loader-1.17.2.jar:/opt/flink/lib/flink-table-runtime-1.17.2.jar:/opt/flink/lib/log4j-1.2-api-2.17.1.jar:/opt/flink/lib/log4j-api-2.17.1.jar:/opt/flink/lib/log4j-core-2.17.1.jar:/opt/flink/lib/log4j-slf4j-impl-2.17.1.jar:/opt/flink/lib/flink-dist-1.17.2.jar::::
I had hoped that copying the other jar to the appropriate location and using the pipeline.classpaths would make it available on the classpath as well. Unless the error above is a red-herring and it isn’t an issue of that jar being available on the classpath at all.Gyula Fóra
02/26/2024, 3:59 PMRion Williams
02/26/2024, 3:59 PMpipeline.classpaths is working properly? Should I see this jar within that Classpath: … logs?Gyula Fóra
02/26/2024, 4:00 PMGyula Fóra
02/26/2024, 4:00 PMRion Williams
02/26/2024, 4:01 PM/**
* Mount the Flink User Lib directory to enable Flink to pick up a Jars defined in
* pipeline.classpaths. Used for starting standalone application clusters
*/
public class UserLibMountDecorator extends AbstractKubernetesStepDecorator {
private static final String USER_LIB_VOLUME = "user-lib-dir";
private static final String USER_LIB_PATH = "/opt/flink/usrlib";
private final StandaloneKubernetesJobManagerParameters kubernetesJobManagerParameters;
public UserLibMountDecorator(
StandaloneKubernetesJobManagerParameters kubernetesJobManagerParameters) {
this.kubernetesJobManagerParameters = checkNotNull(kubernetesJobManagerParameters);
}Gyula Fóra
02/26/2024, 4:01 PMRion Williams
02/26/2024, 4:01 PMuser-lib-dir mounted, but it’s possible it’s required for pipeline.classpaths.Gyula Fóra
02/26/2024, 4:01 PMRion Williams
02/26/2024, 4:01 PMRion Williams
02/26/2024, 4:02 PMGyula Fóra
02/26/2024, 4:03 PMRion Williams
02/26/2024, 4:05 PMGyula Fóra
02/26/2024, 4:06 PMRion Williams
02/26/2024, 4:07 PMRion Williams
02/26/2024, 4:09 PMGyula Fóra
02/26/2024, 4:16 PMRion Williams
02/26/2024, 4:19 PMRion Williams
02/27/2024, 7:00 PM