I know this question has been asked before, but existing answers do not help.
Existing answers tend to either tell you to put postgresql-.jar in /path/to/db/lib/, which I did; or center around MySQL. I've tried > 5 different answers and nothing is helping.
Here's what I'm running at the Clojure REPL:
(require '[next.jdbc :as jdbc])
(def db {:dbtype "postgres" :dbname "whatever" :user "whoever" :password "yeahright"})
(jdbc/get-connection db)
And I get this error:
Execution error (SQLException) at java.sql.DriverManager/getConnection (DriverManager.java:702).
No suitable driver found for jdbc:postgresql://127.0.0.1:5432/<db_name>
I know where postgresql-42.2.12.jar is located on my computer, and I used :classpath-add to add that path in project.clj. I have double checked the syntax of the URL and it's correct so far as I can tell.
Java version:
$ java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
$ lein -version
Leiningen 2.9.1 on Java 10.0.1 Java HotSpot(TM) 64-Bit Server VM
I have the same problem on Ubuntu & Mac. Does anyone know what is going on?
Per the next.jdbc Getting Started guide https://cljdoc.org/d/seancorfield/next.jdbc/CURRENT/doc/getting-started
"In addition, you will need to add dependencies for the JDBC drivers you wish to use for whatever databases you are using."
For lein that means adding the following to your :dependencies vector in project.clj:
[org.postgresql/postgresql "42.2.10"]
(that's the latest version that next.jdbc is tested against at the time of writing, May 23rd, 2020)
Make sure your project.clj contains an entry like this in
[org.postgresql/postgresql "42.2.12"]
in the :dependencies vector.
Related
Good afternoon,
I am trying to follow this hello world tutorial of lagom, however when running the command:
sbt new -Dsbt.version=0.13.13 lagom/lagom-scala.g8
I get the following error:
Template not found for: -Dsbt.version 0.13.13 lagom/lagom-scala.g8
As stated in the setup part of the tutorial I have checked my java version:
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
My javac version:
javac 1.8.0_131
And my sbt version:
[info] 0.13.15
I have trying running the command with my sbt version as the parameter:
sbt new -Dsbt.version=0.13.13 lagom/lagom-scala.g8
But it still throws the no template error, could you please point out what am I doing wrong?
Which comply with the prerequisites for the tutorial
Turns out I had to remove the -Dsbt.version=0.13.13 parameter of the commmand.
Running it as:
sbt new lagom/lagom-scala.g8
Removes the error and it works correctly.
The problem was not the extra flag. The documentation is correct.
You have to use it before the new command
sbt -Dsbt.version=0.13.13 new lagom/lagom-scala.g8
I'm getting below exception while counting the file rows :
Actually code is working fine if i executes shell in local mode :
But If we try shell with Yarn-client mode -- the below exceptions stack will be returning.
I've been investigated a little bit for the same problem. some are suggesting it's different JVM compatibility issue . It might be true because in other environment am using JDK6 it is working perfect in both local and Yarn-Client modes . In Another Environment am using JDK7 . here am facing the problem while running in yarn-client mode :
java.io.InvalidClassException: scala.reflect.ClassTag$$anon$1; local class incompatible: stream classdesc serialVersionUID = -4937928798201944954, local class serialVersionUID = -8102093212602380348
FYI JAVA - :In Environment am facing the problem
java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build pxa6470_27sr2fp10-20141218_02(SR2 FP10))
IBM J9 VM (build 2.7, JRE 1.7.0 Linux amd64-64 Compressed References 20141215_227395 (JIT enabled, AOT enabled)
J9VM - R27_Java727_SR2_20141215_1631_B227395
JIT - tr.r13.java_20141003_74587.07
GC - R27_Java727_SR2_20141215_1631_B227395_CMPRSS
J9CL - 20141215_227395)
JCL - 20141217_01 based on Oracle jdk7u75-b12
In another old Environment : it is working fine
java -version
java version "1.6.0_91"
Java(TM) SE Runtime Environment (build 1.6.0_91-b31)
Java HotSpot(TM) 64-Bit Server VM (build 20.91-b07, mixed mode
From here I had moved the code to new Environment : If we suspects that it is incompatible version Issue then it shouldn't work in local mode too. Please clarify my questions:
I fixed it By after setting JAVA_HOME to 1.8
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.31-1.b13.el6_6.x86_64/
export PATH=$JAVA_HOME/bin:$PATH
I also experienced the same issue, my cluster using RHEL and jre-1.7.1-ibm.x86_64.
After spending many hours, I found that the cause of the problem came from the JVM
Solution
I was able to solve this issue by changing the jvm from jre-1.7.1-ibm.x86_64
to java-1.8.0-openjdk-1.8.0.25-3.b17.el6_6.x86_64.
I get the following error when I try to run the SCALA REPL. Note that I have already looked into this post where it talks about downgrading java version.
sg#IN0D196716 C:\Users\sg
$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
sg#IN0D196716 C:\Users\sg
$ scala
Exception in thread "main" java.lang.NoSuchMethodError: scala.util.matching.Regex.unapplySeq(Ljava/lang/CharSequence;)Lscala/Option;
at scala.tools.nsc.settings.ScalaVersion$.apply(ScalaVersion.scala:104)
at scala.tools.nsc.settings.ScalaVersion$.apply(ScalaVersion.scala:114)
at scala.tools.nsc.settings.ScalaVersion$.<init>(ScalaVersion.scala:119)
at scala.tools.nsc.settings.ScalaVersion$.<clinit>(ScalaVersion.scala)
at scala.tools.nsc.settings.ScalaSettings$class.$init$(ScalaSettings.scala:138)
at scala.tools.nsc.settings.MutableSettings.<init>(MutableSettings.scala:20)
at scala.tools.nsc.Settings.<init>(Settings.scala:12)
at scala.tools.nsc.GenericRunnerSettings.<init>(GenericRunnerSettings.scala:11)
at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:18)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:41)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:103)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Sorry, dude, that's my fault.
A few years ago, someone said you should only be able to use a regex to extract from strings (char sequences).
That was such a reasonable request. "Tell me if I try to match a regex to something that isn't even a string!"
Unfortunately, because JVM and maven and ivy, you never know what backwards compatibility issues you'll discover.
As you have discovered.
Scala requires that you build and run with the same "major" version.
Here is a similar issue where "user experience" diverges:
https://issues.scala-lang.org/browse/SI-9380
Additional apologies if you don't prefer the gendered "dude", if it is gendered.
I try to deploy a simple "Hello Word" in my local server GlasshFish 3, but at the deploy the console print this message
[#|2013-01-15T15:00:02.458+0100|SEVERE|glassfish3.1.2|
javax.enterprise.system.tools.admin.org.Exception while deploying the app
[HelloWorldEJB] :UnsupportedClassVersionError: Class ejb_other.PlaceAuctionItemBean
as unsupported major or minor version numbers, which are greater than those found
in the Java Runtime Environment version 1.6.0_27|#]
My JAVA_HOME has java version 1.6.0_27 (it refers to _C:\Program Files\Java\jdk1.6.0_27_), my Eclipse (indigo) project refers to java 1.6.0_27.
I think (i don't know how to verify) that GlasshFish refers to JAVA_HOME.
In my PC (Windows 7) I found 2 directory having java.exe:
C:\Windows\SysWOW64>java -version -->>java version "1.6.0_29"
C:\Windows\System32>java -version -->>java version "1.6.0_27"
I found more discussions about this exception (f.e. this or this ), but I need of something more specific for Eclipse/Glasshfish, because I can't to solve. I see that the JVM is the same for compilation and execution.
Post Scriptim
I add the screenshot about the places where I declare JVM: it's always 1.6.
one:
two:
three:
Where can I see that I compile with java 7 or it runs with another JVM?
ejb_other.PlaceAuctionItemBean was obviously compiled for Java 7 which won't work if you run it in a Java 6 JVM.
Found solution
There's another place where setting the compiler's options:
how do I get eclipse to use a different compiler version for Java?
I am using Griffon and want to add the guava libraries as a dependency in my project. However, when I do this, even without using 1 class of it, I get the following exception:
Compilation error: BUG! exception in phase 'canonicalization' in source unit
'/home/wdb/myproject/griffon-app/controllers/MyController.groovy' Prohibited
package name: java.util.concurrent
Any idea what might be wrong? This is my java version (on Ubuntu 11.10):
wdb#wdb-laptop:~$ java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Server VM (build 20.2-b06, mixed mode)
I found this link that talks about using the bootclasspath for a similar problem, but that seems a bit drastic.
regards,
Wim
My wild guess is that our bootclasspath copy of java.util.concurrent.ExecutorService (necessary due to an incompatible change between JDK5 and JDK6) is showing up in your classpath. I don't really know Maven, but I would think that, because we identify the dependency as "provided", this shouldn't be happening.
That's not really an answer, but I hope it's enough to get you or someone else started.
It must be that Griffon does not honor 'provided' scope. I managed to get it working by editing BuilderConfig.groovy to:
compile( 'com.google.guava:guava:10.0.1' ) {
exclude 'guava-bootstrap'
}