Hi Salva

I think you can check whether `foo.bar.Job` is in the classpath of your
job. “java.lang.NoClassDefFoundError: Could not initialize class
foo.bar.Job” error usually occurs when this class is not in the classpath

Best,
Shammon FY

On Mon, Apr 17, 2023 at 5:48 PM Salva Alcántara <salcantara...@gmail.com>
wrote:

> I am deploying some Flink jobs which require access to some services under
> a service mesh implemented via Linkerd. From time to time, I'm running into
> this error:
>
> ```
> java.lang.NoClassDefFoundError: Could not initialize class foo.bar.Job
> ```
>
> It's weird because I have some jobs running well but others for which I am
> getting this error. I can confirm that the jar file contains the class that
> cannot be found apparently, so it's not a problem with the jar itself, but
> seems to be related with linkerd. In particular, I'm using the following
> pod annotations for both the jobmanager and the taskmanager pods (taken
> from my Helm Chart values file):
>
> ```
> podAnnotations:
>   linkerd.io/inject: enabled
>   config.linkerd.io/skip-outbound-ports: 6123,6124
>   config.linkerd.io/proxy-await: enabled
> ```
>
> For what it's worth, I'm using the [Ververica Platform][1] (Community
> Edition) for deploying my jobs to Kubernetes (although I don't think that
> the main issue is specific to the VVP):
>
> ```
> {{- define "vvp.deployment" }}
> kind: Deployment
> apiVersion: v1
> metadata:
>   name: my-job
> spec:
>   template:
>     spec:
>       artifact:
>         kind: jar
>         flinkImageRegistry: {{ .Values.flink.imageRegistry }}
>         flinkVersion: "1.15.1"
>         flinkImageTag: 1.15.1-stream1-scala_2.12-java11-linkerd
>         entryClass: foo.bar.Job
>       kubernetes:
>         jobManagerPodTemplate:
>           metadata:
>             {{- with .Values.flink.podAnnotations }}
>             annotations:
>               {{- toYaml . | nindent 14 }}
>             {{- end }}
>           spec:
>             containers:
>               - name: flink-jobmanager
>                 command:
>                   - linkerd-entrypoint.sh
>         taskManagerPodTemplate:
>           metadata:
>             {{- with .Values.flink.podAnnotations }}
>             annotations:
>               {{- toYaml . | nindent 14 }}
>             {{- end }}
> {{- end }}
> ```
>
> where the contents of `linkered-entrypoint.sh` are:
>
> ```
> #!/bin/bash
> set -e
> exec linkerd-await --shutdown -- "$@"
> ```
>
> For extra context, the VVP and the flink jobs are deployed into different
> namespaces. Also, for the VVP pods, I'm not using any linkerd annotations
> whatsoever.
>
> To be clear, if I remove the annotations / everything releated to Linkerd,
> the job deployment works as expected.
>
> Has anyone encountered similar problems? Am I missing something? Should I
> also use the `  linkerd.io/inject: enabled` annotation for the VVP pods?
> The closest troubleshooting resource/guide that I've found so far is [this
> one][2], which targets Istio instead of Linkerd.
>
>   [1]: https://www.ververica.com/
>   [2]:
> https://ververica.zendesk.com/hc/en-us/articles/7233687970460-How-to-integrate-Istio-with-Ververica-Platform
>
> ---
>
> PS: Also posted in SO:
> -
> https://stackoverflow.com/questions/76033732/flink-kubernetes-and-linkerd
>

Reply via email to