agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feed[Pljava-dev] Subject: Re: Loading of native libraries in PLJAVA
3+ messages / 0 participants
[nested] [flat]
* [Pljava-dev] Subject: Re: Loading of native libraries in PLJAVA
@ 2005-03-11 10:27
0 siblings, 1 reply; 3+ messages in thread
From: @ 2005-03-11 10:27 UTC (permalink / raw)
Hi,
Once again posting in developer forum.Help appreciated.Below running mail
posted in other forum.
thx
Rao
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)( one of
members reply)
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.(one of members reply)
(Nageshwar) 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).(one of members reply)
(Nageshwar) 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20050311/efa14a8b/attachment.html;
^ permalink raw reply [nested|flat] 3+ messages in thread
* [Pljava-dev] Re: Subject: Re: Loading of native libraries in PLJAVA
@ 2005-03-11 10:49
parent:
0 siblings, 0 replies; 3+ messages in thread
From: @ 2005-03-11 10:49 UTC (permalink / raw)
Nageshwar Rao wrote:
> 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.
I could, but I don't see any JNI interface in libping. Do you have your
own C library for that? If so, I'll need that too. If not, where do I
find the JNI?
- thomas
^ permalink raw reply [nested|flat] 3+ messages in thread
* [Pljava-dev] Re: Subject: Re: Loading of native libraries in PLJAVA
@ 2005-03-11 12:38
0 siblings, 0 replies; 3+ messages in thread
From: @ 2005-03-11 12:38 UTC (permalink / raw)
Nageshwar Rao wrote:
>Hi,
>You can find JNI interface in
>http://www.teamlinux.org.uk/saxm/projects/icmp/, there is PingClient java
>file, which calls a JNI ping utility.
>
>Steps to replicate the error:-
>
> Basically we need to create a jar file of PingUtility and install
>the jar file in PLJava and set the classpath then insert record in the
>referenced table to invoke the trigger and the trigger should call the ping
>utility via JNI.
>
>
I have no linker problems loading and running libping from within
PL/Java so there must be an error in your setup. I run into another
perhaps bigger problem though. ping.c creates a RAW socket. Only root is
allowed to do that. PostgreSQL refuses to run as root (rightly so, that
would be a major security hole).
Here's a quote from the teamlinux page: "Unfortunately, it requires root
(at least, on a Linux box) - as ping.c creates a raw packet, which can
only be done by the super-user."
Perhaps you should consider skip using libping altogether and go for
J2SE 5.0 instead and then use java.net.InetAddress.isReachable()?
Regards,
Thomas Hallgren
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-03-11 12:38 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-11 10:27 [Pljava-dev] Subject: Re: Loading of native libraries in PLJAVA
2005-03-11 10:49 `
2005-03-11 12:38 [Pljava-dev] Re: Subject: Re: Loading of native libraries in PLJAVA
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox