Sony Xperia Z3 and Z3 Compact are decent phones. If you want to install certain powerful applications or customize it with Xposed Framework needs root access on it, but first you need to unlock its bootloader. However, the problem here is you will lose warranty as well as delete the DRM security key, which is required for the advanced camera functionality.
However, this does not stop developers put their hands on Xperia Z3 and Z3 Compact. A user at XDA Developers has managed to exploit a vulnerability found in Xperia Z3 and Z3 Compact, which grants root access on the device without unlocking the bootloader.
Keep in mind that, although the method (Giefroot method) lets you root Sony Xperia Z3 and Z3 Compact with locked bootloader, it is not a completely finished tool, so does not recommend unless you know what you are doing. Also, it does not mean you will not lose warranty, but it will at least keep the DRM security key intact.
If you want to install some power apps that require root permission or customize your Xperia Z3 and Z3 Compact with Xposed Framework, you can root your device without unlocking bootloader. Follow as described below.
1. USB debugging enabled (Settings -> About phone -> tap 7 times on build number -> Developer options)
2. Enable Mock Locations (Settings -> Developer options)
3. ADB drivers installed on your PC
4. October 2014 Firmware, if you updated the firmware using flashtool, needs to return to the version 23.0.A.2.93
How to root Sony Xperia Z3 and Z3 Compact with locked bootloader
1. Download the latest version of Giefroot tool [HERE] and extract the zip file
2. Turn on your phone and connect it to PC
3. Put the device in Airplane mode
4. Run the “install.bat” file and follow the instructions
5. If you get an error message, rerun the tool.
The process will install SuperUser on your Xperia Z3 and Z3 Compact without unlocking the bootloader. We remind you unless you are a technically talented user do not attempt to do it. (Source –XDA)