From: mspan at di.uoa.gr (Manos Spanoudakis) Date: Wed, 13 Apr 2005 18:24:08 +0300 Subject: [Pljava-dev] Error message java.lang.ClassNotFoundException: 'pljavatriggers.TestTrigger1' In-Reply-To: <425D181F.8090007@mailblocks.com> Message-ID: <001301c5403c$d9417bd0$0301a8c0@manos> > -----Original Message----- > From: Thomas Hallgren [mailto:thhal at mailblocks.com] > Sent: Wednesday, April 13, 2005 4:01 PM > To: Manos Spanoudakis > Cc: pljava-dev at gborg.postgresql.org > Subject: Re: [Pljava-dev] Error message > java.lang.ClassNotFoundException: 'pljavatriggers.TestTrigger1' > > > Manos Spanoudakis wrote: > > >Dear *, > > > >I am trying to compose a Trigger using pljava and I am getting the > >error > >message: > >java.lang.ClassNotFoundException: 'pljavatriggers.TestTrigger1' > > > >Here are the steps I followed: > > > >1) I created the TestTrigger1.java (belongs to package > >pljavatriggers..) file and created testtrigger.jar in the directory > >d:\pljavatriggers. > >2) Then I created the trigger function with the following code > > > >CREATE OR REPLACE FUNCTION sqlj.testfunction() > > RETURNS "trigger" AS > >$BODY$ 'pljavatriggers.TestTrigger1.execCommandLine'$BODY$ > > LANGUAGE 'javau' VOLATILE; > >ALTER FUNCTION sqlj.testfunction() OWNER TO xristis; > >GRANT EXECUTE ON FUNCTION sqlj.testfunction() TO xristis; > GRANT EXECUTE > >ON FUNCTION sqlj.testfunction() TO public; > > > >3) The trigger was created > > > >CREATE TRIGGER test_trigger > > AFTER INSERT OR UPDATE > > ON sqlj."Doctor" > > FOR EACH STATEMENT > > EXECUTE PROCEDURE sqlj.testfunction(); > > > >4) The jar was installed and it was added to classpath... SELECT > >sqlj.install_jar('file:D:\\pljavatriggers\\testtrigger.jar',' > testtrigge > >r',tr > >ue); > >SELECT sqlj.set_classpath('sqlj','testtrigger'); > > > >With no error messages... > > > >When I try to execute an SQL Update query I get the error message > >java.lang.ClassNotFoundException: 'pljavatriggers.TestTrigger1' as > >mentioned before > > > >Can anyone tell me what I am missing ?? > > > > > You seem to do everything just right so I'll try a couple of > long-shots: > > 1. Older versions of PL/Java has a bug that will force you to finish > the installation session and start a new session before the > functions will > work properly. Are you using a version prior to 1.0.1? I am using version 1.1.0b on Windows > 2. If you list the testtrigger.jar file, is the > TestTrigger1.class file > listed there and is it qualified with the package directory > in the listing? Everything looks ok... HOSPITAL=# select oid,entryid,jarid,entryname from sqlj.jar_entry WHERE entryname LIKE '%Trigger1%'; oid | entryid | jarid | entryname -------+---------+-------+----------------------------------- 34620 | 2 | 75 | pljavatriggers/TestTrigger1.class (1 row) HOSPITAL=# select * from sqlj.jar_repository; jarid | jarname | jarorigin | jarowner | deploymentdesc -------+-------------+------------------------------------------------------ -----------------+----------+---------------- 75 | testtrigger | file:D:\pljavatriggers\testtrigger.jar | 1 | 77 | examples | file:d:\java\pljava\examples.jar | 1 | 21 (2 rows) >3. When you executed the above, did you by > any chance execute the actual > update from another session then the one used for the install, and if > so, did you commit the installation? How do I commit the installation? > Regards, > Thomas Hallgren Thanks for your answer, Manos