0

I have a clojure project in which i used the hiccup library. I want to ask does it work in a similar way as normal clojure and jsp projects ? When i am hosting it on a tomcat server and trying to run it on the web, file not found error comes.

this is my project.clj file

(defproject web-app "0.1.0-SNAPSHOT"  :description "FIXME: write description"  :url "http://example.com/FIXME"  :license {:name "Eclipse Public License"          :url "http://www.eclipse.org/legal/epl-v10.html"}  :dependencies [[org.clojure/clojure "1.8.0"]               [clj-jgit "0.8.10"]               [org.clojure/data.json "0.2.6"]               [clj-yaml "0.4.0"]               [io.forward/yaml "1.0.9"]               [hiccup "1.0.5"]               [compojure "1.6.1"]               [ring/ring-core "1.6.3"]               [ring/ring-defaults "0.3.2"]               [ring/ring-jetty-adapter "1.6.3"]]      :plugins [[lein-ring "0.12.4"]]   :ring {:handler handler.core/-main}   :main handler.core)

this is my handler namespace

(ns handler.core  (:require [layout.core :as veiw_mapper]          [web-app.core ]          [compojure.core :refer :all]          [compojure.route :as route]          [ring.adapter.jetty :as jetty]          [ring.middleware.defaults :refer [wrap-defaults site-defaults]])    (:gen-class))   (defroutes app-routes   (GET "/" [] (veiw_mapper/index))  (POST "/" [& params] (web-app.core/update-mapper params))         ;;(POST "/about" [] ())  (route/resources "//")  (route/not-found "Not Found"))  (def app  (wrap-defaults app-routes site-defaults))  (defn -main[]   )

i am making the war file and pasting it into the webapps folder and then running the tomcat server.

Type Exception ReportMessage No matching ctor found for class java.lang.IntegerDescription The server encountered an unexpected condition that prevented it from fulfilling the request.    Exception java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer    clojure.lang.Reflector.invokeConstructor(Reflector.java:183)    handler.core$_main.invokeStatic(core.clj:21)    handler.core$_main.doInvoke(core.clj:19)    clojure.lang.RestFn.invoke(RestFn.java:408)    clojure.lang.Var.invoke(Var.java:379)    handler.listener$_contextInitialized$fn__11.invoke(listener.clj:1)    ring.util.servlet$make_service_method$fn__3668.invoke(servlet.clj:129)    handler.servlet$_service.invokeStatic(servlet.clj:1)    handler.servlet$_service.invoke(servlet.clj:1)    handler.servlet.service(Unknown Source)    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

this is the error which comes.

askedSep 3, 2018 at 4:25
N.Singh's user avatar
1
  • You really have to provide the code (or the template) you used, how you deployed to tomcat and the errors and logs you get. SO is about solving concrete programming problems.CommentedSep 3, 2018 at 7:32

1 Answer1

2

One hint is the Exception you got:

java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer

So it is trying to construct anInteger but can't find the right constructor (ctor). This probably means a garbage value was supplied someplace it expected an integer. For example:

> (Integer. {})   ; can't construct an Integer from an empty mapIllegalArgumentException No matching ctor found for class java.lang.Integer  clojure.lang.Reflector.invokeConstructor (Reflector.java:183)

Another hint is a mispelledview:

(GET "/" [] (veiw_mapper/index))

The best approach is to find a working example, get it working on your machine, and then add in just 1-3 new lines at a time until you get it working.

answeredSep 3, 2018 at 18:15
Alan Thompson's user avatar
Sign up to request clarification or add additional context in comments.

1 Comment

thanks for the suggestion i will try to implement it.

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.