Issue when running java docker images on raspberry pi

I am trying to run java chaincode (hyperledger fabric version 2.1, Fabcar example) on raspberry pi 4 running Ubuntu server 20.04. I get the following error:

Error: chaincode install failed with status: 500 - failed to invoke backing implementation of ‘InstallChaincode’ : could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 “standard_init_linux.go:228: exec user process caused: exec format error”

Can arm processors run java docker images?

Thank you

Have you gotten a solution now?

I am not sure if this is the right question to beginn with… The question puts java in the center of the focus, even though the jvm required to run the java bytecode is not architecture agnostic and requires a jvm that is able to run on the target cpu architecture, in order to run the (generic) java bytecode itself

Since openjdk is available for Pi’s, it should be feasable to build an image for the arm architecture and run the platform independend java byte code on it.

If I remember correct Hyperledger requires chaincode to be written in go as well. Of course it would needed to be natively compiled for arm as well, otherwise you get the exec format error when the compiled binaries are executed.

1 Like

Yep. I had a similar issue but the problem has nothing to do with running java on a raspberry pi. The real problem, in my case was the fact that I didn’t have the docker image required to build java chaincode but I could build any Java application just fine. I solved it switching to a Golang chaincode.
He could as well consider building docker images for java chaincode.

1 Like

I moved to Golang chaincode