Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / May 2004

Tip: Looking for answers? Try searching our database.

[Oracle, java function] Problem with java function that uses 3rd party GPL library

Thread view: 
Daniel Janczak - 21 May 2004 15:28 GMT
Hi

I need to create a function in java, that will run in oracle database
as database function. So I've downloaded barbecue - GPL java library
that allow me to create barcodes. I'm new at java so maybe my error is
trivial, maybe not - I can't find it neither in oracle docs nor in
java ones...

Now that's the problem:

I've loaded barbecue.jar to database using "loadjava" utility.
Creation of java function went well:

create or replace and compile java source named
hsljavabarcodegenerator as
import javax.swing.*;
import net.sourceforge.barbecue.BarcodeFactory;
import net.sourceforge.barbecue.Barcode;
import net.sourceforge.barbecue.BarcodeException;
import net.sourceforge.barbecue.BarcodeImageHandler;

import java.awt.image.BufferedImage;
import java.awt.*;
import java.io.FileOutputStream;
import java.io.IOException;

import oracle.sql.*;

public class HSLJavaBarcodeGenerator
{
 public static oracle.sql.BLOB CreateBarcode(String barText, int
barWidth, int barHeight) throws java.sql.SQLException,
java.io.IOException, java.lang.NullPointerException,
net.sourceforge.barbecue.BarcodeException
...
barcode = BarcodeFactory.createCode128B(barText);
...
return result;
}}

And it compiles well, no errors, no warnings. Next I have created
PL/SQL definition:

create or replace function CreateBarcode(barcode in varchar2, width in
number, height in number) return blob
as language java name
'HSLJavaBarcodeGenerator.CreateBarcode(java.lang.String, int, int)
return oracle.sql.BLOB';

And it also works well. No errors, no warnings.

Now when I try to use it, I've got error:

select createbarcode('aaa',1,1) from dual
                                    *
BŁĄD w linii 1:
ORA-29532: wywołanie Javy zatrzymane przez nieprzechwycony
wyjątek Javy:
java.lang.NoClassDefFoundError
(it means that execution of java is stopped by unhandled java
exception).

Help... if anyone knows what to do. Some user rights? Paths? Anything?
There are no warnings or errors during compilation, so why there's an
"NoClassDefFoundError" error during execution?

Thanks in advance,
Daniel Janczak
nospam.daniel.janczak@wp.pl
Sparky - 21 May 2004 20:47 GMT
I'm guessing here, but shouldn't you try qualifying the function name?  It's
within a class so maybe

select HSLJavaBarcodeGenerator.createbarcode('aaa',1,1) from dual

would work?

<Barney />

> Hi
>
[quoted text clipped - 65 lines]
> Daniel Janczak
> nospam.daniel.janczak@wp.pl
Olaf Heimburger - 23 May 2004 18:43 GMT
Daniel,

you're using java.awt. based code. This would not work in the Oracle
database, because the creation of Images and Windows in a headless
environment like a database doesn't make sense and isn't implemented.
Don't expect anything working which uses graphics.

--olaf

> Hi
>
[quoted text clipped - 65 lines]
> Daniel Janczak
> nospam.daniel.janczak@wp.pl
Daniel Janczak - 24 May 2004 15:25 GMT
> Daniel,
>
[quoted text clipped - 4 lines]
>
> --olaf

Hi,

Thank you all for answers... I've just hoped that java.awt will work,
if I don't really display anything. Once I did something similar in
DLL (I used forms on the server side, just without displaying them). I
hoped that in Java it's possible to do something similar...

Thanks again! I'll let you know if I find any solution.

Best regards,
Daniel


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.