Fixing DFSMiniCluster ExceptionInInitializerError on Bamboo OnDemand

by thomas.memenga on 2014-08-20

Fixing DFSMiniCluster ExceptionInInitializerError on Bamboo OnDemand

How to fix ExceptionInInitializerError in DFSMiniCluster caused by wrong default file permissions on certain linux distros on your bamboo OnDemand setup.

If your JUnit tests utilize DFSMiniCluster, you may hit an ExceptionInInitializerError when building your project on Bamboo OnDemand using elastic agents.

java.lang.ExceptionInInitializerError: null
at org.apache.hadoop.hdfs.MiniDFSCluster.startDataNodes(
at org.apache.hadoop.hdfs.MiniDFSCluster.(
at org.apache.hadoop.hdfs.MiniDFSCluster.(
at org.apache.pig.test.MiniCluster.setupMiniDfsAndMrClusters(
at org.apache.pig.test.MiniGenericCluster.(
at org.apache.pig.test.MiniCluster.(
at org.apache.pig.test.MiniGenericCluster.(
at org.apache.accumulo.pig.AccumuloPigClusterTest.setupClusters(

This error is documented in HBASE-8944 and HDFS-2556 and there is a workaround for this kind of error happening on certain linux distros: You need to adjust your default file permissions on your linux system and change it to

umask 022

How to apply this to your elastic agent in Bamboo OnDemand

You could create your own custom elastic image or you can use “Instance Startup Script” functionality to inject this configuration on your (standard) instance types.


Navigate to Image Configurations and click edit on each instance type you want to configure. Then add

echo "umask 022" >> /etc/profile

to the Instance Startup Script section and you are done. Terminate and restart running instance and rebuild your project.