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 / April 2006

Tip: Looking for answers? Try searching our database.

UnsatisfiedLinkError

Thread view: 
Rhino - 26 Apr 2006 22:08 GMT
I'm trying to debug a simple Java UDF (User Defined Function) written in the
DB2General style within
Eclipse.

I'm getting a java.lang.UnsatisfiedLinkError when I execute the set() method
in the UDF. I know that the UnsatisfiedLinkError has something to do with a
DLL that is not visible but I'm not sure why I'm having the problem given
that both db2java.zip and db2jcc.jar are visible on my classpath and each of
them contain the COM.ibm.db2.app.UDF class with a variety of set() methods,
including the one that I am trying to execute. I've also tried removing
db2java.zip from the classpath to see if that would help prevent the error
but it didn't.

Does anyone have any idea how I can solve this problem?

This is the UDF. By the way, I'm pretty sure there are no errors in it and I
know the code is trivial; I'm just trying to debug it with Eclipse to prove
that I can. Another UDF I wrote that also grabs the leftmost characters of
a String works fine but it is written in style "Java" and is therefore
missing the set() method.

---------------------------------------------------------------------------------------------------------------------
   public void leftmost(String input, int size, String output) throws
Exception {

       String trimmedInput = input.trim();
       if (trimmedInput.length() < size) size = trimmedInput.length();
       String leftmost = trimmedInput.substring(0, size);

       set(3, leftmost);
   }
---------------------------------------------------------------------------------------------------------------------

I'm using Eclipse 3.1.1 and DB2 V8.1.8.762 on Windows XP (SP2).

Signature

Rhino

Roedy Green - 27 Apr 2006 01:54 GMT
On Wed, 26 Apr 2006 17:08:34 -0400, "Rhino"
<no.offline.contact.please@nospam.com> wrote, quoted or indirectly
quoted someone who said :

>UnsatisfiedLinkError

without a stack trace all we can do is point you to generic advice.

See http://mindprod.com/jgloss/caq.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Rhino - 27 Apr 2006 05:01 GMT
> On Wed, 26 Apr 2006 17:08:34 -0400, "Rhino"
> <no.offline.contact.please@nospam.com> wrote, quoted or indirectly
[quoted text clipped - 5 lines]
>
> See http://mindprod.com/jgloss/caq.html

It's interesting that you post this link because I found it before I posted.
The first thing it tells you to do for UnsatisfiedLinkError is to use
Wassup to determine the java.library.path. I did exactly that and Wassup ran
fine - but it did NOT tell me a value for java.library.path. So, to use the
vernacular, "wassup with that?".

And here's that stacktrace:

Exception in thread "main" java.lang.UnsatisfiedLinkError: set

at COM.ibm.db2.app.UDF.set(Native Method)

at com.xyz.db2v8.udf.db2general.TextUDFs.reverse(TextUDFs.java:90)

at UdfDriverV8.testReverse_DB2General(UdfDriverV8.java:102)

at UdfDriverV8.<init>(UdfDriverV8.java:26)

at UdfDriverV8.main(UdfDriverV8.java:12)

--

Rhino
Roedy Green - 27 Apr 2006 08:12 GMT
On Thu, 27 Apr 2006 00:01:55 -0400, "Rhino"
<no.offline.contact.please@nospam.com> wrote, quoted or indirectly
quoted someone who said :

>I did exactly that and Wassup ran
>fine - but it did NOT tell me a value for java.library.path. So, to use the
>vernacular, "wassup with that?".

The advice reads
"Use Wassup to determine the java.library.path system property. It is
restricted, so make sure you flip the Wassup display from safe to
restricted. Your DLL must live either on that path, or in your jar
without any package name."

Did you follow the instructions in the second sentence?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Rhino - 27 Apr 2006 13:35 GMT
> On Thu, 27 Apr 2006 00:01:55 -0400, "Rhino"
> <no.offline.contact.please@nospam.com> wrote, quoted or indirectly
[quoted text clipped - 12 lines]
>
> Did you follow the instructions in the second sentence?

Yes, I ran it in both 'safe' and 'restricted' modes and neither showed me
any property called java.library.path. The same thing happened just now when
I tried it again. Lots of properties got displayed in each case, just
nothing called java.library.path. It correctly reported my Java version,
1.5.0_06 and my user name so the applet itself seems to be working fine.

--
Rhino
Roedy Green - 27 Apr 2006 08:14 GMT
On Thu, 27 Apr 2006 00:01:55 -0400, "Rhino"
<no.offline.contact.please@nospam.com> wrote, quoted or indirectly
quoted someone who said :

>COM.ibm.db2.app.UDF.set(Native Method)

that strikes me as odd.  The convention is to use lower case package
names.

It should read:

com.ibm.db2.app.UDF.set

Did you use that package name anywhere in your code, particularly as a
string literal?

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Rhino - 27 Apr 2006 13:49 GMT
> On Thu, 27 Apr 2006 00:01:55 -0400, "Rhino"
> <no.offline.contact.please@nospam.com> wrote, quoted or indirectly
[quoted text clipped - 4 lines]
> that strikes me as odd.  The convention is to use lower case package
> names.

I agree that it is odd to have the 'COM' part of the package name in
uppercase but it happens to be the way IBM named that package; it's been
that way since DB2 first started supporting Java. It's not a typo, just a
name choice that doesn't comply with the standard.

> It should read:
>
> com.ibm.db2.app.UDF.set
>
> Did you use that package name anywhere in your code, particularly as a
> string literal?

The full thing, com.ibm.db2.app.UDF.set (or COM.ibm.db2.app.UDF.set)? No,
absolutely not. I have the string "UDF" in some comments and in some
System.out.println() statements of the little driver program but they all
look perfectly kosher to me.

--
Rhino


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.