Fork me on GitHub
#leiningen
<
2017-07-26
>
niquola11:07:32

Hi, i’m not sure this is lein problem, but in our CI in docker we are getting Exception in thread "main" java.io.FileNotFoundException: /tmp/form-init5758952 in absolutely random places - deps, uberjar, test … ?

dorab20:07:26

Would appreciate any help to figure out what I'm doing worng here.

lein run
WARNING!!! version ranges found for:
[com.google.cloud/google-cloud-speech "0.17.1-alpha"] -> [io.grpc/grpc-netty "1.2.0"] -> [io.grpc/grpc-core "[1.2.0,1.2.0]"]
Consider using [com.google.cloud/google-cloud-speech "0.17.1-alpha" :exclusions [io.grpc/grpc-core]].
[com.google.cloud/google-cloud-speech "0.17.1-alpha"] -> [io.grpc/grpc-netty "1.2.0"] -> [io.netty/netty-codec-http2 "[4.1.8.Final,4.1.8.Final]"]
Consider using [com.google.cloud/google-cloud-speech "0.17.1-alpha" :exclusions [io.netty/netty-codec-http2]].
[com.google.cloud/google-cloud-speech "0.17.1-alpha"] -> [io.grpc/grpc-auth "1.2.0"] -> [io.grpc/grpc-core "[1.2.0,1.2.0]"]
Consider using [com.google.cloud/google-cloud-speech "0.17.1-alpha" :exclusions [io.grpc/grpc-core]].
[com.google.cloud/google-cloud-speech "0.17.1-alpha"] -> [com.google.cloud/google-cloud-core-grpc "1.0.0"] -> [com.google.api/gax-grpc "0.16.0"] -> [io.grpc/grpc-netty "1.2.0" :exclusions [com.google.guava/guava-jdk5]] -> [io.grpc/grpc-core "[1.2.0,1.2.0]"]
Consider using [com.google.cloud/google-cloud-speech "0.17.1-alpha" :exclusions [io.grpc/grpc-core]].
[com.google.cloud/google-cloud-speech "0.17.1-alpha"] -> [com.google.cloud/google-cloud-core-grpc "1.0.0"] -> [com.google.api/gax-grpc "0.16.0"] -> [io.grpc/grpc-netty "1.2.0" :exclusions [com.google.guava/guava-jdk5]] -> [io.netty/netty-codec-http2 "[4.1.8.Final,4.1.8.Final]"]
Consider using [com.google.cloud/google-cloud-speech "0.17.1-alpha" :exclusions [io.netty/netty-codec-http2]].
[com.google.cloud/google-cloud-speech "0.17.1-alpha"] -> [com.google.cloud/google-cloud-core-grpc "1.0.0"] -> [com.google.api/gax-grpc "0.16.0"] -> [io.grpc/grpc-auth "1.2.0" :exclusions [com.google.guava/guava-jdk5]] -> [io.grpc/grpc-core "[1.2.0,1.2.0]"]
Consider using [com.google.cloud/google-cloud-speech "0.17.1-alpha" :exclusions [io.grpc/grpc-core]].

Exception in thread "main" java.lang.ClassNotFoundException: com.google.cloud.speech.v1.SpeechClient, compiling:(callj/core.clj:1:1)

dorab20:07:05

The project.clj is

(defproject callj "0.1.0-SNAPSHOT"
  :description "Transcription of phone calls."
  :url ""
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [com.google.cloud/google-cloud-speech "0.17.1-alpha"]
                 ]
  :main callj.core
  )

dorab20:07:05

And the core.clj file is

(ns callj.core
  (:import (com.google.cloud.speech.v1
            RecognitionAudio
            RecognitionConfig
            RecognizeResponse
            SpeechClient
            SpeechRecognitionAlternative
            SpeechRecognitionResult)
           (com.google.protobuf ByteString)
           (java.nio.file Files Path Paths)
           )
  )

(defn doexample
  [filename]
  (let [speech (SpeechClient/create)
        path (Files/get filename)
        data (Files/readAllBytes path)
        audiobytes (ByteString/copyFrom data)
        config (doto (RecognitionConfig/newBuilder)
                 (.setEncoding RecognitionConfig$AudioEncoding/FLAC)
                 (.setSampleRateHertz 8000)
                 (.setlanguageCode "en-US")
                 (.build))
        audio (doto (RecognitionAudio/newBuilder)
                (.setContent audiobytes)
                (.build))
        ;;
        response (.recognize speech config audio)
        results (.getResultsList response)]
    (doseq [result results]
      (doseq [alternative (.getAlternativesList result)]
        (println "Transcription:" (.getTranscript alternative))))
    (.close speech)))

(defn -main
  "Run example."
  [& args]
  (let [filename "./data/1888405886.flac"]
    (doexample filename)
    ))

dorab20:07:31

Is there a work-around?

danielcompton20:07:51

@dorab have you tried using the suggested exclusions?

dorab20:07:42

I tried several. I'll attempt to re-create and post what I did. Thanks.

danielcompton20:07:11

Here's what I used when I was using Spanner:

;; Google
   [com.google.cloud/google-cloud-spanner "0.11.0-beta"
    :exclusions [com.google.guava/guava-jdk5
                 ;; Delete these two auth exclusions once a new version of cloud-spanner is out that includes
                 ;; 
                 com.google.auth/google-auth-library-credentials
                 com.google.auth/google-auth-library-oauth2-http]]
   [com.google.cloud/google-cloud-storage "0.11.0-beta"
    :exclusions [com.google.guava/guava-jdk5]]
   [com.google.guava/guava "19.0"]
   [com.google.auth/google-auth-library-credentials "0.6.0"]
   [com.google.auth/google-auth-library-oauth2-http "0.6.0"]

dorab20:07:24

Thanks. I'll try those as well.

dorab20:07:19

The following in my project.clj makes the warnings go away

(defproject callj "0.1.0-SNAPSHOT"
  :description "Transcription of phone calls."
  :url ""
  :dependencies [[org.clojure/clojure "1.8.0"]
                 ;; [com.google.cloud/google-cloud-speech "0.17.1-alpha"]
                 [com.google.cloud/google-cloud-speech "0.17.1-alpha" :exclusions [io.grpc/grpc-core io.netty/netty-codec-http2]]
                 [io.grpc/grpc-core "1.2.0"]
                 [io.netty/netty-codec-http2 "4.1.8.Final"]
                 ]
  :main callj.core
  )
but the error
$ lein run
Exception in thread "main" java.lang.ClassNotFoundException: com.google.cloud.speech.v1.SpeechClient, compiling:(callj/core.clj:1:1)
still remains

dorab21:07:06

Thanks @danielcompton for the help. The remaining problems I have seems to be related to Google's documentation being incorrect.