Search code examples
javagwterrai

Errai - JSONException: Error > parsing JSON: SyntaxError: Unexpected token <


When running my GWT application which use Errai-UI

I get this error:

WARNING: Replacing Element type [INPUT] with type [BUTTON] Compositing @Replace [data-field=username] element [] with Component com.google.gwt.user.client.ui.TextBox [] Compositing @Replace [data-field=password] element [] with Component com.google.gwt.user.client.ui.TextBox [] com.google.gwt.json.client.JSONException: Error parsing JSON: SyntaxError: Unexpected token <

I already added RootPanel.get().clear() during the @PostConstruct but still getting the error.

   @PostConstruct
   public void setup()
   {
       // Fix for Unexpected token JSONException being thrown
       RootPanel.get().clear();

       login.setText("Login");
       login.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                Window.alert("Logging in");
            }
       });
       RootPanel.get("rootPanel").add(this);
   }

What could I be missing?


Solution

  • It looks like you may have a syntax error in your HTML5 template. I would verify that it can be validated as proper HTML5 without syntax errors. This would explain a template parsing error in the browser (that is what it looks like is happening here.)