Hello,
I'm working on loading and running my ClojureScript application on Nashorn, a
JavaScript implementation that runs inside Java. The purpose is to pre-render
single page applications. I managed to do it with avery simple application and,
in case anybody is curious, I'm publishing the results here:
https://carouselapps.com/2015/09/11/isomorphic-clojurescriptjavascript-for-pre-rendering-single-page-applications-part-1/
When trying to run bigger applications I'm running into lots of little errors
and issues and solving them one by one. There's one error though that is really
puzzling. When I require ajax.core, as in:
(ns projectx.handlers
(:require [ajax.core :as ajax]))
I get this error:
Error: Namespace "com.cognitect.transit.util" already declared.
The traceback is:
Caused by: <eval>:19664:6 Error: Namespace "com.cognitect.transit.util" already
declared.
at
jdk.nashorn.internal.objects.NativeError.initException(NativeError.java:137)
at jdk.nashorn.internal.objects.NativeError.<init>(NativeError.java:102)
at jdk.nashorn.internal.objects.NativeError.<init>(NativeError.java:106)
at jdk.nashorn.internal.objects.NativeError.<init>(NativeError.java:110)
at
jdk.nashorn.internal.objects.NativeError.constructor(NativeError.java:129)
at
jdk.nashorn.internal.scripts.Script$Recompilation$1544$602593A$\^eval\_.provide(<eval>:19664)
at
jdk.nashorn.internal.scripts.Script$Recompilation$1681$\^eval\_.:program$:split-9(<eval>:57262)
at jdk.nashorn.internal.scripts.Script$1285$\^eval\_.:program(<eval>)
at
jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
at
jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
at
jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
at
jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:437)
... 66 more
line 57262 indeed contains:
goog.provide("com.cognitect.transit.util");
Trying to figure out how it could be duplicated:
$ grep -R provide.*com\.cognitect\.transit\.util .
./resources/public/js/app/com/cognitect/transit/util.js:goog.provide("com.cognitect.transit.util");
./resources/public/js/server-side/com/cognitect/transit/util.js:goog.provide("com.cognitect.transit.util");
./resources/public/js/server-side.js:goog.provide("com.cognitect.transit.util");
sever-side.js is the only file that is being loaded in Nashorn. Nothing from
app should ever be loaded as it is a different build target and I don't
understand how util.js could be loaded, but just in case I commented it out and
I keep receiving the same error. Which only happens when I'm loading ajax.core.
Any ideas what's going on here? This one left me scratching my head as no
matter how I poke it, nothing makes sense.
Thanks.
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.