PL/Java - user function execution error - postgresql

I installed pl/java on Ubuntu with:
sudo apt-get install postgresql-9.1-pljava-gcj
but have hit a snag which I think is a gcj/jdk 1.7 incompatibility between the jar and pl/java. These are the steps used with guidance from http://www.javacodegeeks.com/2012/10/introduction-to-postgresql-pljava.html:
select sqlj.install_jar('file:///home/me/temp/testJar.jar', 'sandbox', true);
select sqlj.set_classpath('public', 'sandbox');
CREATE FUNCTION public.hello(varchar) RETURNS varchar
AS 'sandbox.PLJava.hello'
LANGUAGE java;
We're happy until execution:
SELECT hello('world');
Which generates this error:
ERROR: java.lang.ClassFormatError: sandbox.PLJava (unrecognized class file version)
SQL state: XX000
The jar was made with a standard eclipse/export to jar (jdk 1.7.0).
Anyone travel this road before? Thanks in advance.

This problem would be caused by, as you say, an incompatibility between the JVM that you are running via pl/java and your java code. This is hence a packaging issue if you are running everything from repos and you can follow up with your distro or compile from source.
If you can compile from source, that may be the best option at present.

Related

Failed to execute goal org.apache.rat:apache-rat-plugin:0.8:check (default) on project giraph-gora: Too many unapproved licenses: 56

I am new to Giraph and hadoop.I am trying to compile giraph using maven i tried using command mvn -Phadoop_2 -fae -DskipTests clean install on command prompt but i am getting error.Image i attached is from eclipse(i am geting similar error in cmd as well.
GIRAPH version- 1.2.0 RC1
HADOOP version- 2.2.0
MAVEN version- 3.5.3
JAVA version 1.8.0_121
Any help in solving this problem will help me a lot. THANK YOU
I found a workaround for this as I was facing a similar problem.
mvn clean install -PallModules -Drat.numUnapprovedLicenses=200 -DskipTests
-Drat.numUnapprovedLicenses=200 This helps to suppress the error.
Thanks #leftjoin for the comment.
There must be a file created by Apache Rat in the path giraph-gora/target/rat.txt (as this is the failed project). This file will contain details on the files in your projects that do not have a proper licence (as well as the ones that do but these are not of any interest to you).
Most likely, the case is that the files produced by eclipse (.classpath, .project, org.eclipse.core.resources.prefs, org.eclipse.m2e.core.prefs,org.eclipse.jdt.core.prefs) are creating the problem. If you remove them you will be able to compile giraph properly.

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.

static linking of postgresql plugin in Qt 5.5

when trying to link my linux (CentOS 7) application against static qt 5 libraries I get the following error:
debug/app_debug_plugin_import.o: In function `StaticQPSQLDriverPluginPluginInstance::StaticQPSQLDriverPluginPluginInstance()':
<src>/app_debug_plugin_import.cpp:24: undefined reference to `qt_static_plugin_QPSQLDriverPlugin
linking to the mysql plugin works.
I followed the tutorial here:
http://doc.qt.io/qt-5/sql-driver.html#qpsql
And I have both plugins (libqsqlpsql.a and libqsqlmysql.a)
But the mysql plugin defines the function:
qt_static_plugin_QMYSQLDriverPlugin()
While the psql plugin has no equivalend function.
What am I missing.
Thanks in advance
It seems that is was caused by remaining compiled object files that were compiled with an old qmake (from Qt 4.7)
After cleaning them up, it compiled correctly.

play -help gives Error: Could not retrieve sbt 0.13.0: missing sbt.xMain

I created a new app using command play new hello and cd'ed into the directory. When I type play in the directory, I receive the following error:
akshay#Akshay:~/play/testn$ play -help
Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Getting org.scala-sbt sbt 0.13.0 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
0 artifacts copied, 43 already retrieved (0kB/45ms)
Error: Could not retrieve sbt 0.13.0: missing sbt.xMain
Play was working fine in my old Ubuntu box. Today only I got a fresh copy of Ubuntu 12.04 32 bit. I know it is error due to change in version, but certainly, I am not able to solve this. Please help me on this.
In checked .sbt/boot/update.log and I can see this :
trying http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
tried http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
HTTP response status: 404 url=http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
CLIENT ERROR: Not Found url=http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
typesafe-ivy-releases: resource not reachable for org.sonatype.oss#oss-parent;7: res=http://repo.typesafe.com/typesafe/ivy-releases/org.$
trying http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/
Though error was coming from a fresh ubuntu installation with oracle jdk 8, I tried completely removing jdk and then installing jdk 7, but still no solution. Since it was a fresh installation, I reinstalled ubuntu and installed jdk 7 and problem is solved. Not sure why is it contradictory to Play's recomendation of using Jdk 6 or above. Notifying Play Google Groups about this.
I was getting the same error while trying to build using sbt-launcher.jar which was invoked through jenkins. In my case there were two Scala versions within ~/.sbt/boot/ and removing the older version solved the issue.
I was trying to setup my development environment for one of our projects when I hit this issue. The problem was the sbt.version parameter in the build.properties file of our project which specifically mentioned the version of sbt as 0.13.8 and I had sbt 0.13.11.
After removing sbt 0.13.11 and installing 0.13.8, the issue got resolved. Or if it is possible for you to change the sbt version in your build.properties file, you can do that as well.

Overlapping instances error for Yesod and EclipseFP application

I created an application with EclipseFP, the yesod application. With the out of the box settings, I get an error when I try to run a 'main.hs' file. It looks like it compiles but when I try to run I get the error. I attempted to run by 'right clicking' and then 'run'. The console opens:
What might be the issue?
Here is the error:
<command line>:
Could not find module `OverlappingInstances':
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
Prelude> main
Version: Indigo Service Release 2
Eclipse FP Haskell Plugin - 2.2.4
GHC version 7.0.3
Possible solutions:
I tried to add '{-# LANGUAGE OverlappingInstances #-}' at the top of all of the haskell files
This is a bug, I've fixed it in the github version of EclipseFP/BuildWrapper. Will be part of the 2.3.0 release of EclipseFP. We're getting the wrong options from the cabal file and pass OverlappingInstances to GHCi without the -X. Sorry!