0

I am getting the below JavaScript error when I'm trying to access the application.

Uncaught SyntaxError: Unexpected token < in jsf.js.faces?ln=javax.faces

The browser is loading, but page is not displayed.

How is this caused and how can I solve it?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
sai
  • 59
  • 11

1 Answers1

1

Uncaught SyntaxError: Unexpected token < in jsf.js.faces?ln=javax.faces

This will happen when the server returned a HTML document while the browser tried to download the mentioned JavaScript file (which is necessary for a.o. the functioning of <h:commandLink> and <f:ajax> in JSF 2.x).

You probably already know that HTML documents usually begin with a < and a JavaScript file absolutely not. Inspecting the HTTP traffic monitor and the actual HTML response should give clues as to what exactly it returned. Press F12 in Chrome/Firefox23+/IE9+ to see it. Perhaps it's a HTTP 4xx error? 401 unauthorized? Or 403 forbidden?

That can in turn happen if your (homegrown) security/login framework is badly configured. This problem is in turn not related to JSF itself. Basically, you need to fix/reconfigure it allow requests on /javax.faces.resource/*.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555