agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] Hello World example failure
Date: Tue, 12 Sep 2006 10:14:49 -0600
Message-ID: <4506DCF9.3090504@softhome.net> (raw)
In-Reply-To: <4501F26B.9060308@tada.se>
References: <4501EEB4.7020203@softhome.net>
	<4501F26B.9060308@tada.se>

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=#




view thread (5+ messages)  latest in thread

Message-ID: <4506DCF9.3090504@softhome.net>
Permalink:  ../4506DCF9.3090504@softhome.net/
Also on:    postgresql.org/message-id/4506DCF9.3090504@softhome.net

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] Hello World example failure
  In-Reply-To: <4506DCF9.3090504@softhome.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox