I found the solution for the problem. I just had to add single line of code to make this work.
MyClass object= PageFactory.initElements(driver, MyClass.class);
I had to add this code to the class where I was creating the test and tried. It worked. Error wasn't in using of "@FindBy". So I guess this will help someone in future.