[Armedbear-devel] handling dependencies

Mark Evenson evenson at panix.com
Mon Aug 18 07:30:38 UTC 2014

On 17 Aug 2014, at 22:37, Eduardo Bellani <ebellani at gmail.com> wrote:


> I am trying to build a servlet using ABCL. The servlet is a middleware
> that will expose an API, consume JSON, and return JSON. I will also
> store some data into a postgres RDBMS.
> I've used the google-app-engine example as a basis to build a skeleton
> of my app, with a Java class providing a proxy for the servlet. If I
> don't use any dependencies on my project, everything runs ok. My
> problem is that I have the following system descriptor:
> (asdf:defsystem #:abcl-servlet
>  :serial t
>  :description "An example of a servlet using the ABCL stack."
>  :author  "Eduardo Bellani <ebellani at gmail.com>"
>  :license "Beerware v. 42"
>  :depends-on (:jsown
>               :postmodern)
>  :components ((:module :src
>                        :components ((:file "package")
>                                     (:file "servlet-interface")))))

N.b. my more recent experimentation with Lisp servlets can be found in
[abcl-servlet][1], which should (eventually) supersede the googlecode work.
Unfortunately, building ‘abcl-servlet’ at the moment requires Netbeans to be
intalled, which is something I eventually want to make an optional dependency.
Never-the-less, studying org.abcl.servlet.Lisp is probably worth something to

[1]: https://bitbucket.org/easye/abcl-servlet

If you have ABCL running in the servlet, you should be able to use ASDF to find
these dependencies.  

In my recent project I added all of my ASDF dependencies to WAR as
“asdf/<SYSTEM>” including “illithid” the system that I am running, and then use
the following code in the servlet to kick things off.  This requires that one
runs the servlet in “exploded mode” so that ServletContext.getRealPath()
returns a location on the filesystem.  Not all servlet containers support an
"exploded mode”, but Tomcat certainly does.

(defun servlet-root ()
  (concatenate ‘string 
	       ;; relies on there being a static field to reference the ServletContext
               ;; cf. https://bitbucket.org/easye/abcl-servlet
               (#"getRealPath" (java:jfield "org.abcl.servlet.Lisp" "servletContext") "/")

(defun configure-asdf ()
     (:tree ,(merge-pathnames "asdf/" (servlet-root))))))

(cl:in-package #:cl-user)
(setf *load-verbose* t)
(push :hunchentoot-no-ssl *features*)
(asdf:load-system :illithid)

"A screaming comes across the sky.  It has happened before but there is nothing 
to compare to it now."

Armedbear-devel mailing list
Armedbear-devel at common-lisp.net

More information about the armedbear-devel mailing list