Please format your code using </>
icon as explained in this guide. It will make your post more readable.
Or use markdown style like:
```
CODE
```
Some thoughts:
- Prefer using the Java REST Client instead
- Share you code
- Add missing libs (log4j2) although it's probably not the problem here.