View Single Post

   
  #1 (permalink)  
Old 04-16-2008, 12:16 AM
Scott Petersen
 
Posts: n/a
Default PL/Java problem.

Greetings,

Before I start I must admit that I am a newbie to Java. This means that
this might actually be my problem and NOT a software issue, but I need help.

I am attempting to execute the "Hello World" demo from
http://wiki.tada.se/wiki/display/pljava/User+Guide which is part of the
user guide for the software. In the process I created the following
class, and compiled (JAR) with NO errors:

package com.mycompany.helloworld;
public HelloWorld { public String helloWorld() { return
"Hello World"; }
}

Next I ran psql with the following result:

#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:///Java source/helloworld.jar',
'hellowor
ld_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=#

Everything seems to be working fine except I receive a
"ClassNotFoundException". Any help in understanding what I did wrong
would be appreciated.

Thanks Scott.




---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Reply With Quote