weavejester / lein-ring Goto Github PK
View Code? Open in Web Editor NEWRing plugin for Leiningen
License: Eclipse Public License 1.0
Ring plugin for Leiningen
License: Eclipse Public License 1.0
At the moment, for instance, it isn't possible to use lein ring to run an SSL dev server.
Such unlucky day - everything is breaking! :)
I've got following exception after running lein ring server
:
Started server on port 3000
2012-01-17 11:44:13.896:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2012-01-17 11:44:13.898:INFO::jetty-6.1.25
2012-01-17 11:44:13.971:INFO::Started [email protected]:3000
Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: http://localhost:3000
at clojure.lang.Util.runtimeException(Util.java:165)
at clojure.lang.Reflector.invokeConstructor(Reflector.java:193)
at clojure.java.browse_ui$open_url_in_swing.invoke(browse_ui.clj:15)
at clojure.lang.Var.invoke(Var.java:401)
at clojure.java.browse$open_url_in_swing.invoke(browse.clj:44)
at clojure.java.browse$browse_url.invoke(browse.clj:52)
at leiningen.ring.run_server$open_browser.invoke(run_server.clj:55)
at leiningen.ring.run_server$run_server.invoke(run_server.clj:60)
at user$eval2003.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6465)
at clojure.lang.Compiler.eval(Compiler.java:6455)
at clojure.lang.Compiler.eval(Compiler.java:6431)
at clojure.core$eval.invoke(core.clj:2795)
at clojure.main$eval_opt.invoke(main.clj:296)
at clojure.main$initialize.invoke(main.clj:315)
at clojure.main$null_opt.invoke(main.clj:348)
at clojure.main$main.doInvoke(main.clj:426)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:405)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: http://localhost:3000
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1458)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1452)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1106)
at javax.swing.JEditorPane.getStream(JEditorPane.java:827)
at javax.swing.JEditorPane.setPage(JEditorPane.java:433)
at javax.swing.JEditorPane.setPage(JEditorPane.java:939)
at javax.swing.JEditorPane.<init>(JEditorPane.java:273)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at clojure.lang.Reflector.invokeConstructor(Reflector.java:183)
... 20 more
Caused by: java.io.FileNotFoundException: http://localhost:3000
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1401)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:397)
at javax.swing.JEditorPane.getStream(JEditorPane.java:792)
... 28 more
Probably it's a clojure.java.browse problem, but I leave this report here as a reminder until it'll be fixed (if you don't mind).
Issue on clojure jira: http://dev.clojure.org/jira/browse/CLJ-912
The 0.8.3 change seems to cause our tests to run whenever a reload happens.
i.e. If we run "lein ring server" the app loads happily (without running tests)
If we then change a source file and refresh the browser, the server reloads and runs all our test code.
Reverting to 0.8.2 made this behaviour go away.
we have not set :reload-paths or changed our default :source-paths settings - our sources are in the "src" directory, tests are in "test" (and are Midje tests, btw)
If you provide this in your project.clj:
{:init project.handler/fn-which-does-not-exist
:handler project.handler/app }
lein ring server will not complain. This makes for an annoying troubleshooting experience in the event that the init function is misspelled.
Occasionally, it is useful to include the test classpath when executing "lein ring server". In my particular case, I'm developing a web toolkit and want to be able to run a test application built in the toolkit. Ideally, the namespaces defining the test application would be in my test folder, but currently I'm forced to put them in my src folder (which also means they'll be distributed in my jar file).
Maybe "lein ring test-server" ... or an option inside project.clj.
I start my server using:
lein ring server
But when I change my code eg. in server.clj and reload the browser the new code isn't loaded in.
My handler in server.clj looks like:
(def handler
(-> app-routes
(file/wrap-file "public")
(file-info/wrap-file-info)
(log/wrap-log)
(params/wrap-params)
(keyword-params/wrap-keyword-params)
(nested-params/wrap-nested-params)))
And my project.clj:
:plugins [[lein-ring "0.7.5"]
[lein-cljsbuild "0.2.7"]]
:ring {:handler app.server/handler
:auto-reload? true
:auto-refresh true}
Any idea why it isn't working?
When I update lein-ring past 6180c4e, I get the following error when I try to start a server via lein ring server-headless
:
Exception in thread "main" java.lang.IllegalAccessError: seq-union does not exist
at clojure.core$refer.doInvoke(core.clj:3849)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_lib.doInvoke(core.clj:5394)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:621)
at clojure.core$use.doInvoke(core.clj:5507)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
at clojure.core$load_lib.doInvoke(core.clj:5374)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:621)
at clojure.core$use.doInvoke(core.clj:5507)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at ring.middleware.reload$eval17$loading__4910__auto____18.invoke(reload.clj:1)
at ring.middleware.reload$eval17.invoke(reload.clj:1)
...
I get the same effect if I manually specify the same ring-server
version in my project.clj (expected).
I can see that this is eventually coming from ns-tracker
(used by ring.reload
in the new version of ring
, which is used by the new version of ring-server
) and am thinking there might be a mismatched dependency somewhere. Any idea what's going on? What's the best way of troubleshooting this for a plugin dependency tree (as opposed to something I can see with lein deps :tree
)?
Thanks!
Currently you can only define one ring in project.clj:
:ring {:handler server/handler}
It would be nice to be able to define multiple rings like this:
:ring [{:handler server/handler} {:handler backend/handler}]
(lein ring 0.7.0, Clojure 1.2.1, log4j 1.2.16)
My resources/log4j.properties file references an appender that available in a dependency.
log4j.properties:
log4.rootLogger=INFO,A1, LOGGLY
log4j.appender.LOGGLY=com.roomkey.cloggly.LogglyAppender
...
And in project.clj
{...
:dependencies [...
[com.roomkey/cloggly "1.2"]
...]
...}
Removing LOGGLY from the first line of log4j.properties allows uberjar to work. WIth it in there, uberjar never finishes.
With LOGGLY in place, I can run "lein ring server" and all the other typical leiningen commands without issue. But building an uberjar fails.
Regards,
Chris
normally, the way we interpret resource-path of leiningen to denote files in classpath, but this plugin does not treat them as such and the while creating war, the resource files do not go inside WEB-INF/classes folder. this breaks the code, I had to change the code for our use case. do you see a way to distinguish between web resource and classpath resource
I have a simple application which behaves normally when run with 'lein ring server-headless'. If I build a war with 'lein ring uberwar' and deploy it under tomcat, html pages are returned with text/plain content type. The same tomcat instance runs other wars generated by 'lein uberwar' without problems. The application is https://github.com/kolov/civi-stripped
Hi,
when you package the app up, try not to use /WEB-INF/ etc. as it is an absolute path instead of a relative path. It causes pain on linux if you try to unzip it into the root directory.
otherwise awesome plugin thx
thx
When I install Tomcat 7 on Windows into a path that contains spaces (the default installation path does), I get a FileNotFoundException
when accessing static resources:
java.io.FileNotFoundException: C:\Program%20Files\Apache%20Software%20Foundation\Tomcat%207.0\webapps\flurfunk\WEB-INF\classes\public\flurfunk.js (Das System kann den angegebenen Pfad nicht finden)
java.io.FileInputStream.open(Native Method)
java.io.FileInputStream.<init>(Unknown Source)
ring.util.servlet$set_body.invoke(servlet.clj:78)
ring.util.servlet$update_servlet_response.invoke(servlet.clj:108)
ring.util.servlet$make_service_method$fn__75.invoke(servlet.clj:124)
flurfunk.servlet$_service.invoke(servlet.clj:1)
flurfunk.servlet.service(Unknown Source)
Works fine when I install Tomcat into a directory without spaces, e.g. C:\Tomcat7. Also works fine with spaces on Mac, so I guess this issue is Windows-only.
Is there any way right now to build an uberwar using a custom web.xml file rather than an auto-generated one?
My use case is that I'd like to integrate ehcache into my project - which requires a separate ehcache.xml file and particular stanzas to be set up in web.xml.
The build process fails with a ClassNotFoundException on the java files defined in java-source-path. The problem might have something to do with differing project maps between 0.6.5 and 0.6.6.
Problem doesn't exist in lein2
I've got the following exception after launching lein ring server
:
Exception in thread "main" java.io.FileNotFoundException:
Could not locate clojure/contrib/prxml__init.class or clojure/contrib/prxml.clj on classpath: (war.clj:1)
...
at leiningen.ring$eval72$loading__4414__auto____73.invoke(ring.clj:1)
at leiningen.ring$eval72.invoke(ring.clj:1)
...
at leiningen.ring.war$eval613$loading__4414__auto____614.invoke(war.clj:1)
at leiningen.ring.war$eval613.invoke(war.clj:1)
I've looked at the source and found that leiningen.ring.war
indeed uses contrib.prxml, although contrib isn't listed in the project dependencies. It only appears in the ring-core, but as a dev-dependency, so it isn't loaded.
lein-ring depends on leinjacker depends on trammel depends on a thneed snapshot, so anybody using lein-ring gets mildly annoying snapshot download messages from lein every day or so.
At a glance, it looks like lein-ring depends on an old version of leinjacker, while newer versions don't depend on trammel and so wouldn't have the issue anymore. Therefore presumably if lein-ring updated its dependency on leinjacker this would go away.
README says:
Defaults to true in development mode, false in production
But I could not see anywhere in lein-ring where to set development or production mode. I grepped through the source looking for the words "development" and "production", and didn't find them.
I did however find in jar.clj
(assoc-in [:ring :open-browser?] false)
(assoc-in [:ring :stacktraces?] false)
(assoc-in [:ring :auto-reload?] false))]
Which would indicate that they are all set to false, even though the README says (and testing indicates) some of those options appear to be set somewhere to true by default.
Hi,
I've noticed that the command below takes a long time to finish (lein ring jar
takes ~7 seconds while lein ring war
takes a minute). I'm not that into clojure compilation internals but is there any explanation of this taking this much time? Is it possible to have a shortcut?
/usr/bin/java -classpath /tank/proger/dev/myproject/test:/tank/proger/dev/myproject/src:/tank/proger/dev/myproject/resources:/tank/proger/dev/myproject/target/classes:/tank/proger/.m2/repository/ring/ring-core/1.2.0-beta2/ring-core-1.2.0-beta2.jar:/tank/proger/.m2/repository/org/clojure/java.classpath/0.2.0/java.classpath-0.2.0.jar:/tank/proger/.m2/repository/org/eclipse/jetty/jetty-io/7.6.8.v20121106/jetty-io-7.6.8.v20121106.jar:/tank/proger/.m2/repository/clj-stacktrace/clj-stacktrace/0.2.5/clj-stacktrace-0.2.5.jar:/tank/proger/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/tank/proger/.m2/repository/ring/ring-jetty-adapter/1.2.0-beta2/ring-jetty-adapter-1.2.0-beta2.jar:/tank/proger/.m2/repository/ns-tracker/ns-tracker/0.2.1/ns-tracker-0.2.1.jar:/tank/proger/.m2/repository/org/eclipse/jetty/orbit/javax.servlet/2.5.0.v201103041518/javax.servlet-2.5.0.v201103041518.jar:/tank/proger/.m2/repository/org/eclipse/jetty/jetty-continuation/7.6.8.v20121106/jetty-continuation-7.6.8.v20121106.jar:/tank/proger/.m2/repository/ring/ring-codec/1.0.0/ring-codec-1.0.0.jar:/tank/proger/.m2/repository/clout/clout/1.0.1/clout-1.0.1.jar:/tank/proger/.m2/repository/org/clojure/tools.reader/0.7.3/tools.reader-0.7.3.jar:/tank/proger/.m2/repository/org/clojure/core.incubator/0.1.0/core.incubator-0.1.0.jar:/tank/proger/.m2/repository/ring/ring-servlet/1.2.0-beta2-SNAPSHOT/ring-servlet-1.2.0-beta2-SNAPSHOT.jar:/tank/proger/.m2/repository/digest/digest/1.3.0/digest-1.3.0.jar:/tank/proger/.m2/repository/org/clojure/tools.macro/0.1.0/tools.macro-0.1.0.jar:/tank/proger/.m2/repository/clj-time/clj-time/0.4.4/clj-time-0.4.4.jar:/tank/proger/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/tank/proger/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar:/tank/proger/.m2/repository/hiccup/hiccup/1.0.3/hiccup-1.0.3.jar:/tank/proger/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/tank/proger/.m2/repository/compojure/compojure/1.1.5/compojure-1.1.5.jar:/tank/proger/.m2/repository/joda-time/joda-time/2.1/joda-time-2.1.jar:/tank/proger/.m2/repository/ring/ring/1.2.0-beta2/ring-1.2.0-beta2.jar:/tank/proger/.m2/repository/org/clojure/tools.nrepl/0.2.2/tools.nrepl-0.2.2.jar:/tank/proger/.m2/repository/org/eclipse/jetty/jetty-http/7.6.8.v20121106/jetty-http-7.6.8.v20121106.jar:/tank/proger/.m2/repository/org/clojure/tools.namespace/0.1.3/tools.namespace-0.1.3.jar:/tank/proger/.m2/repository/org/eclipse/jetty/jetty-util/7.6.8.v20121106/jetty-util-7.6.8.v20121106.jar:/tank/proger/.m2/repository/ring/ring-devel/1.2.0-beta2/ring-devel-1.2.0-beta2.jar:/tank/proger/.m2/repository/commons-fileupload/commons-fileupload/1.2.2/commons-fileupload-1.2.2.jar:/tank/proger/.m2/repository/org/eclipse/jetty/jetty-server/7.6.8.v20121106/jetty-server-7.6.8.v20121106.jar \
-Dclojure.compile.path=/tank/proger/dev/myproject/target/classes \
-Dmyproject.version=0.1.0-SNAPSHOT \
-Dfile.encoding=UTF-8 \
-Dclojure.debug=false \
clojure.main \
-e '(do (set! _warn-on-reflection_ nil) nil (do (clojure.core/compile (quote myproject.servlet)) nil))'
Using lein-ring 0.4.5, I've created a basic servlet. And after:
lein ring uberwar
And then copying the war into my Tomcat 7 web apps directory. I get the following on startup:
Aug 25, 2011 9:58:19 AM org.apache.catalina.startup.ContextConfig processAnnotationsJndi
SEVERE: Unable to process JNDI URL [jndi:/localhost/my-server-0.1.0-standalone/WEB-INF/classes/ring/util/servlet/proxy%24javax] for annotations
java.io.FileNotFoundException: jndi:/localhost/my-server-0.1.0-standalone/WEB-INF/classes/ring/util/servlet/proxy%24javax
at org.apache.naming.resources.DirContextURLConnection.list(DirContextURLConnection.java:457)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJndi(ContextConfig.java:1901)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJndi(ContextConfig.java:1905)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJndi(ContextConfig.java:1905)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJndi(ContextConfig.java:1905)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJndi(ContextConfig.java:1905)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1828)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1295)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:896)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:322)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5103)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:932)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:529)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1377)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1436)
at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:334)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:211)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:187)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:582)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:279)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
When using this project.clj
(defproject cafas "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.4.0"]
[ring/ring-core "1.1.1"]
[ring/ring-jetty-adapter "1.1.1"]]
:profiles {
:dev {:plugins [[lein-swank "1.4.4"]
[lein-ring "0.7.1"]]
:ring {:handler cafas.core/my-app
:auto-reload? true
:auto-refresh? true}}})
and this src/cafas/core.clj
(ns cafas.core
(:use ring.adapter.jetty)
(:use ring.middleware.resource)
(:use ring.middleware.file)
(:use ring.middleware.file-info))
(defn handler [request]
{:status 200
:headers {"Content-Type" "text/plain"}
:body "Hello Another World"})
;; wrap the handler, to be able to add middleware etc
(def my-app (-> #'handler (wrap-file "pages")))
Then, when using leiningen 2 preview 7, when using
lein ring server
All the files in the pages directory are not serving their content, but I get an exception:
java.lang.NullPointerException
Matcher.java:1140 java.util.regex.Matcher.getTextLength
Matcher.java:291 java.util.regex.Matcher.reset
Matcher.java:211 java.util.regex.Matcher.<init>
Pattern.java:888 java.util.regex.Pattern.matcher
core.clj:4286 clojure.core/re-matcher
core.clj:4338 clojure.core/re-find
refresh.clj:18 ring.middleware.refresh/html-content?
refresh.clj:68 ring.middleware.refresh/wrap-with-script[fn]
core.clj:98 compojure.core/routing[fn]
core.clj:2390 clojure.core/some
core.clj:98 compojure.core/routing
RestFn.java:139 clojure.lang.RestFn.applyTo
core.clj:603 clojure.core/apply
core.clj:103 compojure.core/routes[fn]
stacktrace.clj:15 ring.middleware.stacktrace/wrap-stacktrace-log[fn]
stacktrace.clj:79 ring.middleware.stacktrace/wrap-stacktrace-web[fn]
reload.clj:18 ring.middleware.reload/wrap-reload[fn]
jetty.clj:18 ring.adapter.jetty/proxy-handler[fn]
(Unknown Source) ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle
HandlerWrapper.java:111 org.eclipse.jetty.server.handler.HandlerWrapper.handle
Server.java:349 org.eclipse.jetty.server.Server.handle
AbstractHttpConnection.java:452 org.eclipse.jetty.server.AbstractHttpConnection.handleRequest
AbstractHttpConnection.java:884 org.eclipse.jetty.server.AbstractHttpConnection.headerComplete
AbstractHttpConnection.java:938 org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete
HttpParser.java:634 org.eclipse.jetty.http.HttpParser.parseNext
HttpParser.java:230 org.eclipse.jetty.http.HttpParser.parseAvailable
AsyncHttpConnection.java:76 org.eclipse.jetty.server.AsyncHttpConnection.handle
SelectChannelEndPoint.java:609 org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle
SelectChannelEndPoint.java:45 org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run
QueuedThreadPool.java:599 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob
QueuedThreadPool.java:534 org.eclipse.jetty.util.thread.QueuedThreadPool$3.run
Thread.java:680 java.lang.Thread.run
When using the file-info middleware I am not getting the exception, but as result the path to the resource. Starting the webapp with the repl works correctly:
user=> (use 'ring.adapter.jetty)
nil
user=> (use 'cafas.core)
nil
user=> (run-jetty my-app {:port 3000})
As mentioned in #27, the server task currently violates the Leiningen/project process isolation, which was allowed on Leiningen 1 but not 2. Rather than requiring leiningen.ring.run-server
, it should build up a form that it can pass to eval-in-project
.
First off - many thanks for lein-ring @weavejester! Most helpful.
My issue is: I'm building a webservice using Ring and Compojure for SnowPlow and I've been having lots of trouble with intermittent errors when running lein ring server
(and lein ring server-headless
).
It's happened across different commits, and the error message has varied a couple of times. I'm new to Clojure but I don't think it's a code problem - or if it is, I don't understand how it could be happening intermittently. I shutdown lein ring server
with Ctrl-C if that's important.
Anyway, the gist showing the intermittent error happening is here: https://gist.github.com/4001236
And the full source code to my app is here (this is the version causing the intermittent error): https://github.com/snowplow/snowplow/tree/feature/clj-collector/2-collectors/clojure-collector
Any help much appreciated!
When I do lein ring server
, I see "Compiling myapp.main" and then a very long pause while my entire app and all libraries are AOTed. There is no :gen-class
in this namespace, and no need for lein-ring to create an uberwar or anything, so I can't see why anything needs to be AOTed. The slowness is a huge problem, of course, and additionally it leaves around tons of old classfiles, so that if I check out a different git branch with different dependencies, I get conflicts when the old classfiles are used against the new dependencies (at least I think that's what's going on). I have to lein clean
and then AOT the whole thing again, wasting many minutes.
My project.clj contains:
:ring {:handler myapp.main/handler
:port 9255
:open-browser? false
:init myapp.main/init
:destroy myapp.main/destroy
:web-xml "web.xml"}
Is this a known bug in lein-ring? A feature that for some reason I should learn to love? Something that I can easily turn off?
Would it be possible to make war/skip-file?
configurable or optional?
The reason I ask is that currently uberwar
skips files/folders beginning with .
, which doesn't play nicely with Amazon Beanstalk (which uses an .ebextensions
directory, see http://aws.typepad.com/aws/2012/10/customize-elastic-beanstalk-using-configuration-files.html for details).
/cc @yalisassoon
I wasn’t sure whether to file this here or in the Bishop project.
My main handler is defined in my namespace ixdictionary.core
like so:
;; this is a var so it can be used by lein-ring
(def ring-handler (-> (bishop/handler routes)
(wrap-params)
(wrap-multipart-params)))
and my project.clj includes these keys:
:plugins [[lein-ring "0.7.1"]]
:ring {:handler ixdictionary.core/ring-handler}
I’m using Ring 1.1.1 and Leiningen 1.7.1 on Java 1.6.0_33.
My project also specifies Clojure 1.4.0, if that’s important.
When I run my app with lein ring server
, it runs fine, but when I change the source code for my resources, it doesn’t appear to be reloaded.
It seems lein ring uberjar doesn't add the nrepl server if configured
urbite git:master ❯ uname -a ⏎ ✖ ✱ ◼
Darwin macbook.local 12.0.0 Darwin Kernel Version 12.0.0: Sun Jun 24 23:00:16 PDT 2012; root:xnu-2050.7.9~1/RELEASE_X86_64 x86_64
urbite git:master ❯ java -version ✖ ✱ ◼
java version "1.7.0_06"
Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)
urbite git:master ❯ clj ✖ ✱ ◼
Clojure 1.4.0
user=> ^C% urbite git:master ❯ lein version ⏎ ✖ ✱ ◼
Leiningen 2.0.0-preview8 on Java 1.7.0_06 Java HotSpot(TM) 64-Bit Server VM
urbite git:master ❯ lein ring server ✖ ✱ ◼
2012-08-21 13:35:44.940:INFO:oejs.Server:jetty-7.6.1.v20120215
Started server on port 3000
2012-08-21 13:35:44.984:INFO:oejs.AbstractConnector:Started [email protected]:3000
Exception: java.lang.NullPointerException: null
stacktrace.clj:15 ring.middleware.stacktrace/wrap-stacktrace-log[fn]
stacktrace.clj:79 ring.middleware.stacktrace/wrap-stacktrace-web[fn]
reload.clj:18 ring.middleware.reload/wrap-reload[fn]
jetty.clj:18 ring.adapter.jetty/proxy-handler[fn]
(Unknown Source) ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle
HandlerWrapper.java:111 org.eclipse.jetty.server.handler.HandlerWrapper.handle
Server.java:349 org.eclipse.jetty.server.Server.handle
AbstractHttpConnection.java:452 org.eclipse.jetty.server.AbstractHttpConnection.handleRequest
AbstractHttpConnection.java:884 org.eclipse.jetty.server.AbstractHttpConnection.headerComplete
AbstractHttpConnection.java:938 org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete
HttpParser.java:634 org.eclipse.jetty.http.HttpParser.parseNext
HttpParser.java:230 org.eclipse.jetty.http.HttpParser.parseAvailable
AsyncHttpConnection.java:76 org.eclipse.jetty.server.AsyncHttpConnection.handle
SelectChannelEndPoint.java:609 org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle
SelectChannelEndPoint.java:45 org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run
QueuedThreadPool.java:599 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob
QueuedThreadPool.java:534 org.eclipse.jetty.util.thread.QueuedThreadPool$3.run
Thread.java:722 java.lang.Thread.run
Exception: java.lang.NullPointerException: null
stacktrace.clj:15 ring.middleware.stacktrace/wrap-stacktrace-log[fn]
stacktrace.clj:79 ring.middleware.stacktrace/wrap-stacktrace-web[fn]
reload.clj:18 ring.middleware.reload/wrap-reload[fn]
jetty.clj:18 ring.adapter.jetty/proxy-handler[fn]
(Unknown Source) ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle
HandlerWrapper.java:111 org.eclipse.jetty.server.handler.HandlerWrapper.handle
Server.java:349 org.eclipse.jetty.server.Server.handle
AbstractHttpConnection.java:452 org.eclipse.jetty.server.AbstractHttpConnection.handleRequest
AbstractHttpConnection.java:884 org.eclipse.jetty.server.AbstractHttpConnection.headerComplete
AbstractHttpConnection.java:938 org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete
HttpParser.java:634 org.eclipse.jetty.http.HttpParser.parseNext
HttpParser.java:230 org.eclipse.jetty.http.HttpParser.parseAvailable
AsyncHttpConnection.java:76 org.eclipse.jetty.server.AsyncHttpConnection.handle
SelectChannelEndPoint.java:609 org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle
SelectChannelEndPoint.java:45 org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run
QueuedThreadPool.java:599 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob
QueuedThreadPool.java:534 org.eclipse.jetty.util.thread.QueuedThreadPool$3.run
Thread.java:722 java.lang.Thread.run
Looks like lein-ring 0.7.5 and 0.8.0-SNAPSHOT aren't compatible with the latest master version of Leiningen 2:
$ lein ring server-headless
Exception in thread "main" java.lang.AssertionError: Assert failed: (vector? (:dependencies project []))
at leinjacker.deps$add_if_missing.invoke(deps.clj:43)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:603)
at leiningen.ring.util$update_project.doInvoke(util.clj:46)
Not sure if the problem is with leinjacker or Leiningen?
How about making it possible to exclude dependencies from the WAR generated by lein uberwar
?
Our web ring can be build in two ways:
For the JAR, we had to add Jetty as a dependency. The WAR, however, should not include Jetty.
The leiningen jar task provides a :filespecs mechanism which allows you to insert arbitrary entries into the jar file. It'd be nice if war and uberwar did the same.
I'm willing to do the work, but can't get to it right now, and want to make sure you're good with copying the project's filespecs into WEB-INF/classes.
Example of it's usage is in the sample.project.clj
looks like reloading has been broken since 0.5.1.
It would be nice to be able to set a custom ring-servlet version used by lein-ring.
I'm using the lein-ring plugin during development automatically reloads changes to source files without requiring a restart. However changes to the templates are cached and require a restart which lengthens the development feedback cycle. Would it be possible to check if reloading is enabled or provide an option to disable caching behavior in development?
project.clj:
:dependencies [[org.clojure/clojure "1.5.0-RC1"] ...
:plugins
[[lein-ring "0.8.1"]
...
$ lein ring server
Exception in thread "main" java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.LazySeq
at clojure.lang.RT.contains(RT.java:715)
at clojure.core$contains_QMARK_.invoke(core.clj:1402)
at ns_tracker.dependency$depends_QMARK_.invoke(dependency.clj:38)
at ns_tracker.dependency$depend.invoke(dependency.clj:53)
at ns_tracker.dependency$depend$fn__820.invoke(dependency.clj:58)
at clojure.core.protocols$fn__6070.invoke(protocols.clj:143)
at clojure.core.protocols$fn__6041$G__6036__6050.invoke(protocols.clj:19)
at clojure.core.protocols$fn__6070.invoke(protocols.clj:147)
at clojure.core.protocols$fn__6041$G__6036__6050.invoke(protocols.clj:19)
at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
at clojure.core.protocols$fn__6064.invoke(protocols.clj:48)
at clojure.core.protocols$fn__6015$G__6010__6028.invoke(protocols.clj:13)
at clojure.core$reduce.invoke(core.clj:6149)
at ns_tracker.dependency$depend.doInvoke(dependency.clj:59)
at clojure.lang.RestFn.applyTo(RestFn.java:146)
at clojure.core$apply.invoke(core.clj:621)
at ns_tracker.core$add_to_dep_graph$fn__939.invoke(core.clj:27)
at clojure.core.protocols$fn__6070.invoke(protocols.clj:143)
at clojure.core.protocols$fn__6041$G__6036__6050.invoke(protocols.clj:19)
at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
at clojure.core.protocols$fn__6062.invoke(protocols.clj:54)
at clojure.core.protocols$fn__6015$G__6010__6028.invoke(protocols.clj:13)
at clojure.core$reduce.invoke(core.clj:6149)
at ns_tracker.core$add_to_dep_graph.invoke(core.clj:24)
at ns_tracker.core$update_dependency_graph.invoke(core.clj:35)
at ns_tracker.core$ns_tracker.invoke(core.clj:64)
at ns_tracker.core$ns_tracker.invoke(core.clj:58)
at ring.middleware.reload$wrap_reload.doInvoke(reload.clj:14)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at ring.server.standalone$add_auto_reload.invoke(standalone.clj:60)
at ring.server.standalone$add_middleware.invoke(standalone.clj:70)
at ring.server.standalone$serve.doInvoke(standalone.clj:90)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at ring.server.leiningen$serve.invoke(leiningen.clj:20)
at user$eval4799.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6618)
at clojure.lang.Compiler.eval(Compiler.java:6608)
at clojure.lang.Compiler.eval(Compiler.java:6581)
at clojure.core$eval.invoke(core.clj:2852)
at clojure.main$eval_opt.invoke(main.clj:300)
at clojure.main$initialize.invoke(main.clj:319)
at clojure.main$null_opt.invoke(main.clj:354)
at clojure.main$main$fn__6676.invoke(main.clj:432)
at clojure.main$main.doInvoke(main.clj:429)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
note : lein-ring 0.8.0 not have this problem
We currently support multiple resource-paths by doing (concat (:resources-path project)). We support the same for source-paths. It would be super useful to also support multiple war-resources-paths in the same way (so that multiple activated profiles can bring in different sets of war-resources composably).
My use case currently is that I have one set of war-resources that need to be brought in conditionally based on a profile-activated choice of authentication strategy (legacy J2EE authentication or not), and one set that needs to be brought in based on choice of JBoss version. Right now I've got to maintain m*n sets of resources where I could be maintaining m+n with this option.
It was unexpected that this was not the case, so in our case I had to add back code to our project to launch jetty and load the desired web.xml, like so:
(defn webapp-handler []
(doto (WebAppContext.)
(.setDescriptor (str (clojure.java.io/resource "WEB-INF/web.xml")))
(.setContextPath "/")
(.setResourceBase (str (clojure.java.io/resource "WEB-INF/")))
(.setParentLoaderPriority true)))
(defn run-jetty
"Modified from ring implementation to expect a jetty handler instead of a ring handler"
[handler options]
(let [s (#'jetty/create-server
(dissoc options :configurator))]
(doto s
(.setHandler handler)
(.setThreadPool (QueuedThreadPool. (options :max-threads 50))))
(when-let [configurator (:configurator options)]
(configurator s))
(.start s)
(when (:join? options true)
(.join s))
s))
Is this within the scope of lein-ring-server?
When making a project with periods in the folder name, lein ring subprocess fails
I was told this is a Lein-Ring issue, as seen here:
technomancy/leiningen#1161
when running a new lein project, compojure, and running ring server I get an error on the project folder (lb.juncoapps.com):
Exception in thread "main" java.io.FileNotFoundException: Could not locate lb/juncoapps/com/handler__init.class or lb/juncoapps/com/handler.clj on classpath:
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
at clojure.core$load_lib.doInvoke(core.clj:5374)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$require.doInvoke(core.clj:5496)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at user$eval3.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6608)
at clojure.lang.Compiler.eval(Compiler.java:6582)
at clojure.core$eval.invoke(core.clj:2852)
at clojure.main$eval_opt.invoke(main.clj:308)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Subprocess failed
is there a way around this other than renaming the folder?
if this is already an issue being tracked, please let me know and I'll remove this.
Steps to produce error:
Thanks
When creating a uberwar from a project verson controlled by subversion, the .svn files are not ignored, this will results in duplicated entry error. A similar problem for lein uberjar was reported and fixed, see technomancy/leiningen#208, please do the same for lein-ring. Thanks a lot.
I tried installing the latest in my project.clj:
:dev-dependencies [[lein-ring "0.7.1"]]
:ring {:handler server/app
:init server/bootstrap}
Now when I run "lein ring server", it hangs for a second, then spits out an exception about the Ant JAR missing:
Exception in thread "main" The following error occurred while executing this line:
java.io.FileNotFoundException: <my-project-dir>/lib/dev/ant-1.8.2.jar (No such file or directory) (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:482)
When I look in my lib directory, all of my JAR files have been removed.
I wasn't using lein-ring before (manually starting a server) and everything was running fine, but I suppose there could be something conflicting elsewhere in my project.clj that's messing with lein-ring. It's the only dev library I use, and other than a bunch of other standard dependencies (ring, compojure), I only have an :aot for an exception class.
I'm using (on OS X Lion):
Leiningen 1.7.0 on Java 1.6.0_31 Java HotSpot(TM) 64-Bit Server VM
Executing war or uberwar on my Mac now throws a duplicate entry ZipException. This is caused by the .DS_Sore file in each directory on my MAC. Same kind of problem would happen if you were using svn. I have fixed this locally with the following change in war.clj.
(defn skip-file? [project war-path file](or %28re-find #"^.?#" %28.getName file%29%29
%28re-find #"~$" %28.getName file%29%29
%28re-find #".DS_Store" %28.getName file%29%29
%28some #%28re-find % war-path%29
%28get-in project [:ring :war-exclusions]%29%29))
uberwar allows you to specify the filename... it would be nice if uberjar did too.
I modified lein-ring and ring-server to support http-kit, but it is crude. It would be great to have a plug-able design where the decision of server could be pushed back later in development. In my case it was precipitated by my need of web sockets. Please close this ticket if there is a more appropriate discussion group. I could post to.
Consider a simple project:
(defproject ex "0.1.0"
:dependencies [[org.clojure/clojure "1.3.0"]
[compojure "1.0.2"]
[ring/ring-core "1.0.2"]]
:plugins [[lein-ring "0.6.4"]]
:main ex.core
:ring {:handler ex.core/handler})
With leiningen 2 preview release 3, lein ring war
gives the following:
Exception in thread "main" java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
at java.util.regex.Matcher.reset(Matcher.java:291)
at java.util.regex.Matcher.<init>(Matcher.java:211)
at java.util.regex.Pattern.matcher(Pattern.java:888)
at clojure.core$re_matcher.invoke(core.clj:4262)
at clojure.core$re_find.invoke(core.clj:4314)
at leiningen.core.main$_main$fn__642.invoke(main.clj:142)
at leiningen.core.main$_main.doInvoke(main.clj:139)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:405)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.core$apply.invoke(core.clj:600)
at clojure.main$main_opt.invoke(main.clj:323)
at clojure.main$main.doInvoke(main.clj:426)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:413)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.main.main(main.java:37)
You can have a single Servlet class reused everywhere by passing in the var names for init and handler in init-params
http://tutorials.jenkov.com/java-servlets/web-xml.html#initParams
Is it possible to have lein-ring work as a leiningen plugin instead of being an explicit dev dependency in project.clj?
When building a WAR with "lein ring uberwar" and if ring-servlet is only in the lib/dev directory but not in the lib directory, ring-servlet is not added to the WAR.
When deploying the WAR, for instance on Jetty, one get the following error:
"Could not locate ring/util/servlet__init.class or ring/util/servlet.clj on classpath".
A temporary work around is to explicitly adds [ring/ring-servlet "1.0.1"] to the list of dependencies in the project.clj.
I have a project that I have been working on and testing locally using lein ring server
, occasionally I will run lein ring jar
. I went to deploy to AWS Beanstalk today and the beanstalk plugin was throwing an NPE. I tracked it down to lein ring war
.
Any help identifying the cause of this issue would be really appreciated. My project configuration is at the bottom of this issue.
➜ api-clj git:(master) ✗ lein ring jar
Created /Users/eric/src/api-clj/target/provided/api-clj-0.1-SNAPSHOT.jar
➜ api-clj git:(master) ✗ lein ring war
WARNING: read already refers to: #'clojure.core/read in namespace: api-clj.model.products, being replaced by: #'api-clj.model.products/read
Exception in thread "main" java.lang.NullPointerException, compiling:(handler.clj:1:1)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3463)
at clojure.lang.Compiler.compile1(Compiler.java:7153)
at clojure.lang.Compiler.compile1(Compiler.java:7143)
at clojure.lang.Compiler.compile(Compiler.java:7219)
at clojure.lang.RT.compile(RT.java:398)
at clojure.lang.RT.load(RT.java:438)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
at clojure.core$load_lib.doInvoke(core.clj:5374)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$require.doInvoke(core.clj:5496)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at api_clj.servlet$loading__4910__auto__.invoke(servlet.clj:1)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3458)
at clojure.lang.Compiler.compile1(Compiler.java:7153)
at clojure.lang.Compiler.compile1(Compiler.java:7143)
at clojure.lang.Compiler.compile1(Compiler.java:7143)
at clojure.lang.Compiler.compile(Compiler.java:7219)
at clojure.lang.RT.compile(RT.java:398)
at clojure.lang.RT.load(RT.java:438)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$compile$fn__5023.invoke(core.clj:5541)
at clojure.core$compile.invoke(core.clj:5540)
at user$eval7.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6608)
at clojure.lang.Compiler.eval(Compiler.java:6609)
at clojure.lang.Compiler.eval(Compiler.java:6582)
at clojure.core$eval.invoke(core.clj:2852)
at clojure.main$eval_opt.invoke(main.clj:308)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: java.lang.NullPointerException
at clojure.lang.Compiler$ObjExpr.emitVar(Compiler.java:4858)
at clojure.lang.Compiler$DefExpr.emit(Compiler.java:428)
at clojure.lang.Compiler.compile1(Compiler.java:7152)
at clojure.lang.Compiler.compile(Compiler.java:7219)
at clojure.lang.RT.compile(RT.java:398)
at clojure.lang.RT.load(RT.java:438)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
at clojure.core$load_lib.doInvoke(core.clj:5374)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$require.doInvoke(core.clj:5496)
at clojure.lang.RestFn.invoke(RestFn.java:482)
at api_clj.handler$loading__4910__auto__.invoke(handler.clj:1)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3458)
... 51 more
Subprocess failed
project.clj
(defproject api-clj "0.1-SNAPSHOT"
:global-vars {*warn-on-reflection* true
*assert* false}
:plugins [[lein-ring "0.8.5"]
[lein-beanstalk "0.2.7"]]
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/core.incubator "0.1.2"]
[compojure "1.1.5"]
[ring/ring-json "0.2.0"]
[ring-cors "0.1.0"]
[bouncer "0.2.3-beta2"]
[cascalog/carbonite "1.3.0"]
[clojurewerkz/scrypt "1.0.0"]
[org.clojure/java.jdbc "0.3.0-alpha4"]
[mysql/mysql-connector-java "5.1.25"]]
;; these eclusions ensure that AWS SDK logging goes through SLF4J -> Logback
:exclusions [commons-logging
org.slf4j/slf4j-nop
org.slf4j/slf4j-log4j12
log4j]
:ring {:handler api-clj.handler/api}
:profiles {:dev {:dependencies [[ring-mock "0.1.4"]]}})
When i add :source-paths ["src-clj"] to my project.clj. Autoreload of source files stop working.
If i setup :source-paths ["src"] all works fine.
I use Leiningen 2.0.0-preview8
Example of project.clj:
(defproject test "0.2.7" :description "Test" :source-paths ["src-clj"] :dependencies [[org.clojure/clojure "1.4.0"]] :plugins [[lein-ring "0.7.5"]] :ring {:handler example.routes/app :auto-reload? true :port 7777})
My project.clj:
(defproject ixdictionary "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[ring/ring-core "1.1.1"]
[org.clojure/clojure "1.4.0"]
[org.drift-db/drift-db-h2 "1.1.0"]
[korma "0.3.0-beta11"]
[tnrglobal/bishop "1.0.5"]
[cheshire "4.0.0"]
[hiccup "1.0.0"]]
:dev-dependencies [[com.h2database/h2 "1.3.167"]]
:warn-on-reflection true
:main ixdictionary.core
:plugins [[lein-ring "0.7.1"]]
:ring {:handler ixdictionary.core/ring-handler})
ixdictionary.core/-main
just does this: (run-jetty ring-handler {:port 3000})
When I run my app with lein run
it starts up just fine.
But when I try lein ring server
so I can get auto-code-reloading, I get this:
Exception in thread "main" java.io.FileNotFoundException: Could not locate hiccup/page_helpers__init.class or hiccup/page_helpers.clj on classpath:
at clojure.lang.RT.load(RT.java:432)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:605)
at clojure.core$use.doInvoke(core.clj:5392)
at clojure.lang.RestFn.invoke(RestFn.java:482)
at ring.middleware.stacktrace$eval88$loading__4784__auto____89.invoke(stacktrace.clj:1)
at ring.middleware.stacktrace$eval88.invoke(stacktrace.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:605)
at clojure.core$use.doInvoke(core.clj:5392)
at clojure.lang.RestFn.invoke(RestFn.java:512)
at ring.server.standalone$eval11$loading__4784__auto____12.invoke(standalone.clj:1)
at ring.server.standalone$eval11.invoke(standalone.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at ring.server.leiningen$eval5$loading__4784__auto____6.invoke(leiningen.clj:1)
at ring.server.leiningen$eval5.invoke(leiningen.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at user$eval1.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6500)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.