Updated June 29, 2016: Pursuant to SchlomiSchlomi's advice below, I thought that maybe if I AOT compiled my own wrapper around DatastoreOptions that it would work.
Updated June 29, 2016: Pursuant to Schlomi's advice below, I thought that maybe if I AOT compiled my own wrapper around DatastoreOptions that it would work.
Updated June 29, 2016: Pursuant to Schlomi's advice below, I thought that maybe if I AOT compiled my own wrapper around DatastoreOptions that it would work.
Unhandled java.lang.IllegalArgumentException Can't call public method of non-public class: public com.google.cloud.ServiceOptions$Builder com.google.cloud.ServiceOptions$Builder.projectId(java.lang.String) Reflector.java: 88 clojure.lang.Reflector/invokeMatchingMethod Reflector.java: 28 clojure.lang.Reflector/invokeInstanceMethod boot.user4590132375374459695.clj: 168 firengine.state/eval17529 boot.user4590132375374459695.clj: 167 firengine.state/eval17529 Compiler.java: 6927 clojure.lang.Compiler/eval Compiler.java: 6890 clojure.lang.Compiler/eval core.clj: 3105 clojure.core/eval core.clj: 3101 elided clojure.core/eval main.clj: 240 clojure.main/repl/read-eval-print/fn The com.google.cloud.datastore.DatastoreOptions code can be found here.
Updated June 29, 2016: Pursuant to Schlomi's advice below, I thought that maybe if I AOT compiled my own wrapper around DatastoreOptions that it would work.
(ns firengine.datastore (:import [com.google.cloud AuthCredentials] [com.google.cloud.datastore Datastore DatastoreOptions Entity Key KeyFactory]) main.clj(: 240 clojure.main/repl/read-evalgen-printclass main.clj: 258 state clojure.main/repl/fnstate :init init :constructors {[String String] []})) (defn -init [^String project-id ^String main.clj:service-account-path] 258(let [service-account (clojure.mainjava.io/repl input-stream service-account-path) credentials (AuthCredentials/createForJson service-account) main.clj: 174dsoptions (-> clojure.main(DatastoreOptions/replbuilder) RestFn.java: 1523 clojure.lang.RestFn/invoke interruptible_eval(.clj: 87 projectId clojure.tools.nrepl.middleware.interruptibleproject-eval/evaluate/fnid) AFn.java: 152 clojure.lang(.AFn/applyToHelperauthCredentials credentials) AFn.java: 144 clojure.lang.AFn/applyTobuild)] [[] core.clj{: 646 project-id clojure.core/applyproject-id core.clj: 1881 service-account-path clojure.core/withservice-bindings*account-path core.clj: 1881 clojure.core/withdatastore-bindings*options dsoptions}])) I modified my boot development task to include the following:
(deftask development "Launch Immediate Feedback Development Environment" [] (comp (aot RestFn.java: 425 namespace clojure.lang'#{firengine.RestFn/invokedatastore}) (repl interruptible_eval.clj: 85 port clojure.tools.nrepl.middleware.interruptible-eval/evaluate6800) (reload) interruptible_eval.clj: (watch) 55 clojure.tools.nrepl.middleware.interruptible-eval/evaluate(cljs) (target interruptible_eval.clj: 222dir #{"target"}))) And I attempted to construct the object like so:
(def clojure.tools.nrepl.middleware.interruptibleservice-eval/interruptibleaccount-eval/fn/fn path (System/getenv "FIRENGINE_SERVICE_ACCOUNT_PATH")) (def interruptible_eval.clj:project-id (System/getenv 190"PROJECT_ID")) (def datastore-options clojure.tools.nrepl(firengine.middlewaredatastore.interruptible project-eval/runid service-next/fnaccount-path)) AFn.java: Unfortunately, I still get the same error?
22 clojure.lang.AFn/run ThreadPoolExecutor.javaCompiler$CompilerException: 1142 java.utillang.concurrentreflect.ThreadPoolExecutor/runWorker InvocationTargetException, ThreadPoolExecutorcompiling:(state.javaclj: 617 15:1) java.utillang.concurrentreflect.ThreadPoolExecutor$Worker/runInvocationTargetException: java.lang.IllegalArgumentException: Can't call public method of Thread.java:non-public class: 745public com.google.cloud.ServiceOptions$Builder com.google.cloud.ServiceOptions$Builder.projectId(java.lang.Thread/runString) TheAm I not really aot compiling com.google.cloudfirengine.datastore.DatastoreOptions code can be found here.
Ugh. Not clear why the above code works in Java but not in Clojure. Any help getting this to work is appreciated.?
Unhandled java.lang.IllegalArgumentException Can't call public method of non-public class: public com.google.cloud.ServiceOptions$Builder com.google.cloud.ServiceOptions$Builder.projectId(java.lang.String) Reflector.java: 88 clojure.lang.Reflector/invokeMatchingMethod Reflector.java: 28 clojure.lang.Reflector/invokeInstanceMethod boot.user4590132375374459695.clj: 168 firengine.state/eval17529 boot.user4590132375374459695.clj: 167 firengine.state/eval17529 Compiler.java: 6927 clojure.lang.Compiler/eval Compiler.java: 6890 clojure.lang.Compiler/eval core.clj: 3105 clojure.core/eval core.clj: 3101 clojure.core/eval main.clj: 240 clojure.main/repl/read-eval-print/fn main.clj: 240 clojure.main/repl/read-eval-print main.clj: 258 clojure.main/repl/fn main.clj: 258 clojure.main/repl main.clj: 174 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: 646 clojure.core/apply core.clj: 1881 clojure.core/with-bindings* core.clj: 1881 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: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run Thread.java: 745 java.lang.Thread/run The com.google.cloud.datastore.DatastoreOptions code can be found here.
Ugh. Not clear why the above code works in Java but not in Clojure. Any help getting this to work is appreciated.
Unhandled java.lang.IllegalArgumentException Can't call public method of non-public class: public com.google.cloud.ServiceOptions$Builder com.google.cloud.ServiceOptions$Builder.projectId(java.lang.String) Reflector.java: 88 clojure.lang.Reflector/invokeMatchingMethod Reflector.java: 28 clojure.lang.Reflector/invokeInstanceMethod boot.user4590132375374459695.clj: 168 firengine.state/eval17529 boot.user4590132375374459695.clj: 167 firengine.state/eval17529 Compiler.java: 6927 clojure.lang.Compiler/eval ... elided ... The com.google.cloud.datastore.DatastoreOptions code can be found here.
Updated June 29, 2016: Pursuant to Schlomi's advice below, I thought that maybe if I AOT compiled my own wrapper around DatastoreOptions that it would work.
(ns firengine.datastore (:import [com.google.cloud AuthCredentials] [com.google.cloud.datastore Datastore DatastoreOptions Entity Key KeyFactory]) (:gen-class :state state :init init :constructors {[String String] []})) (defn -init [^String project-id ^String service-account-path] (let [service-account (clojure.java.io/input-stream service-account-path) credentials (AuthCredentials/createForJson service-account) dsoptions (-> (DatastoreOptions/builder) (.projectId project-id) (.authCredentials credentials) .build)] [[] {:project-id project-id :service-account-path service-account-path :datastore-options dsoptions}])) I modified my boot development task to include the following:
(deftask development "Launch Immediate Feedback Development Environment" [] (comp (aot :namespace '#{firengine.datastore}) (repl :port 6800) (reload) (watch) (cljs) (target :dir #{"target"}))) And I attempted to construct the object like so:
(def service-account-path (System/getenv "FIRENGINE_SERVICE_ACCOUNT_PATH")) (def project-id (System/getenv "PROJECT_ID")) (def datastore-options (firengine.datastore. project-id service-account-path)) Unfortunately, I still get the same error?
clojure.lang.Compiler$CompilerException: java.lang.reflect.InvocationTargetException, compiling:(state.clj:15:1) java.lang.reflect.InvocationTargetException: java.lang.IllegalArgumentException: Can't call public method of non-public class: public com.google.cloud.ServiceOptions$Builder com.google.cloud.ServiceOptions$Builder.projectId(java.lang.String) Am I not really aot compiling firengine.datastore?
Can't call public method of non-public class: public (Google gcloud library)
I am attempting to use the gcloud library.
(ns firengine.state (:import [com.google.cloud AuthCredentials] [com.google.cloud.datastore DatastoreOptions])) (-> (DatastoreOptions/builder) (.projectId "<project_id>") (.authCredentials (AuthCredentials/createForJson (clojure.java.io/input-stream service-account-path))) .build) The above clojure code is translated from the following code snippet (ellided, click on "Run elsewhere").
import com.google.cloud.AuthCredentials; import com.google.cloud.datastore.DatastoreOptions; DatastoreOptions options = DatastoreOptions.builder() .projectId(PROJECT_ID) .authCredentials(AuthCredentials.createForJson( new FileInputStream(PATH_TO_JSON_KEY))).build(); When I call this code from the Clojure REPL, I get the following error.
Unhandled java.lang.IllegalArgumentException Can't call public method of non-public class: public com.google.cloud.ServiceOptions$Builder com.google.cloud.ServiceOptions$Builder.projectId(java.lang.String) Reflector.java: 88 clojure.lang.Reflector/invokeMatchingMethod Reflector.java: 28 clojure.lang.Reflector/invokeInstanceMethod boot.user4590132375374459695.clj: 168 firengine.state/eval17529 boot.user4590132375374459695.clj: 167 firengine.state/eval17529 Compiler.java: 6927 clojure.lang.Compiler/eval Compiler.java: 6890 clojure.lang.Compiler/eval core.clj: 3105 clojure.core/eval core.clj: 3101 clojure.core/eval main.clj: 240 clojure.main/repl/read-eval-print/fn main.clj: 240 clojure.main/repl/read-eval-print main.clj: 258 clojure.main/repl/fn main.clj: 258 clojure.main/repl main.clj: 174 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: 646 clojure.core/apply core.clj: 1881 clojure.core/with-bindings* core.clj: 1881 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: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run Thread.java: 745 java.lang.Thread/run The com.google.cloud.datastore.DatastoreOptions code can be found here.
Ugh. Not clear why the above code works in Java but not in Clojure. Any help getting this to work is appreciated.