From: thhal at mailblocks.com (Thomas Hallgren) Date: Fri, 11 Mar 2005 11:14:04 +0100 Subject: [Pljava-dev] RE: Loading of native libraries in PLJAVA In-Reply-To: <3214799999CED64882731155DB0AAD92C4797D@MLSW00103> References: <3214799999CED64882731155DB0AAD92C4797D@MLSW00103> Message-ID: <42316F6C.9040609@mailblocks.com> 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. > > Your code looks correct aside from some missing parenthesis :-). Just to rule out a couple of possibilities, can you load the "examples.jar" that is bundled with the PL/Java using sqlj.install_jar and set the classpath for schema 'javatest' to 'samples' and then run: SELECT * FROM javatest.propertyExample(); You should get 3 rows. If that works then properties and resources work OK (it does on my installations). If it doesn't, then something is majorly wrong. Is it possible that you have an external CLASSPATH setting that in fact results in another jar then the one being loaded is used? The external classpath should _only_ appoint pljava.jar. What versions of PostgreSQL, PL/Java, and JRE are you using? Regards, Thomas Hallgren