[Pljava-dev] Hello World example failure

From: scottpetersen at softhome(dot)net (Scott Petersen)
To:
Subject: [Pljava-dev] Hello World example failure
Date: 2006-09-12 16:14:49
Message-ID: 4506DCF9.3090504@softhome.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

I have now corrected all of the installation issues and appreciate the
help. BUT, I am still receiving the error. The error is: *ERROR:
java.lang.ClassNotFoundException: com.mycompany.helloworld.HelloWorld
*
At a different point in the documentation for PLJava there is an example
function "getsysprop". I have been able to get that function to execute
with no problem. I believe that validates the installation.

For completeness I have included the source that I used for helloworld,
the creation of the JAR file, a dump of the jar_entry, jar_repository,
classpath_entry, and typemap_entry before and after pictures. After
creating the "JAR" file I moved the JAR from
/com/mycompany/helloworld/helloworld.jar to /JavaJars/helloworld.jar .

I am not trying to be difficult, but I am LOST and do not know how to
move forward with this simple test.

*C:\com\mycompany\helloworld>*type HelloWorld.class
package com.mycompany.helloworld;
public HelloWorld { public String helloWorld() { return "Hello World"; }
}
*C:\com\mycompany\helloworld>*dir
Volume in drive C has no label.
Volume Serial Number is C815-11A0

Directory of C:\com\mycompany\helloworld

09/12/2006 09:50 AM <DIR> .
09/12/2006 09:50 AM <DIR> ..
09/12/2006 09:20 AM 110 HelloWorld.class
1 File(s) 110 bytes
2 Dir(s) 74,092,773,376 bytes free

*C:\com\mycompany\helloworld>*jar -cf helloworld.jar *.class

*C:\com\mycompany\helloworld>*dir
Volume in drive C has no label.
Volume Serial Number is C815-11A0

Directory of C:\com\mycompany\helloworld

09/12/2006 09:50 AM <DIR> .
09/12/2006 09:50 AM <DIR> ..
09/12/2006 09:20 AM 110 HelloWorld.class
09/12/2006 09:50 AM 556 helloworld.jar
2 File(s) 666 bytes
2 Dir(s) 74,092,773,376 bytes free

*C:\com\mycompany\helloworld>*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 * from sqlj.jar_entry;
entryid | entryname | jarid | entryimage
---------+-----------+-------+------------
(0 rows)

*mlp204=# *select * from sqlj.jar_repository;
jarid | jarname | jarorigin | jarowner | jarmanifest | deploymentdesc
-------+---------+-----------+----------+-------------+----------------
(0 rows)

*mlp204=# *select * from sqlj.classpath_entry;
schemaname | ordinal | jarid
------------+---------+-------
(0 rows)

*mlp204=# *select * from
sqlj.install_jar('file:///javajars/helloworld.jar', 'helloworld_jar',
false);
install_jar
-------------

(1 row)

*mlp204=# *select * from 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=# *select * from sqlj.jar_entry;
entryid | entryname | jarid |
entryimage

---------+------------------+-------+-------------------------------------------
--------------------------------------------------------------------------------
-
71 | HelloWorld.class | 15 | package
com.mycompany.helloworld;\015\012p
ublic HelloWorld { public String helloWorld() { return "Hello World";
}\015\012}
(1 row)

*mlp204=# *select * from sqlj.jar_repository;
jarid | jarname | jarorigin | jarowner |
jarmanifest |
deploymentdesc
-------+----------------+---------------------------------+----------+----------
---------------------------------------------------------------+----------------
15 | helloworld_jar | file:///javajars/helloworld.jar | mfgadmin |
Manifest-
Version: 1.0
Created-By: 1.5.0_08 (Sun Microsystems Inc.)

|
(1 row)

*mlp204=# *select * from sqlj.classpath_entry;
schemaname | ordinal | jarid
------------+---------+-------
public | 1 | 15
(1 row)

*mlp204=#* select * from sqlj.typemap_entry;
mapid | javaname | sqlname
-------+--------------------------------------------+-----------------------
2 | org.postgresql.pljava.example.ComplexTuple | javatest.complextuple
(1 row)

mlp204=#

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Guy Rouillier 2006-09-12 20:40:46 [Pljava-dev] Hello World example failure
Previous Message Filip Hrbek 2006-09-11 07:25:37 [Pljava-dev] Hello World example failure