The liferay forums are patchy at best. You are better off asking here or on Stack overflow.
I think you need to solve the null pointer
it hits NullPointerException on the line: "String communityName= themeDisplay.getScopeGroupName();".
How do i overcome this problem?
I think you mean .get(WebKeys.THEME_DISPLAY); instead of .get(WebKets.THEME_DISPLAY);
assuming, of course, you cut and pasted your actual code as
you should.