Git Product home page Git Product logo

Comments (6)

jcflack avatar jcflack commented on July 19, 2024

Hi,

I think you may need to install a Centos package that provides the g++ linker. That exception comes from the nar-maven-plugin and there is a known bug report about it (which also seems to name the needed Centos package: gcc-c++).

As we have a large time zone difference, I guess you would like to know how I arrived at that information. :) I began by reading down the chain of Caused by: exceptions in your stack trace to find the original one:

Caused by: java.lang.NullPointerException
    at com.github.maven_nar.cpptasks.gcc.GppLinker.isClang(GppLinker.java:317)

But line 317 could be different in another version of nar-maven-plugin, so the exact plugin version is important, from the first line of the message:

[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.1.0:nar-compile (default-nar-compile) on project pljava-so: Execution default-nar-compile of goal com.github.maven-nar:nar-maven-plugin:3.1.0:nar-compile failed. NullPointerException -> [Help 1]

So it's version 3.1.0. That's enough information to go to the nar-maven-plugin homepage and use its "Project Information" link to find its source repository, which is conveniently on GitHub, and then go to the releases tab.

Choosing the commit id (2124f0e) for release 3.1.0, then "browse files", then finding the class com.github.maven_nar.cpptasks.gcc.GppLinker leads straight to the offending line 317. Sure enough, it looks like cmdout might be null in some case if the linker cmd failed (for example, if it is not installed).

Then I looked for the same line in the HEAD version. Aha! Someone has added a null check. :) Click Blame and it shows when that line was changed. And the message in that commit identifies the bug report (fixes 147), so there's the explanation.

It would also be nice to know which version of nar-maven-plugin has that fixed, so PL/Java's build can be updated to use that version. In the same commit where that change was made, the pom.xml file says <version>3.2.4-SNAPSHOT</version>, so the problem should be fixed in that plugin starting with release 3.2.4. Sadly, as the releases page showed, there hasn't been a release 3.2.4 yet, so I will have to wait before updating PL/Java to use it.

But meanwhile, if you install g++, you should stop having that problem. :)

-Chap

from pljava.

jcflack avatar jcflack commented on July 19, 2024

Hi,

Did that help? Any progress?

-Chap

from pljava.

dblanch-at-hoplasoftware avatar dblanch-at-hoplasoftware commented on July 19, 2024

Yep! it compiles! now I’m about to configure postgres with pl/java.

I’m documenting all the steps I needed to take to make it work. i’ll write them when i finish with success.

Thanks.

El 12 nov 2015, a las 19:35, Chapman Flack [email protected] escribió:

Hi,

Did that help? Any progress?

-Chap


Reply to this email directly or view it on GitHub #64 (comment).

from pljava.

dblanch-at-hoplasoftware avatar dblanch-at-hoplasoftware commented on July 19, 2024

It seems it's working ... not without a rough fight with pljava.so and LD_LIBRARY_PATH, but at the end it works. :)

I'll try to document all and write it down so others can benefit of my work.

test=# \i /vagrant/pljava/src/sql/install.sql 
CREATE SCHEMA
GRANT
CREATE FUNCTION
CREATE LANGUAGE
CREATE FUNCTION
CREATE LANGUAGE
CREATE TABLE
GRANT
CREATE TABLE
GRANT
CREATE TABLE
GRANT
CREATE TABLE
GRANT
CREATE TABLE
GRANT
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION

test=# CREATE OR REPLACE FUNCTION getsysprop(VARCHAR)
  RETURNS VARCHAR
  AS 'java.lang.System.getProperty'
  LANGUAGE java;
CREATE FUNCTION
test=# SELECT getsysprop('user.home');
   getsysprop   
----------------
 /var/lib/pgsql
(1 row)

from pljava.

jcflack avatar jcflack commented on July 19, 2024

Great! Did you receive the e-mail I tried to send you at Hopla? (I used the web contact form, maybe it didn't go anywhere.) It would be great if you could try the branch I mentioned there, and compare that setup experience to what you just had with this ... but we could do that on e-mail instead of this ticket.

from pljava.

dblanch-at-hoplasoftware avatar dblanch-at-hoplasoftware commented on July 19, 2024

To make it work you have to install these things:

    # install postgres 9.4 + devel packages devel

    # install java 1.7 from Oracle, I wasn't able to make it work with any other java :(
    # file jdk-7u79-linux-x64.rpm must be downloaded first
    sudo yum install /vagrant/jdk-7u79-linux-x64.rpm -y

    # install maven from latest release available 
    # install git

    # install Development Tools
    sudo yum groupinstall 'Development Tools' -y

    # download and compile pl/javat
    git clone https://github.com/tada/pljava.git
    # compile pl/java
    export PATH=/usr/pgsql-9.4/bin/:$PATH
    cd pljava
    /usr/local/maven/bin/mvn clean install

    # install pl/java in postgres
    # copy library to postgres lib directory
    sudo cp pljava/pljava-so/target/nar/pljava-so-0.0.2-SNAPSHOT-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared/libpljava-so-0.0.2-SNAPSHOT.so /usr/pgsql-9.4/lib/
    # create pljava.so and link to library
    sudo ln -s /usr/pgsql-9.4/lib/libpljava-so-0.0.2-SNAPSHOT.so /usr/pgsql-9.4/lib/pljava.so
    # copy jar in postgres lib directory (may be this need a revision)
    sudo cp pljava/pljava/target/pljava-0.0.2-SNAPSHOT.jar /usr/pgsql-9.4/lib/
    # configure posgres.conf
    sudo echo "pljava.classpath='/usr/pgsql-9.4/lib/pljava-0.0.2-SNAPSHOT.jar'" >> /var/lib/pgsql/9.4/data/postgresql.conf
    # configure LD_LIBRARY_PATH to use java
    sudo echo 'LD_LIBRARY_PATH=/usr/java/jdk1.7.0_79/jre/lib/amd64/server' >> /var/lib/pgsql/.bash_profile 
    sudo echo 'export LD_LIBRARY_PATH' >> /var/lib/pgsql/.bash_profile
    # finally restart server to get enviroment variables and new configuration

    # After this you can log as postgres, create a database 'test', connect to that database and execute the script
    # pljava/src/sql/install.sql

I hope it helps.

from pljava.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.