1

Similar to my earlier question.

Eclipse hangs when trying to debug a Clojure project. Earlier I was using Eclipse Kepler on Windows 8, now same thing happens using Eclipse Juno on Windows XP. The Eclipse error log contains the following relevant entries (earliest at top):

07:30 (Info)  Started ccw nREPL server: nrepl://127.0.0.1:1581
07:30 (Info)  Starting REPL with program args: -i "/C:/Documents and Settings/bjarvis/My Documents/Java/eclipse/configuration/org.eclipse.osgi/bundles/804/1/.cp/ccw/debug/serverrepl.clj" -e "(require 'clojure.tools.nrepl.server)(do (clojure.tools.nrepl.server/start-server :ack-port 1581) nil)"  
07:30 (Info)  Adding to project's classpath to support nREPL: [C:\Documents and Settings\bjarvis\My Documents\Java\eclipse\plugins\ccw.core_0.20.0.STABLE001\tools.nrepl-0.2.1.jar]
07:31 (Error) Waiting for new REPL process ack timed out
07:31 (Error) Waiting for new REPL process ack timed out

One odd thing I noticed was that after the first crash the "Leiningen" and "Clojure" entries in the project right-click menu were gone, so I assume that CCW "crashed" or went away or ??? Exiting Eclipse and starting it up again restored those menu entries.

I realize there's not much information here, but does anyone have any ideas? Note that the debugger worked OK for a few days - then this morning the problems started. Also note that I can run this file successfully by "sending" it to a REPL using Ctrl-Alt-S.

FWIW, the file I'm trying to debug is:

(ns myproject.core
  (:require [clojure.java.jdbc :as jdbc]) )

(defn foo [str]
  (println str "Hello, World!")
)

(defn hello [who]
  (str "Hello " who "!"))

(defn db-test []
    (let [db-path "c:/derby/testdb1"]
      (def db {:classname "org.apache.derby.jdbc.EmbeddedDriver"
               :subprotocol "derby"
               :subname db-path
               :create true})

      (println db)

      ; Create a table named TESTTABLE here and insert some data

      (jdbc/db-do-commands db false
        "CREATE TABLE TESTTABLE
           (ID_TT    BIGINT
              NOT NULL
              GENERATED ALWAYS AS IDENTITY
              CONSTRAINT PK_TESTTABLE
                PRIMARY KEY,
            NAME     VARCHAR(10),
            ADDRESS  VARCHAR(20))"
        "INSERT INTO TESTTABLE (NAME, ADDRESS)
           VALUES ('Bob',  'Home'),
                  ('Jack', 'Top Of The Hill'),
                  ('Elmo', 'Dumpster')"
      )

      ; Query the database to see what you find

      (jdbc/with-connection db 
         (jdbc/with-query-results rs ["SELECT * FROM TESTTABLE"] 
           ; rs will be a sequence of maps, 
           ; one for each record in the result set. 
           (dorun (map #(println (:title %)) rs))))
    )
)
Community
  • 1
  • 1
  • I know I'm answering different question now, but: 1) you should use emacs for writing clojure code. 2) you really don't need "debugger", you have your REPL (and emacs to send code to this repl). 3) you really don't want to write this horrible SQL - http://www.sqlkorma.com/ e.g. – iced Oct 17 '13 at 23:41
  • @iced - Korma looks interesting. At my workplace all code, including SQL, must be submitted for review before it's authorized for installation into production. Is there a way to extract the SQL generated by Korma so it can be reviewed before it's installed? This would need to be all SQL, including both DDL and DML. Thanks. – Bob Jarvis - Слава Україні Oct 20 '13 at 02:57

1 Answers1

0

If you are willing to try another IDE, my experience is that debugging Clojure works really well in IntelliJ, perhaps that will help you. There is a free EAP version that you may use together with the La Clojure plugin (it works best with IntelliJ version 13). http://confluence.jetbrains.com/display/IDEADEV/IDEA+13+EAP

The following blog explains how to debug using IntelliJ: http://blog.tomeklipski.com/2013/04/running-and-debugging-clojure-code-with.html

Odinodin
  • 2,147
  • 3
  • 25
  • 43