From: | scottpetersen at softhome(dot)net (Scott Petersen) |
---|---|
To: | |
Subject: | [Pljava-dev] Hello World example failure |
Date: | 2006-09-08 22:29:08 |
Message-ID: | 4501EEB4.7020203@softhome.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
Dear kind users,
I have installed PLJava and from all indications it appears to have been
successful. But I am NOT able to get the HELLO WORLD example to
execute. The following information is included in hopes that you can see
the problem and tell me what to change or what to correct to resolve the
error: java.lang.ClassNotFoundException:
com.mycompany.helloworld.HelloWorld that I am receiving from PSQL.
postgresql.conf contains:
dynamic_library_path = '$libdir;c:\\pljava;c:\\JavaJars'
custom_variable_classes = 'pljava' # list of custom variable
class names
pljava.classpath = 'C:\\pljava\\pljava.jar'
I create my class file as per the user guide (Hello World example):
C:\Java source>dir
Volume in drive C has no label.
Volume Serial Number is C815-11A0
Directory of C:\Java source
09/08/2006 04:00 PM <DIR> .
09/08/2006 04:00 PM <DIR> ..
09/08/2006 03:59 PM 123 helloWorld.class
2 File(s) 682 bytes
2 Dir(s) 73,859,919,872 bytes free
C:\Java source>more helloworld.class
package com.mycompany.helloworld;
public HelloWorld { public String helloWorld() { return "Hello
World"; }
}
C:\Java source>jar -cf helloworld.jar *.class
C:\Java source>
I next stop Postgresql on my Windows machine and restarted it. This
appears to work fine.
I next moved my JAR file into the directory 'c:\JavaJars'.
Next I execute psql to execute the "Hello World" example.
C:\JavaJars>dir
Volume in drive C has no label.
Volume Serial Number is C815-11A0
Directory of C:\JavaJars
09/08/2006 04:11 PM <DIR> .
09/08/2006 04:11 PM <DIR> ..
09/08/2006 04:05 PM 559 helloworld.jar
1 File(s) 559 bytes
2 Dir(s) 73,859,821,568 bytes free
C:\JavaJars>psql -U mfgadmin mlp204
Password for user mfgadmin:
Welcome to psql 8.1.3, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
Warning: Console code page (437) differs from Windows code page (1252)
8-bit characters may not work correctly. See psql reference
page "Notes for Windows users" for details.
mlp204=# select sqlj.install_jar('file:///JavaJars/helloworld.jar',
'helloworld_jar', false);
install_jar
-------------
(1 row)
mlp204=# select sqlj.set_classpath('public', 'helloworld_jar');
set_classpath
---------------
(1 row)
mlp204=# create or replace function helloworld()
mlp204-# returns "varchar" as
mlp204-# 'com.mycompany.helloworld.HelloWorld.helloWorld'
mlp204-# Language 'java' volatile;
CREATE FUNCTION
mlp204=# select * from helloworld();
ERROR: java.lang.ClassNotFoundException:
com.mycompany.helloworld.HelloWorld
mlp204=#
The following environment variables are set:
Path=C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\Wbem;C:\Program
Files\postgresql\8.1\bin;C:\Qt\3.3.6\bin;C:\Program
Files\Java\jre1.5.0_08\bin;C:\Program
Files\Java\jre1.5.0_08\bin\client;C:\Program Files\Java\jdk1.5.0_08\bin;
JAVA_HOME=C:\Program Files\Java\jre1.5.0_08
classpath=c:\JavaJars
At the present time I am at a loss as to why I am receiving the error
from psql: java.lang.ClassNotFoundException:
com.mycompany.helloworld.HelloWorld
Any enlightenment would be appreciated.
thanks Scott.
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Hallgren | 2006-09-08 22:44:59 | [Pljava-dev] Hello World example failure |
Previous Message | Peter Henderson | 2006-09-08 12:41:32 | [Pljava-dev] LD_LIBRARY_PATH on Ubuntu |