FileNotFound Exception with example code

When used the ION Starter files in my example, I am getting this error…

CompilerException java.io.FileNotFoundException: Could not locate datomic/ion/lambda/api_gateway__init.class or datomic/ion/lambda/api_gateway.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name., compiling:(/Users/horizon/clj_projects/dctest/src/clj/dctest/datomic/ion/starter.clj:1:1)

DEPS.EDN file

{:paths [“src” “resources”]
:deps {;; Note that the Datomic client API is not a production
;; dep. It is already installed for you in Datomic Cloud.

    ;; The ion library includes helpers for interacting with
    ;; AWS, e.g. the ionize function to convert a Ring-like
    ;; web function so that it implements the contract expected
    ;; by AWS API Gateway.
    com.datomic/ion {:mvn/version "0.9.7"}
    org.clojure/data.json {:mvn/version "0.2.6"}
    org.clojure/clojure {:mvn/version "1.9.0"}
    com.datomic/ion-dev {:mvn/version "0.9.162"}
    com.datomic/client-cloud {:mvn/version "0.8.54"}}

:mvn/repos {“datomic-cloud” {:url “s3://datomic-releases-1fc2183a/maven/releases”}}
:aliases
{:dev
{:extra-deps
{
;; The client-cloud library is a dev-time only dep
;; so that you can test interactively from a REPL.
com.datomic/client-cloud {:mvn/version “0.8.54”}

;; The ion-dev tooling implements the :push and
;; :deploy commands and is needed only at dev time.
com.datomic/ion-dev {:mvn/version "0.9.162"}}}}}
1 Like

Any suggestion? May be I am doing something very silly…

1 Like

Hi Hkrishnan2005,

What command are you running at the time of this error? Could you copy it here? Are you running a :push?

Thanks,
Jaret

clj…following exactly as the tutorial/the video says…trying to ionize the function…My objective is to move my backend functions to ions behind a lambda, and connect it to an API Gateway…

I also added the deps.edn/config files to an existing project…with lein-tools-deps plugin…

Additional errors…

Could not find artifact com.datomic:ion:jar:0.9.7 in central (https://repo1.maven.org/maven2/)
Could not find artifact com.datomic:ion:jar:0.9.7 in clojars (https://repo.clojars.org/)
Could not find artifact com.datomic:java-io:jar:0.1.12 in central (https://repo1.maven.org/maven2/)
Could not find artifact com.datomic:java-io:jar:0.1.12 in clojars (https://repo.clojars.org/)
Could not find artifact com.cognitect:s3-libs:jar:0.9.34 in central (https://repo1.maven.org/maven2/)
Could not find artifact com.cognitect:s3-libs:jar:0.9.34 in clojars (https://repo.clojars.org/)
Could not find artifact com.datomic:ion-dev:jar:0.9.162 in central (https://repo1.maven.org/maven2/)
Could not find artifact com.datomic:ion-dev:jar:0.9.162 in clojars (https://repo.clojars.org/)
This could be due to a typo in :dependencies, file system permissions, or network issues.

Going back to basics… trying create a simple web app with (cljs/reagent/figwheel) front end, accessing Datomic Cloud backend, with local dev, and prod on aws…

A few guide lines on the workflow might be useful. Thanks.

I’d recommend that you leave lein out of the equation and use only what is in the Ions Tutorial. Start with Ion-starter tutorial app and build up to your application:

https://docs.datomic.com/cloud/ions/ions-tutorial.html

If you still run into errors pulling down the artifacts please post the results here.

Hi @jaret,

I’m grappling with the same exception, which shows up when I require datomic.client.api. Initially I had no such issue with the ion-starter tutorial and had been able to build my own ion project without problem. But at one point, requiring datomic.client.api started failing. Not quite sure how to solve it, I just deleted .m2 folder, reinstalled clojure, and downloaded the fresh ion-starter tutorial from the git repo. When I try to load the starter.clj file, I get the following error.

2. Unhandled clojure.lang.Compiler$CompilerException
   Error compiling src/datomic/ion/starter.clj at (1:1)

1. Caused by java.io.FileNotFoundException
   Could not locate datomic/client/api__init.class or datomic/client/api.clj on
   classpath.

                   RT.java:  463  clojure.lang.RT/load
                   RT.java:  426  clojure.lang.RT/load
                  core.clj: 6046  clojure.core/load/fn
                  core.clj: 6045  clojure.core/load
                  core.clj: 6029  clojure.core/load
               RestFn.java:  408  clojure.lang.RestFn/invoke
                  core.clj: 5848  clojure.core/load-one
                  core.clj: 5843  clojure.core/load-one
                  core.clj: 5888  clojure.core/load-lib/fn
                  core.clj: 5887  clojure.core/load-lib
                  core.clj: 5868  clojure.core/load-lib
               RestFn.java:  142  clojure.lang.RestFn/applyTo
                  core.clj:  659  clojure.core/apply
                  core.clj: 5925  clojure.core/load-libs
                  core.clj: 5909  clojure.core/load-libs
               RestFn.java:  137  clojure.lang.RestFn/applyTo
                  core.clj:  659  clojure.core/apply
                  core.clj: 5947  clojure.core/require
                  core.clj: 5947  clojure.core/require
               RestFn.java:  512  clojure.lang.RestFn/invoke
               starter.clj:    4  datomic.ion.starter/eval10717/loading--auto--
               starter.clj:    4  datomic.ion.starter/eval10717
               starter.clj:    4  datomic.ion.starter/eval10717
             Compiler.java: 7062  clojure.lang.Compiler/eval
             Compiler.java: 7051  clojure.lang.Compiler/eval
             Compiler.java: 7514  clojure.lang.Compiler/load
                       nil:    1  user$eval10710/invokeStatic
                       nil:    1  user$eval10710/invoke
             Compiler.java: 7062  clojure.lang.Compiler/eval
             Compiler.java: 7025  clojure.lang.Compiler/eval
                  core.clj: 3206  clojure.core/eval
                  core.clj: 3202  clojure.core/eval
                  main.clj:  243  clojure.main/repl/read-eval-print/fn
                  main.clj:  243  clojure.main/repl/read-eval-print
                  main.clj:  261  clojure.main/repl/fn
                  main.clj:  261  clojure.main/repl
                  main.clj:  177  clojure.main/repl
               RestFn.java: 1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   87  clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
                  AFn.java:  152  clojure.lang.AFn/applyToHelper
                  AFn.java:  144  clojure.lang.AFn/applyTo
                  core.clj:  657  clojure.core/apply
                  core.clj: 1965  clojure.core/with-bindings*
                  core.clj: 1965  clojure.core/with-bindings*
               RestFn.java:  425  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   85  clojure.tools.nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   55  clojure.tools.nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  222  clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
    interruptible_eval.clj:  190  clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
                  AFn.java:   22  clojure.lang.AFn/run
   ThreadPoolExecutor.java: 1149  java.util.concurrent.ThreadPoolExecutor/runWorker
   ThreadPoolExecutor.java:  624  java.util.concurrent.ThreadPoolExecutor$Worker/run
               Thread.java:  748  java.lang.Thread/run

@hkrishnan2005 @jaret, I have found a solution at least for my case.

I checked .m2 folder which was emptied minutes ago and found the com/datomic/client-cloud folder missing. So I added the datomic-cloud dependency to the main :deps map and then I see the exception disappear. However, if I remove the dependency from the :deps map and only keep :extra-deps in the dev aliase, I get the exception back again.

@hkrishnan2005 From my experience, I suggest you include com.datomic/ion-dev in the main :deps map.

@jaret What puzzles me is that I didn’t have this kind of trouble when I did the ion-starter project a few weeks ago. I mean I didn’t need to add the com.datomic/client-cloud to the main :deps map. Now I’ve got to. Weird. I’m not well-educated about dependency problems, so I cannot provide better explanation than this report.

Having the same problem with ion-starter tutorial. I tried to manually delete the datomic/ion-dev and ~/datomic-cloud folders from ~/.m2 in the hope that it would refetch, but no dice.

Resolved by updating clojure-tools to fix deps.edn alias support. I’m on OSX, so I ran brew upgrade clojure and this fixed it.

1 Like