snowdrop / istio-java-api

A Java API to generate Istio descriptors, inspired by Fabric8's kubernetes-model.
Apache License 2.0
112 stars 33 forks source link

Error while creating VirtualService resource #61

Closed naitikdani closed 5 years ago

naitikdani commented 5 years ago

I am running version 1.1.0 of istio-java-api and get following error while creating VirtualService resource:

Exception in thread "main" java.lang.NoSuchFieldError: _visitables at me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceFluentImpl.withMetadata(VirtualServiceFluentImpl.java:72) at me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceBuilder.(VirtualServiceBuilder.java:44) at me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceBuilder.(VirtualServiceBuilder.java:18) at me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceBuilder.(VirtualServiceBuilder.java:15)

Pasting a section of code: VirtualService vs = new VirtualServiceBuilder() .withApiVersion("networking.istio.io/v1alpha3") .withKind("VirtualService") .withNewMetadata().withName("reviews-route").endMetadata() .withNewSpec() .addToHosts("reviews.prod.svc.cluster.local") .addToGateways("logforwarding-gateway")

Any idea how to fix this?

geoand commented 5 years ago

@iocanel this sounds like something in your wheelhouse :)

iocanel commented 5 years ago

@naitikdani: Seems like you are using incompatible versions of kubernetes-client and istio-java-api can you please provide the exact versions, so that I can verify my suspicion?

naitikdani commented 5 years ago

@iocanel, you were right. I changed kubernetes-client version to 4.2.1 and it started working.

iocanel commented 5 years ago

Thanks for the feedback!

tremaineeto commented 5 years ago

@iocanel I had a similar issue (java.lang.NoClassDefFoundError: io/fabric8/kubernetes/client/dsl/base/OperationContext), and your suggestion seemed to have worked--thanks so much!

In general, then, should the advice be to simply always insure that the version of our project's kubernetes-client sync exactly with the version in the istio-client?

iocanel commented 5 years ago

If not 100% aligned, then major & minor versions.

On Thu, Aug 15, 2019, 21:16 Tremaine Eto notifications@github.com wrote:

@iocanel https://github.com/iocanel I had a similar issue (java.lang.NoClassDefFoundError: io/fabric8/kubernetes/client/dsl/base/OperationContext), and your suggestion seemed to have worked. In general, then, should the advice be to simply always insure that the version of our project's kubernetes-client sync exactly with the version in the istio-client?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/snowdrop/istio-java-api/issues/61?email_source=notifications&email_token=AADCEWBWL6YHSVVCHXVEXT3QEWMOVA5CNFSM4HLSLLTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4MSOXA#issuecomment-521742172, or mute the thread https://github.com/notifications/unsubscribe-auth/AADCEWDZKBP5Y4NQCD7R2LTQEWMOVANCNFSM4HLSLLTA .