Bug 20394 - Can't run db2 jdbc application compiled with gcj
Summary: Can't run db2 jdbc application compiled with gcj
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-09 14:37 UTC by David E. De La Rosa
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David E. De La Rosa 2005-03-09 14:37:11 UTC
Hello,

I managed to get jdbc MSSQL & ORACLE test apps work just fine. I have not been
able to make DB2 work. Here is what I get. Does this mean something is missing
on the gcj classes ? I can provide sample source and the shared libs and/or the
jars ....


[acuser@linux DB]$ ./db2test
jdbcDB2 - Java Database Interface Test Utility
jdbcTester - Library Path =
jdbcTester - Database Type Selected... DB2
jdbcTester - Database Connection Details...
jdbcTester - Database Type:  DB2
jdbcTester - Database Name:  XQDB
jdbcTester - Database Host:  192.168.1.167
jdbcTester - Database Port:  50000
jdbcTester - Database User:  acuser
jdbcTester - Database PWrd:  acuser
jdbcTester - Database cURL: 
jdbc:db2://192.168.1.167:50000/XQDB:traceFile=jdbcDB2.log;traceLevel=-1;
Loading Appropriate Database Driver...
Loaded the Appropriate Driver...
Connecting to Database...
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving
class: com.ibm.db2.jcc.b.i
   at java.lang.VMClassLoader.transformException(java.lang.Class,
java.lang.Throwable) (/usr/local/lib/libgcj.so.6.0.0)
   at java.lang.VMClassLoader.resolveClass(java.lang.Class)
(/usr/local/lib/libgcj.so.6.0.0)
   at java.lang.Class.initializeClass() (/usr/local/lib/libgcj.so.6.0.0)
   at java.lang.Class.initializeClass() (/usr/local/lib/libgcj.so.6.0.0)
   at com.ibm.db2.jcc.a.b.a(com.ibm.db2.jcc.b.xb, int, java.lang.String, int)
(/home/acuser/gcj/DB/libdb2jcc.so)
   at com.ibm.db2.jcc.b.o.o(com.ibm.db2.jcc.b.xb, int, java.lang.String, int,
java.lang.String, int, java.util.Properties) (/home/acuser/gcj/DB/libdb2jcc.so)
  at com.ibm.db2.jcc.a.b.b(com.ibm.db2.jcc.a.g, int, java.lang.String, int,
java.lang.String, java.util.Properties) (/home/acuser/gcj/DB/libdb2jcc.so)
   at com.ibm.db2.jcc.DB2Driver.connect(java.lang.String, java.util.Properties)
(/home/acuser/gcj/DB/libdb2jcc.so)
   at java.sql.DriverManager.getConnection(java.lang.String,
java.util.Properties) (/usr/local/lib/libgcj.so.6.0.0)
   at java.sql.DriverManager.getConnection(java.lang.String, java.lang.String,
java.lang.String) (/usr/local/lib/libgcj.so.6.0.0)
   at jdbcDB2.dbConnect(java.lang.String, java.lang.String) (Unknown Source)
   at jdbcDB2.main(java.lang.String[]) (Unknown Source)
   at gnu.java.lang.MainThread.call_main() (/usr/local/lib/libgcj.so.6.0.0)
   at gnu.java.lang.MainThread.run() (/usr/local/lib/libgcj.so.6.0.0)
Caused by: java.lang.ClassNotFoundException: sun.io.ByteToCharConverter not
found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./],
parent=gnu.gcj.runtime.VMClassLoader{urls=[core:/], parent=null}}
   at java.net.URLClassLoader.findClass(java.lang.String)
(/usr/local/lib/libgcj.so.6.0.0)
   at java.lang.ClassLoader.loadClass(java.lang.String, boolean)
(/usr/local/lib/libgcj.so.6.0.0)
   ...13 more
[acuser@linux DB]$
Comment 1 Andrew Pinski 2005-03-09 14:40:31 UTC
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving
class: com.ibm.db2.jcc.b.i

This means either ibm's .jar file contains classes which reference other classes which are not there and 
since gcj's runtime does not do lazy biind, we fail 
---or---
could mean gcj is going wrong.
Comment 2 David E. De La Rosa 2005-03-09 16:23:21 UTC
Does this:

sun.io.ByteToCharConverter not
found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./],


mean the the gcj runtime library has no sun.io.ByteToCharConverter ? If so, is
there a way to add it into libgcj.so or could I extract it from the sun package
and compile it along my othe files ?
Comment 3 Andrew Pinski 2005-03-09 16:33:37 UTC
(In reply to comment #2)
> Does this:
> sun.io.ByteToCharConverter not
> found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./],

Hmm, this seems wrong, no body should be refering to a sun. class really.
Comment 4 Michael Koch 2005-03-09 17:47:41 UTC
Thats a bug in upstream, the jdbc connector/application here. No application
should access sun classes. File a bug against them. Even SUN says: Don't use
them directly. We did the same successfully for a bunch of Apache projects in
the past.
Comment 5 David E. De La Rosa 2005-03-09 17:56:19 UTC
Thanks for the response. What is upstream ? Is that a gcj component ? Where
exactly should I post the bug ? On the meantime, I plan to extract that
particular class and compile it in with the application. My guess is that DB/2
jars are using the sun.io.ByteToCharConverter which is not recommended right ?
Any help is greatly appreciated.
Comment 6 Michael Koch 2005-03-09 18:40:55 UTC
Upstream is the provider of your jdbc provider. DB/2 in your case.
Comment 7 David E. De La Rosa 2005-03-09 18:52:03 UTC
Hello, sorry for being a pest. You indicated a company called upstream which
provides the jdbc driver for IBM. Can you please share their web url ? I tried
several searches but none made sense. Many thanks in advance.
Comment 8 Andrew Pinski 2005-03-09 18:57:28 UTC
(In reply to comment #7)
> Hello, sorry for being a pest. You indicated a company called upstream which
> provides the jdbc driver for IBM. Can you please share their web url ? I tried
> several searches but none made sense. Many thanks in advance.

upstreaming is not the name of a company but just a way to say the company which provided you with 
the jar file, I would expect it be IBM.  In which case I would contact the provider of the Jar file to figure 
out if there is anything they can do to fix this.
Comment 9 David E. De La Rosa 2005-03-09 19:07:54 UTC
Ok. Thanks, that is what I thought originally. Yes, I will contact IBM but I
suspect it won't be speedy -- on the meantime I will extract the class from
rt.jar or wherever it is --  and proceed with the validation. Why wouldn't
libgcj.so contain this, I have seen the symbols in it and there is plenty of
sun.xx.xx ?
Comment 10 David E. De La Rosa 2005-03-09 22:36:19 UTC
Hello, 
Tried to extract a bunch of classes fron Sun's rt.jar and I ended it when it
needed some internal class sun.io.CharacterEconding$2 ... So, does anybody have
some experience with a jdbc driver for DB2 that can be compiled with gcj and 
actually run ? Any pointers are greatly appreciated. We have Oracle, MSSQL
running just fine -- and very fast, but we need DB2. 
Thanks, David
Comment 11 Andrew Pinski 2005-03-10 13:10:54 UTC
Closing as this is not our bug.