Running sandbar-examples or sandbar/src/examples/forms

24 views
Skip to first unread message

Jeff Kowalczyk

unread,
Feb 19, 2011, 7:17:44 PM2/19/11
to Sandbar Library
tl;dr: error with sandbar-0.3.3 and git master: Could not locate
sandbar/forms2__init.class or sandbar/forms2.clj on classpath.


I'd like to experiment with sandbar, and thought sandbar-examples
would be a
good starting point.

Could we have an update to bring sandbar-examples circa sandbar-0.3.0
into a
runnable state with sandbar-0.3.3?

I'm trying to get a minimal project.clj with the git master
sandbar/src/examples/form files, copied elsewhere to isolate the lein
environment:

path/to/sandbar-test $ tree
project.clj
src
database.clj
disintegrated.clj
integrated.clj
views.clj

path/to/sandbar-test $ cat project.clj
(defproject sandbar-test "1.0.0"
:description "A simple example of using sandbar forms."
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
[compojure "0.6.0"]
[hiccup "0.3.4"]
[sandbar "0.3.3"]
[enlive "1.0.0-SNAPSHOT"]]
:dev-dependencies [[jline "0.9.94"]
[ring/ring-devel "0.3.6"]
[ring/ring-jetty-adapter "0.3.6"]
[ring/ring-httpcore-adapter "0.3.5"]])

path/to/sandbar-test $ lein deps
path/to/sandbar-test $ lein repl
REPL started; server listening on localhost:40592.
user=> (load-file "/path/to/sandbar-test/src/integrated.clj")
Exception in thread "Thread-1" java.lang.RuntimeException:
java.io.FileNotFoundException: Could not locate sandbar/
forms2__init.class or
sandbar/forms2.clj on classpath: (integrated.clj:9)
at clojure.lang.AFn.run(AFn.java:28)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.FileNotFoundException: Could not locate
sandbar/forms2__init.class or sandbar/forms2.clj on classpath:
(integrated.clj:9)

This is the same error I get running from sandbar git clone. Is this a
problem
with the local clojure environment, the project.clj, or additional
lein commands
needed to provide :aot [sandbar.tables] locally?

Thanks.

Brenton

unread,
Feb 19, 2011, 8:06:35 PM2/19/11
to Sandbar Library
Hi Jeff,

The files "integrated.clj" and "disintegrated.clj" are from sandbar
0.4.0-SNAPSHOT and will not work with a previous version. These files
are being used as examples to help develop a new version of forms
based on protocols. The final result will not be much different from
what is in version 0.3.3 but will be more flexible.

To best experiment with sandbar at this point, I would use version
0.3.3 which has examples included. Once I am finished with the new
forms I will add some examples to sandbar-examples to show how to use
them. All of the documentation in the sandbar wiki currently refers to
version 0.3.3.

If this doesn't help, please let me know.

Brenton

Jeff Kowalczyk

unread,
Feb 19, 2011, 9:08:03 PM2/19/11
to Sandbar Library
On Feb 19, 5:06 pm, Brenton <bashw...@gmail.com> wrote:
> Hi Jeff,
>
> The files "integrated.clj" and "disintegrated.clj" are from sandbar
> 0.4.0-SNAPSHOT and will not work with a previous version. These files
> are being used as examples to help develop a new version of forms
> based on protocols. The final result will not be much different from
> what is in version 0.3.3 but will be more flexible.
>
> To best experiment with sandbar at this point, I would use version
> 0.3.3 which has examples included. Once I am finished with the new
> forms I will add some examples to sandbar-examples to show how to use
> them. All of the documentation in the sandbar wiki currently refers to
> version 0.3.3.
>
> If this doesn't help, please let me know.
>
> Brenton


Thanks Brenton, trying 0.3.3 now.

With some adjustment to the instructions at
https://github.com/brentonashworth/sandbar/wiki/Examples, it seems the
user must add user-config/get-connection in sandbar.dev.user-tables-
mysql (src/sandbar/dev/user_tables_mysql.clj) for successful startup.

Can you provide any information on the expected form or function?

Ran mysql config, OK:

$ mysql -u root -p
$ CREATE DATABASE idea_db;
$ GRANT ALL PRIVILEGES ON idea_db.* TO idea_user@localhost IDENTIFIED
BY '123456789';
$ exit

Change: checkout tag 0.3.3, branch stable doesn't exist in upstream
sandbar git.

$ git checkout -b stable 0.3.3

Change: project.clj:

$ git diff
diff --git a/project.clj b/project.clj
index 414d6ad..b2c95cc 100644
--- a/project.clj
+++ b/project.clj
@@ -17,9 +17,10 @@
[deview/lein-deview "1.2.0-SNAPSHOT"]
[lein-difftest "1.3.1"]
[enlive "1.0.0-SNAPSHOT"]
- [radagast "1.0.0"]]
+ [radagast "1.0.0"]
+ [mysql/mysql-connector-java "5.1.6"]]
:hooks [leiningen.hooks.difftest]
- :namespaces [sandbar.dev.tables]
+ :aot [sandbar.dev.tables]
:deview-server 9001
:deview-loc-ext #{"clj" "js" "css" "xml"}
:radagast/ns-whitelist #"^sandbar.*")

$ lein repl
REPL started; server listening on localhost:1940.
user=> (load-file "src/testdrive.clj")
Exception in thread "Thread-1" java.lang.RuntimeException:
java.lang.Exception: No such var: user-config/get-connection
(testdrive.clj:16)
at clojure.lang.AFn.run(AFn.java:28)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.Exception: No such var:
user-config/get-connection (testdrive.clj:16)

Brenton

unread,
Feb 19, 2011, 10:24:50 PM2/19/11
to Sandbar Library
Jeff,

Sorry about that. I should have steered you clear of the Idea Database
application. I have not updated the testdrive.clj file for a while.
There is nothing that you need to do. It just doesn't work. I have
concluded that, at this point, having a full working application is
overkill and too much work to maintain. This is why I removed it and
some of the other experimental parts of Sandbar in version 0.4.0.

The main focus at this point is on sessions, authentication and
authorization and forms. There are simple examples of these in 0.3.3
that should work fine. Almost everything other than the Idea Database.

To get a feel for Sandbar try these examples in this order:

sandbar/example/session_demo.clj
sandbar/example/auth_demo.clj
sandbar/example/form_authentication_demo.clj
sandbar/example/forms/simple.clj
sandbar/example/forms/complex.clj

These examples are small and therefore should be easy to follow.

Sorry that the repo is so disorganized at the moment.

Let me know if you have a problem running these.

Brenton

On Feb 19, 6:08 pm, Jeff Kowalczyk <jeff.kowalc...@gmail.com> wrote:
> On Feb 19, 5:06 pm, Brenton <bashw...@gmail.com> wrote:
>
>
>
> > Hi Jeff,
>
> > The files "integrated.clj" and "disintegrated.clj" are from sandbar
> > 0.4.0-SNAPSHOT and will not work with a previous version. These files
> > are being used as examples to help develop a new version of forms
> > based on protocols. The final result will not be much different from
> > what is in version 0.3.3 but will be more flexible.
>
> > To best experiment with sandbar at this point, I would use version
> > 0.3.3 which has examples included. Once I am finished with the new
> > forms I will add some examples to sandbar-examples to show how to use
> > them. All of the documentation in the sandbar wiki currently refers to
> > version 0.3.3.
>
> > If this doesn't help, please let me know.
>
> > Brenton
>
> Thanks Brenton, trying 0.3.3 now.
>
> With some adjustment to the instructions athttps://github.com/brentonashworth/sandbar/wiki/Examples, it seems the
Reply all
Reply to author
Forward
0 new messages