Unable to get JDBC connection with PostgreSQL - java

I am trying to get a JDBC connection to PostgreSQL. Driver version in dependency is: 9.4-1204-jdbc42 and Postgres version is 9.5.0. Following is the stack:
Caused by: java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.springframework.jdbc.datasource.DriverManagerDataSource.setDriverClassName(DriverManagerDataSource.java:127)
at com.biginfolabs.ipmonitor.core.config.HibernateConfiguration.dataSource(HibernateConfiguration.java:41)
at com.biginfolabs.ipmonitor.core.config.HibernateConfiguration$$EnhancerByCGLIB$$a2cde1cc.CGLIB$dataSource$2(<generated>)
at com.biginfolabs.ipmonitor.core.config.HibernateConfiguration$$EnhancerByCGLIB$$a2cde1cc$$FastClassByCGLIB$$17817301.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:326)
at com.biginfolabs.ipmonitor.core.config.HibernateConfiguration$$EnhancerByCGLIB$$a2cde1cc.dataSource(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:166)
... 49 more
Please suggest what is the issue here?

"unsupported major.minor version 52" says that you must use java8 and are running in java7 or lower.
according to https://jdbc.postgresql.org/download.html
9.4-1204-jdbc42 is the driver compiled in java8.
9.4-1204-jdbc41 is the driver compiled in java7.
9.4-1204-jdbc4 is the driver compiled in java6.

The PostgreSQL driver you're using is built for Java 1.8, but you're not running Java 1.8 - probably you're running Java 1.7
Either upgrade to Java 1.8 or use the postgresql-9.4.1207.jre7.jar file that works with Java 1.7 (as you can see here )

Related

sbt - Unsupported major.minor version 52.0 Error when executed in Jdk 1.7

I have a jar which has been created using sbt on my local system with the following configuration:
JDK 1.8,
SBT 1.2.8
I wanted to execute the jar on a VM which has JDK 1.7. To create the jar such that it can be executed in JDK 1.7, I added the following to my build.sbt:
javacOptions ++= Seq("-source", "1.7", "-target", "1.7")
scalacOptions := Seq("-target:jvm-1.7")
javaHome := Some(file("C:\\Program Files\\Java\\jdk1.7.0_80"))
However despite specifying sbt to target JDK 1.7 I am getting the following error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/uic/mapreduce/Main : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.hadoop.util.RunJar.run(RunJar.java:219)
at org.apache.hadoop.util.RunJar.main(RunJar.java:141)
All other threads for this problem seem to be resolved with the above changes. I seem to be missing something here.

Newly-installed Ant doesn't run on Mac OS 10.12.5

I just installed apache-ant using MacPorts:
sudo port install apache-ant
When I type ant -version, I get the following:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
How can I fix this?
you need to upgrade the JRE you're running it with - the jar is compiled with 1.8

#EnableEncryptableProperties is not working

I am new to Spring-boot and trying to encrypt password in application.properties file using jasypt library. I used #EnableEncryptableProperties with #SpringBootApplication and getting error. Don't know how to get its resolution. Following is the dependency used in my pom.xml. I am using JDK 7 to build this Application. If you know any other framework to encrypt password in properties it will be appreciated.
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot</artifactId>
<version>1.2</version>
</dependency>
My main class is :
#SpringBootApplication
#EnableSwagger2
#EnableJSONDoc
#EnableAsync
#EnableEncryptableProperties
public class App extends SpringBootServletInitializer{
...
}
And i am getting following exception:
java.lang.UnsupportedClassVersionError: com/ulisesbocchio/jasyptspringboot/annotation/EnableEncryptableProperties : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:432)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:238)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:117)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3271)
at java.lang.Class.getDeclaredAnnotations(Class.java:3248)
The messages tells you that the class-file which should be loaded was compiled for java 8. So you need a JDK8 to use the "com.github.ulisesbocchio/jasypt-spring-boot" library.
You can have a look at spring cloud. It supports encrypted properties and only needs java 7 (afaik)

kettle startup inUbuntu

When I want to start Kettle:
$ cd ../kettle/data-integration
$ spoon.sh
The following error appears:
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Exception in thread "main" java.lang.NoClassDefFoundError: org/pentaho/ui/xul/XulEventSource
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.pentaho.commons.launcher.Launcher.main(Launcher.java:128)
Caused by: java.lang.ClassNotFoundException: org.pentaho.ui.xul.XulEventSource
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 12 more
What's wrong? Can anyone help?Many thanks.
Kettle is currently (5.0) supported using Java 7, please try with JDK or JRE 7
That class should be in the pentaho-xul-core jar located in your lib folder, there's a pretty serious problem with your classpath if it can't be found
Please edit spoon.sh to echo the command it's about to run on the last line (add "echo " at the beginning of the last line, exclude the quotes) and post what it comes out with.

How to run a project that written in NetBeans on another computer?

I wrote a project in NetBeans IDE in my computer, and I ran it. That was OK. I transferred it into my Friend's computer. I ran it with NetBeans, but I got these errors:
java.lang.UnsupportedClassVersionError: friendspro/Server/RunServer : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: friendspro.Server.RunServer. Program will exit.
Exception in thread "main" Java Result: 1
///
When I ran my project in my computer in CMD, I got the same error:
C:\Users\Blue\Desktop\FriendsPro\src\friendspro\Server>java RunServer -ORBIniti
alRef NamingServic=corbaloc::localhost:1049/NameService
Exception in thread "main" java.lang.NoClassDefFoundError: RunServer (wrong name
: friendspro/Server/RunServer)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
2)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:476)
It's not the same error. Your friend has an older Java version. Here's how to target older Java versions in NetBeans: Target JDK for Java Applications.
You are running your program incorrectly. You need to do
java friendspro.Server.RunServer -ORBIniti ...
in your main directory (probably bin or src).
On your computer, open CMD, cd to your source directory and then, as Banthar specified,
java friendpro.Server.RunServer ...

Categories

Resources