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