Question

The "file" in question is actually an Ajax call. We are getting almost one error per every ajax call in a particular file. We use to have fixtures turned on, but have since then removed them.

Error:

failed to open file  file:/profile/getPolicy   JavaException: java.io.FileNotFoundException: /profile/getPolicy (No such file or directory) 
Exception in thread "Thread-2" org.mozilla.javascript.EcmaError: TypeError: Cannot call method "indexOf" of null (steal/rhino/env.js#24532)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)
    at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)
    at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3698)
    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2221)
    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2214)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3143)
    at script(steal/rhino/env.js:24532)
    at script(steal/rhino/env.js:2278)
    at script.makeRequest(steal/rhino/env.js:24484)
    at script(steal/rhino/env.js:2027)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
    at org.mozilla.javascript.Synchronizer.call(Synchronizer.java:79)
    at org.mozilla.javascript.tools.shell.Runner.run(Global.java:1162)
    at org.mozilla.javascript.Context.call(Context.java:515)
    at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
    at org.mozilla.javascript.tools.shell.Runner.run(Global.java:1156)
    at java.lang.Thread.run(Thread.java:662)
could not load script  http://localhost:3000/socket.io/1/?t=1334594888337&jsonp=0  
  TypeError: Cannot find function 0.0. 
!!!!!!!!!!! ERROR !!!!!!!!!!!

-message    = Cannot find function 0.0.
-fileName   = http://localhost:3000/socket.io/1/?t=1334594888337&jsonp=0
-name       = TypeError
-lineNumber = 0
failed to open file  file:/profile/getProfile   JavaException: java.io.FileNotFoundException: /profile/getProfile (No such file or directory) 
Exception in thread "Thread-4" org.mozilla.javascript.EcmaError: TypeError: Cannot call method "indexOf" of null (steal/rhino/env.js#24532)

As you can see the next error is related to the next ajax call. We aren't doing anything strange with our ajax calls:

$.ajax({
        url:"/profile/getProfile",
        type:"get",
        success:function(data){
            try{
                STATE.PROFILE = JSON.parse(data);
            }catch(err){
                STATE.PROFILE = data;
            }
            updateState();
        }
    });

Does anyone have any idea why we are getting these errors when we try to build? This code runs fine in the browser!

Was it helpful?

Solution

Brian, you were correct after all, in the fact that removing the Ajax calls does remove the errors from the build. Although the wording has changed. One of our developers found the mention of "steal.isRhino" on the following page: http://javascriptmvc.com/docs.html#!migrate

So encapsulating every ajax call with an if statement does work:

  if(!steal.isRhino) {
  }

However that is not feasible across an application. Fortunately, one of our developers did find the proper solution:

All ajax calls must have a full url: http://localhost:3000/profile/getProfile - NOT JUST - /profile/getProfile

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top