Class not found exception "java.time.temporal.TemporalField" when connecting to jdbc:postgresql from Matlab - postgresql

I'm trying to connect to a PostgreSQL database from Matlab. This is my code:
javaclasspath('/usr/share/java/postgresql-jdbc4.jar');
properties = java.util.Properties;
properties.setProperty('user', '********');
properties.setProperty('password', '********');
driver = org.postgresql.Driver;
url = 'jdbc:postgresql://127.0.0.1:5432/DBNAME';
connection = driver.connect(url, properties)
I get the following exception:
Error using org.postgresql.Driver/connect
Java exception occurred:
java.lang.NoClassDefFoundError: java/time/temporal/TemporalField
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:322)
at org.postgresql.Driver.makeConnection(Driver.java:404)
at org.postgresql.Driver.connect(Driver.java:272)
Caused by: java.lang.ClassNotFoundException: java.time.temporal.TemporalField
<SNIP>
I'm running Matlab R2012a on Debian. Everything was installed from the testing repository. Java is openjdk version "1.8.0_144" and PostgreSQL is 9.6.5-1.

It seems you don't use the jdk 1.8.
See same topic
Could you try to execute java -version to be sure?
[edit]
This error happens because Matlab 2012 does not use Java 8. To confirm, run this in the Matlab shell, not in your system terminal:
java -version
It is posible to make Matlab use a different JDK, but this can cause more problems than it solves. The better solution is to get the PostgreSQL JDBC 4.0, which is suitable for Java 6.
Direct link: https://jdbc.postgresql.org/download/postgresql-42.1.4.jre6.jar

Related

JDEV 12.2.1.4 Integrated Weblogic not running

We're using Jdev 12.2.1.4, while starting the integrated wls instance it's throwing below error-
Caused by: java.io.FileNotFoundException: Unable to locate file distributions\JDeveloper_Integrated_Server_Suite_12.2.1.4.0.xml under lookup locations.
JDK version- jdk 1.8.162
You should update your Oracle-Jdk.I dont think 12.2.1.4 version not supported by Jdk 1.6. Read this documentation:
https://www.oracle.com/application-development/technologies/jdeveloper/1212-cert.html
There was some JAVA_HOME related issues in .globalEnv.properties file. Additionally some permission issues were there in JDeveloper_Integrated_Server_Suite_12.2.1.4.0.xml file. Pointing to correct java_home and giving my permission to this xml file has resolved the issue for me.

How to solve the 'Unable to find Asm for stackmap generation' error on startup of STS?

I am trying to use the Spring Tool Suite 3.8.3 on Ubuntu 16.04. Upon startup I get this error:
An internal error occured during: "Initializing Java Tooling"
with the detailed message:
An internal error occurred during: "Initializing Java Tooling". Unable
to find Asm for stackmap generation (Looking for
'aj.org.objectweb.asm.ClassReader'). Stackmap generation for woven
code is required to avoid verify errors on a Java 1.7 or higher
runtime when weaving type org.eclipse.jdt.core.search.SearchPattern
when weaving classes when weaving
I have to admit that I have no idea what I should do here and I failed to find any pointers online. Any advice or hint is welcome.
It was for me due to the scala plug-in which I have installed a few days back. Uninstall the scala plugin and change to JDK 8 or JDK 11 it will work.
If anyone is still having a similar problem with Eclipse and needs to use Java 11 or higher (Eclipse nowadays seems to require Java 11) then have a look into this plugin as it seems to be required for the kotlin plugin.
https://marketplace.eclipse.org/content/aspectj-development-tools
I think you have installed Java 9 on your system. That's why you are facing compatibility issue and getting the stated errors. I therefore suggest you to degrade your java version to 8 for which it will work well and you wont be facing any error issue in that.
You can install java8 from this link!
I had to downgrade the JRE used to run Eclipse. Downgrading from Java 15 to Java 11 solved the problem.
Use the -vm option in eclipse.ini, eg.
-vm
c:\Dev\jdk-11\bin
My STS did not even start after installing scala plugin. I had to manually delete scala jars and folders from the STS /plugins. After that it started working.

Getting IncompatibleClassChangeError while running shark-0.9.0 with hadoop 2.2.0

I am getting the following error while running shark 0.9.0.
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class scala.collection.mutable.ArrayOps, but interface was expected
at shark.SharkCliDriver$.main(SharkCliDriver.scala:82)
at shark.SharkCliDriver.main(SharkCliDriver.scala)
Any solution regarding the problem is highly appreciable.
Its a backward compatibility issue.
This exception is raised when the version of scala-library.jar is different during compilation and execution. Make sure that you use the same library version during compiling and executing.
if you are using hadoop 2.x version, do the below steps
find path to shark installation folder -name hadoop-core-1.0.4.jar
remove all the hadoop-core-1.0.4.jar
check this
http://bigdataanalyze.blogspot.com/2014/03/issues-on-shark-with-cdh5-beta2-1.html

Apache Sling - OSGI framework exception when starting in Windows

I received the following error message when starting Sling on Windows with Java 1.7 (see below). I'm using Sling 6 (http://www.apache.org/dyn/closer.cgi/sling/org.apache.sling.launchpad-6-standalone.jar). Any idea what could be wrong?
Last time I tried using the same Sling version on Mac OSX and it worked perfectly.
Failed to Start OSGi framework
org.osgi.framework.BundleException: Uncaught Instantiation Issue:
java.lang.ArrayIndexOutOfBoundsException: -1
at
org.apache.sling.launchpad.base.impl.Sling.<init>(Sling.java:245)
at
org.apache.sling.launchpad.base.app.MainDelegate$1.<init>(MainDelegate.java:159)
at
org.apache.sling.launchpad.base.app.MainDelegate.start(MainDelegate.java:159)
at org.apache.sling.launchpad.app.Main.startSling(Main.java:244)
at org.apache.sling.launchpad.app.Main.<init>(Main.java:107)
at org.apache.sling.launchpad.app.Main.main(Main.java:56)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at
org.apache.felix.framework.BundleImpl.getCurrentModule(BundleImpl.java:1046)
at
org.apache.felix.framework.BundleImpl.getSymbolicName(BundleImpl.java:863)
at
org.apache.sling.launchpad.base.impl.SlingFelix.getSymbolicName(SlingFelix.java:32)
at org.apache.felix.framework.Felix.toString(Felix.java:1012)
at org.apache.felix.framework.Logger.doLog(Logger.java:128)
at org.apache.felix.framework.Logger._log(Logger.java:181)
at org.apache.felix.framework.Logger.log(Logger.java:114)
at
org.apache.felix.framework.ExtensionManager.<init>(ExtensionManager.java:201)
at org.apache.felix.framework.Felix.<init>(Felix.java:374)
at
org.apache.sling.launchpad.base.impl.SlingFelix.<init>(SlingFelix.java:39)
at
org.apache.sling.launchpad.base.impl.Sling.<init>(Sling.java:235)
I had exactly the same error when using java 1.7. After switching to 1.6 everything seems to be fine. You check your java version by typing java -version in the terminal.

Scala 2.8.0 problems on Windows 7

I installed scala 2.8.0 last night and I seem to be having some issues getting it running. If I type scala at the command prompt it comes up with the following:
> scala
Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.mutable.ListBuffer.toList()Lscala/collection/immutable/List;
at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:399)
at scala.collection.mutable.ArrayOps.toList(ArrayOps.scala:34)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:33)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Anyone have any ideas? I'm on Windows 7 professional, with Oracle JRE 1.6.0_21
Did you set the SCALA_HOME environment variable to point to the correct directory?
Did you have an older version installed? If that's still on your path then it may be causing problems...
EDIT
Can you paste the contents of your PATH and CLASSPATH environment variables? Perhaps using pastie or pastebin if they're on the large side.
You should also update to Java 1.6.0_22 if at all possible, due to this bug which was present in update 21: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6969236
Turns out this problem occurred because I put the sbt-launch.jar in the lib directory for my scala installation. Once I moved it into another directory scala worked fine.