Fix dependency issue by moving hadoop to the end of the dependencies. Fix Kryo infinite recursion by calling setReferences(true) when registering serializers.