[Pljava-dev] RE: Loading of native libraries in PLJAVA

From: MudassirM at PLANETASIA(dot)COM (Mohammed Mudassir)
To:
Subject: [Pljava-dev] RE: Loading of native libraries in PLJAVA
Date: 2005-03-11 07:37:57
Message-ID: 3214799999CED64882731155DB0AAD92C4797D@MLSW00103
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Please see the comments below .

Waiting for ur reply.

Thanx in advance
Mohammed

-----Original Message-----
From: Thomas Hallgren [mailto:thhal at mailblocks.com]
Sent: Thursday, March 10, 2005 10:00 PM
To: Nageshwar Rao
Cc: Mohammed Mudassir; pgsql-general at postgresql.org
Subject: Re: Loading of native libraries in PLJAVA

Nageshwar,
This is not the right forum for PL/Java issues. You should use mailing
list at pljava-dev at gborg.postgresql.org.
> We are facing 2 problems in loading files from Pljava.
>
> 1. Loading Native C library from Pljava trigger.
>
> From Pljava trigger, we were trying to load native
> library, Using System.loadLibrary("<library_name>"), which is
>
> specified in the LD_LIBRARY_PATH.
>
The likely cause of this is that this library in turn have dependencies
to something not specified in the LD_LIBRARY_PATH or that you have some
mismatch in function naming. That in turn should be apparent from the
exception message (can't tell since you didn't convey it here).

>
> Also specified the library file under /var/lib/pljava
> where all the pljava specifc "*.so" files are located, which has an
> entry in the postgresql.conf -
> dynamic_library_path for "/var/lib/pljava",
>
>
> Both theses cases failed to load native library.
>
> we are getting this error in both cases-
> UnSatisfiedLinkedError
>
The dynamic_library_path is only used by the PostgreSQL backend when it
loads a module. It has no effect whatsoever on the System.loadLibrary
method.
(Mohammed) We are using a ping utility (libping.so - freeware) to ping
network devices.
We have written a insert trigger on network table, when there is any
insertion in the table , ipaddress will be
fetched from the triggereddata and we call a C library via JNI to ping the
device. The error still remains the same.
can you replicate the same error at your end and help us in fixing the
error.
>
> 2. Loading Properties file from trigger. (using
> Properties.load(<properties_name.properties>))
> We are unable to load properties file from
> Properties.load("<properties_name.properties>").
> we have included properties file in jar file and
> installed the jar and set the jar file in the classpath using
> "sqlj.set_classpath".
>
To my knowledge there's Properties.load method that takes a String argument.
You have to use the Class.getResourceAsString() in order to obtain an
InputStream for a resource stored in a jar file. The class in question
should be in the same package as the resource (i.e. your properties file).
(Mohammed) We have written a insert trigger on network table, when ever
there is insertion in the table, we are reading a property file and modify
the values with the inserted data and insert the modified values in another
table.
We are unable to read the properties file (which is present in the installed
jar file at the root as well as at the class file level)

Here is the hierarchy structure, where i have placed properties files
gis.jar
gis.properties
com
me
mis
pgtrigger

PropertiesTrigger

gis.properties

.

Here is the code to access gis.properties file

PropertiesTrigger.java

Properties properties = new Properties
InputStream is =
this.getClass().getResourceAsStream("gis.properties");
SOP ("INPUTSTREAM "+is);
properties.load(is);
is.close();

null at SOP for the inputstream.

Regards,
Thomas Hallgren

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Thomas Hallgren 2005-03-11 10:14:04 [Pljava-dev] RE: Loading of native libraries in PLJAVA
Previous Message Stephen Crowley 2005-03-11 00:54:35 [Pljava-dev] JVM crash in latest cvs on 7.4.7 implementating ResultSetProvider