4

Exception: Exception in thread "main" java.io.FileNotFoundException: Could not locate hiccup/form_helpers__init.class or hiccup/form_helpers.clj on classpath:

I'm trying to get a toy compojure app up and running. The original app was from CloudBees and their ClickStart app for Clojure/Compojure. I'm trying to add a simple form (that won't persist anything yet) using hiccup form_helpers but I'm getting a ClassNotFound exception. Here's what I've done:

project.clj:

(defproject mywebapp "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.4.0"]
             [compojure "1.1.1"]
             [hiccup "1.0.1"]]
:plugins [[lein-ring "0.7.3"]]
:ring {:handler mywebapp.routes/app}
:profiles
{:dev {:dependencies [[ring-mock "0.1.3"]]}})

views.clj:

(ns mywebapp.views
(:use [hiccup core page]
    [hiccup form-helpers :only [form-to label text-area submit-button]]))
...
(defn shout-form []
[:div {:id "shout-form" }
 (form-to [:post "/form"]
        (label "shout" "What do you want to SHOUT?")
        [:br]
        (text-area "shout")
        [:br]
        (submit-button "SHOUT!"))])
...
Ramy
  • 20,541
  • 41
  • 103
  • 153

1 Answers1

3

Ah, looks like I just had an old example of forms in hiccup. form_helpers was from a previous version.

if I change my views.clj file from this:

(:use [hiccup form-helpers])

to look like this:

(:use [hiccup form])

(and presumably this would work though i haven't tested it):

(:use [hiccup form :only [form-to label text-area submit-button]])

I don't get the error anymore.

To clarify: the package used to be called "form_helpers" and is now simply called "form".

Ramy
  • 20,541
  • 41
  • 103
  • 153
  • 1
    I don't get why the change fixes the issue? Could you elaborate? – Jacek Laskowski Mar 04 '13 at 05:05
  • see my edit - sorry i was unclear. (didn't think anyone noticed my question/answer) – Ramy Mar 04 '13 at 14:04
  • That's much better now. Thanks a lot! Could you please also add the exception to the question so it has all the information? That would make the question and the answer complete. – Jacek Laskowski Mar 04 '13 at 22:39
  • i don't have the exact exception anymore. It was just a ClassNotFound exception - kind of like when your code expects a dependency to be in your classpath but doesn't find it. – Ramy Mar 05 '13 at 21:36
  • 1
    I understand. With the exception's stack trace the question and the answer would be more complete and perhaps Google searches would lead more often. – Jacek Laskowski Mar 05 '13 at 23:43
  • added the exception, fyi Jacek – Ramy Mar 14 '13 at 04:05