noir-clojure / noir

A framework for writing web applications in clojure.
http://www.webnoir.org/
740 stars 81 forks source link

load-views-ns doesn't work #53

Open gzeureka opened 12 years ago

gzeureka commented 12 years ago

I have add this to server.clj (server/load-views-ns 'test.views)

and use lein ring uberwar to deploy to Resin, but it results in "We seem to have lost that one. Since we couldn't find the page you were looking for, check to make sure the address is correct." for /welcome. And I digged further to find out that (println "classpath " (classpath/classpath)) the classpath wasn't setup correctly. The classpath is as follow: classpath (#<File D:\resin\resin-3.1.9-clojure\lib\resin.jar> #<File D:\resin\r esin-3.1.9-clojure\classes> #<File D:\resin\resin-3.1.9-clojure\lib\resin.jar> # <File d:\jdk\jdk1.7.0_01\lib\tools.jar> #<File d:\jdk\jdk1.7.0_01\jre\lib\rt.jar

<File D:\resin\resin-3.1.9-clojure\lib\activation.jar> #<File D:\resin\resin-

3.1.9-clojure\lib\ejb-15.jar> #<File D:\resin\resin-3.1.9-clojure\lib\hessian.ja r> #<File D:\resin\resin-3.1.9-clojure\lib\j2ee-management-10.jar> #<File D:\res in\resin-3.1.9-clojure\lib\javamail-141.jar> #<File D:\resin\resin-3.1.9-clojure \lib\jaxrpc-15.jar> #<File D:\resin\resin-3.1.9-clojure\lib\jaxws-api.jar> #<Fil e D:\resin\resin-3.1.9-clojure\lib\jca-15.jar> #<File D:\resin\resin-3.1.9-cloju re\lib\jms-11.jar> #<File D:\resin\resin-3.1.9-clojure\lib\jpa-15.jar> #<File D: \resin\resin-3.1.9-clojure\lib\jsdk-15.jar> #<File D:\resin\resin-3.1.9-clojure\ lib\jsf-12.jar> #<File D:\resin\resin-3.1.9-clojure\lib\jsr88.jar> #<File D:\res in\resin-3.1.9-clojure\lib\jstl-11.jar> #<File D:\resin\resin-3.1.9-clojure\lib\ jta-101.jar> #<File D:\resin\resin-3.1.9-clojure\lib\jws-15.jar> #<File D:\resin \resin-3.1.9-clojure\lib\mysql-connector-java-5.1.11-bin.jar> #<File D:\resin\re sin-3.1.9-clojure\lib\ojdbc6.jar> #<File D:\resin\resin-3.1.9-clojure\lib\portle t-10.jar> #<File D:\resin\resin-3.1.9-clojure\lib\quercus.jar> #<File D:\resin\r esin-3.1.9-clojure\lib\resin-deploy.jar> #<File D:\resin\resin-3.1.9-clojure\lib \resin-util.jar> #<File D:\resin\resin-3.1.9-clojure\lib\saaj.jar> #<File D:\res in\resin-3.1.9-clojure\lib\script-10.jar> #<File D:\resin\resin-3.1.9-clojure\li b\sqljdbc4.jar> #<File D:\resin\resin-3.1.9-clojure\lib\webbeans-16.jar> #<File D:\resin\resin-3.1.9-clojure\lib\webutil.jar>)

And clue to this issue? Is it related to (clojure.lang.RT/baseLoader) ?

ibdknox commented 12 years ago

In a war, the only thing that will work is requiring the views explicitly at the top of your file. See this previous issue: https://github.com/ibdknox/noir/issues/26

gzeureka commented 12 years ago

Thanks Chris.

Well, I found out that it's caused by the classpath-directories function defined in clojure.java.classpath:

(defn classpath-directories
  "Returns a sequence of File objects for the directories on classpath."
  []
  (filter #(.isDirectory ^File %) (classpath)))

it calls classpath function without argument which will call (clojure.lang.RT/baseLoader) , I modify it to

(defn classpath-directories
  "Returns a sequence of File objects for the directories on classpath."
  []
  (filter #(.isDirectory ^File %) (classpath (.getContextClassLoader (Thread/currentThread))))

then load-views-ns works. I don't know whether it is feasible.

Raynes commented 12 years ago

This will probably be fixed if we start using bultitude. I'll make that change soon and let you know.

gzeureka commented 12 years ago

That's awesome! Looking forward to it.

在 2012-5-8,下午2:52,Anthony Grimesreply@reply.github.com 写道:

This will probably be fixed if we start using bultitude. I'll make that change soon and let you know.


Reply to this email directly or view it on GitHub: https://github.com/ibdknox/noir/issues/53#issuecomment-5568556

Raynes commented 12 years ago

@gzeureka Could you try out beta5 for me and see if it works? I moved to bultitude.

gzeureka commented 12 years ago

Sorry Raynes, I tried beta5 but the problem still persists.

Raynes commented 12 years ago

Obviously the work of Satan. I'll take a look. I figured it would work because I'm pretty sure it looks in like 2309523423423ERRORERROR classpaths.