You can use the Connection class in SpringBoot to establish Connection, also make sure that the port id, is correct, it will ease a lot of hardwork.