[kaffe] java.lang.ClassCastException

Lam King Tin ktlam at cs.hku.hk
Fri Dec 15 20:11:57 PST 2006


Dear Dalibor,

I encountered a problem in using MySQL JDBC driver on JESSICA2 (Kaffe 1.0.6). I 
believe this is a Kaffe problem. If this problem can be solved, then JESSICA2 
can be operating with a backend MySQL cluster - a combination providing better 
scalability with database applications.  

The versions I tested are:
- MySQL Connector/J: 3.0.16 (or 3.0.17)   
  (can't use higher version as Kaffe 1.0.6 does not have Java NIO package)
- MySQL Server: mysql-max-5.0.27 (cluster)
  (if use lower version: 4.0.24, can run successfully but such version is not 
my wish - it has no ndb cluster engine.)

The above config works fine with Sun JVM. But when running on JESSICA2 (Kaffe 
1.0.6), the following exception will be thrown. The class 
SingleByteCharsetConverter should have been loaded dynamically by Class.forName
(jdbc-driver). The line of exception in MySQL source code is the following:

SingleByteCharsetConverter converter = (SingleByteCharsetConverter) 
this.charsetConverterMap.get(javaEncodingName);

Do you know what's the reason of the casting exception and any manageable 
solution? Thank you very much.

Best regards,
King Tin



SQL Exception:  Unable to connect to any hosts due to exception: 
java.lang.ClassCastException: can't cast `java/lang/Object' to 
`com/mysql/jdbc/SingleByteCharsetConverter'

** BEGIN NESTED EXCEPTION ** 

java.lang.ClassCastException
MESSAGE: can't cast `java/lang/Object' to 
`com/mysql/jdbc/SingleByteCharsetConverter'

STACKTRACE:

java.lang.ClassCastException: can't cast `java/lang/Object' to 
`com/mysql/jdbc/SingleByteCharsetConverter'
        at com.mysql.jdbc.Connection.getCharsetConverter(Connection.java:2046)
        at com.mysql.jdbc.ResultSet.getString(ResultSet.java:1792)
        at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:1251)
        at com.mysql.jdbc.Connection.buildCollationMapping(Connection.java:2398)
        at com.mysql.jdbc.Connection.initializePropsFromServer
(Connection.java:3262)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1803)
        at com.mysql.jdbc.Connection.<init>(Connection.java:450)
        at com.mysql.jdbc.NonRegisteringDriver.connect
(NonRegisteringDriver.java:411)
        at java.sql.DriverManager.getConnection(DriverManager.java:61)
        at java.sql.DriverManager.getConnection(DriverManager.java:49)
        at testdb.doGet(testdb.java:49)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.tomcat.core.ServletWrapper.doService
(ServletWrapper.java:405)
        at org.apache.tomcat.core.Handler.service(Handler.java:287)
        at org.apache.tomcat.core.ServletWrapper.service
(ServletWrapper.java:372)
        at org.apache.tomcat.core.ContextManager.internalService
(ContextManager.java:806)
        at org.apache.tomcat.core.ContextManager.service
(ContextManager.java:752)
        at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection
(HttpConnectionHandler.java:214)




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/




More information about the kaffe mailing list