[2.0] Problem with Javascript compilation

186 views
Skip to first unread message

Dave Gurnell

unread,
Feb 6, 2012, 10:34:28 AM2/6/12
to play-fr...@googlegroups.com
Hi all,

I am having trouble with the following Javascript files using a very recent checkout of 2.0 (master branch, commit 6989fb99):

-- app/assets/javascripts/app.js --
goog.require('jquery');
console.log('app loaded');

-- app/assets/javascripts/jquery.js --
goog.provide('jquery');
console.log('jquery loaded');

When I execute my app with the run command and load a page, I get the following error:

[ui] $ run

--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on port 9000...

(Server started, use Ctrl+D to stop and go back to the console...)

[info] play - Application started (Dev)
[error] {file:/Users/dave/dev/projects/egap/}ui/*:play-copy-assets: java.lang.NullPointerException
[error] application - 

! Internal server error, for request [GET /assets/js/app.js] ->

play.api.UnexpectedException: Unexpected exception [RuntimeException: java.lang.NullPointerException]
at sbt.PlayReloader$$anon$1$$anonfun$3$$anonfun$apply$11.apply(PlayReloader.scala:206) ~[na:na]
at sbt.PlayReloader$$anon$1$$anonfun$3$$anonfun$apply$11.apply(PlayReloader.scala:199) ~[na:na]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]
at sbt.PlayReloader$$anon$1$$anonfun$3.apply(PlayReloader.scala:199) ~[na:na]
at sbt.PlayReloader$$anon$1$$anonfun$3.apply(PlayReloader.scala:198) ~[na:na]
at scala.Either$LeftProjection.map(Either.scala:183) ~[scala-library.jar:0.11.2]
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at com.google.javascript.jscomp.Compiler.runCallable(Compiler.java:629) ~[na:na]
at com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:574) ~[na:na]
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:556) ~[na:na]
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:515) ~[na:na]
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:497) ~[na:na]
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:483) ~[na:na]
Caused by: java.lang.NullPointerException: null
at com.google.javascript.jscomp.JSModuleGraph.<init>(JSModuleGraph.java:94) ~[na:na]
at com.google.javascript.jscomp.Compiler.processAMDAndCommonJSModules(Compiler.java:1394) ~[na:na]
at com.google.javascript.jscomp.Compiler.parseInputs(Compiler.java:1232) ~[na:na]
at com.google.javascript.jscomp.Compiler.parse(Compiler.java:678) ~[na:na]
at com.google.javascript.jscomp.Compiler.compileInternal(Compiler.java:636) ~[na:na]
at com.google.javascript.jscomp.Compiler.access$000(Compiler.java:70) ~[na:na]

Not sure what I'm doing wrong... is this a bug in the framework?

I have a couple of comments/questions about Javascript compilation in Play that I will put in a separate post.

Best regards,

-- Dave

rssh

unread,
Mar 3, 2012, 12:06:31 PM3/3/12
to play-framework

I have the same situation.

Tracking down: NLP is in closure compiler which can be fixed by
applying next patch: http://code.google.com/p/closure-compiler/issues/detail?id=672
(see attachment).

After substituted compiler.jar by patched version, it is possible to
see error message, which show that namespace module names are not the
same as subdirectories of
--common_js_module_path_prefix



On Feb 6, 5:34 pm, Dave Gurnell <d.j.gurn...@gmail.com> wrote:
> Hi all,
>
> I am having trouble with the following Javascript files using a very recent
> checkout of 2.0 (master branch, commit 6989fb99):
>
> -- app/assets/javascripts/app.js --
> goog.require('jquery');
> console.log('app loaded');
>
> -- app/assets/javascripts/jquery.js --
> goog.provide('jquery');
> console.log('jquery loaded');
>
> When I execute my app with the run command and load a page, I get the
> following error:
>
> [ui] $ run
>
> --- (Running the application from SBT, auto-reloading is enabled) ---
>
> [info] play - Listening for HTTP on port 9000...
>
> (Server started, use Ctrl+D to stop and go back to the console...)
>
> [info] play - Application started (Dev)
> [error] {file:/Users/dave/dev/projects/egap/}ui/*:play-copy-assets:
> java.lang.NullPointerException
> [error] application -
>
> ! Internal server error, for request [GET /assets/js/app.js] ->
>
> play.api.UnexpectedException: Unexpected exception [RuntimeException:
> java.lang.NullPointerException]
> at
> sbt.PlayReloader$$anon$1$$anonfun$3$$anonfun$apply$11.apply(PlayReloader.sc ala:206)
> ~[na:na]
> at
> sbt.PlayReloader$$anon$1$$anonfun$3$$anonfun$apply$11.apply(PlayReloader.sc ala:199)
> ~[na:na]
> at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]
> at sbt.PlayReloader$$anon$1$$anonfun$3.apply(PlayReloader.scala:199)
> ~[na:na]
> at sbt.PlayReloader$$anon$1$$anonfun$3.apply(PlayReloader.scala:198)
> ~[na:na]
> at scala.Either$LeftProjection.map(Either.scala:183)
> ~[scala-library.jar:0.11.2]
> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
> at com.google.javascript.jscomp.Compiler.runCallable(Compiler.java:629)
> ~[na:na]
> at
> com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:574 )
> ~[na:na]
> at com.google.javascript.jscomp.Compiler.compile(Compiler.java:556) ~[na:na]
> at com.google.javascript.jscomp.Compiler.compile(Compiler.java:515) ~[na:na]
> at com.google.javascript.jscomp.Compiler.compile(Compiler.java:497) ~[na:na]
> at com.google.javascript.jscomp.Compiler.compile(Compiler.java:483) ~[na:na]
> Caused by: java.lang.NullPointerException: null
> at com.google.javascript.jscomp.JSModuleGraph.<init>(JSModuleGraph.java:94)
> ~[na:na]
> at
> com.google.javascript.jscomp.Compiler.processAMDAndCommonJSModules(Compiler .java:1394)
Reply all
Reply to author
Forward
0 new messages