Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8629755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:53:11+00:00 2026-06-12T08:53:11+00:00

I am trying to :gen-class a Servlet This is my code: (ns test.test (:import

  • 0

I am trying to :gen-class a Servlet
This is my code:

(ns test.test 
(:import (java.io PrintWriter) (javax.servlet.http HttpServlet))
(:gen-class :name test.TestServlet :extends javax.servlet.http.HttpServlet))

(defn -doGet[request response]
    (let [wrtr (.getWriter response)]
        (.println wrtr "hello from clojure")))

it can’t be compiled by Lein
it said Exception in thread “main” java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet (Test.clj:1)

I already modified the :library-path in Lein as “:library-path “/home/long/workspaces/spring/LongHDi/war/WEB-INF/lib” but it didn’t work.

Do you have any idea why?

I am trying to work with Google App Engine. The servlet class I want to extend is already in the lib folder I specified.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:53:12+00:00Added an answer on June 12, 2026 at 8:53 am

    Which version of lein are you using ?

    I downloaded jetty from here, and lein version1 worked for me with project.clj

    (defproject st2 "1.0.0-SNAPSHOT"
     :description "FIXME: write description"
     :library-path "/Users/Niko/Downloads/jetty-hightide-8.1.7.v20120910/lib"
     :aot [st2.core]
     :dependencies [[org.clojure/clojure "1.3.0"]])
    

    with st2.core the same as your code:

    (ns st2.core
     (:import (java.io PrintWriter) (javax.servlet.http HttpServlet))
     (:gen-class :name test.TestServlet :extends javax.servlet.http.HttpServlet))
    
    (defn -doGet[request response]
      (let [wrtr (.getWriter response)]
        (.println wrtr "hello from clojure")))
    

    If you are using lein2, :library-path is not supported so I suspect you would have to add the dependencies “a-la-maven” and add them to your project dependencies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to learn how to use gen-class in Clojure. I've started with this
I'm trying to test my phonegap app on my ipod touch 2nd gen. I
I'm trying to create a class that extends input stream Clojure via gen-class .
I have a class annotated like this: @Entity @Table(name=MYENTITY) @SequenceGenerator(name=CODE_GEN, sequenceName=SEQ_NAME) public class MyEntity
I'm trying to get my iPad (3rd gen) to access a website on my
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
Trying to figure out how I can do this properly. The print_r looks like
I'm trying to build some image algebra code that can work with images (basically
I'm trying to optimize the reflection utilization in my code and I was wondering
I am trying to make my chunk of code non-thread-safe, in order to toy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.