How to fix the exception java.lang.ClassCastException: java.lang.String cannot be cast to [B while getting the objctGUID from AD?

Viewed 6984

I'm trying to fetch an unique identifier from windows AD. But at the following line of code:

byte[] objGUIDByteArr = (byte[]) attrs.get("objectGUID").get();

I'm getting the following exception

java.lang.ClassCastException: java.lang.String cannot be cast to [B

How to fix this & get the byte[] value from the objectGUID?

3 Answers
Related