How to Navigate in Vaadin CDI project?

I am new to Vaadin, trying to learn Vaadin CDI following the examples and webinar by Matti Tahvonen. The example applications runs well and i have added few more views to it. After login successfully, when I call the Viewgetting exception. Is there anything wrong in my following navigation code? Thanks for any help.

public class CountryTableView extends MHorizontalLayout implements View {
    CountryFacade cf;
    CountryMaddonForm form;

    UserInfo uinfo;
public void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) {
        if (uinfo.getName() == null){
  "Sorry, you have to login before useing this option.."+ uinfo.getName());

the CDI part seems OK; but why are you navigating in the enter method? the enter method is called when the user arrives at that particular view. It should be used to initialize data on that view. Nothing wrong with firing another navigation event there, I just want to know why. Also, It would be helpful if you provided relevant parts of the stacktrace you get.

Thanks for your reply. I am firing navigation event inside the enter method to direct the user to log-in page if not logged in. Is there any better way to manage this?

redirection is OK; I was wondering about this line:

getUI().getNavigator().navigateTo("country"); It will try to navigate to the exact same view, which might lead to issues.

Yes, you are right, I have removed this line and it works well. Thank you so much Thomas for your help.