[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - ResultSet getBlob or getBinaryStream Throws an Exception
emwamba
do-not-reply at jboss.com
Wed Aug 2 23:20:09 EDT 2006
I have an application which stores PDF documents in a longblob column of a MySQL 5 table. A standalone Java application writes to the table and persists the documents to the table. The documents can be downloaded via a web application. The code to retrieve the documents is straight forward:
...
rs = stmt.executeQuery();
if (rs.next()) {
Blob blob = rs.getBlob(1);
InputStream in = blob.getBinaryStream();
}
The code works in Tomcat 5 but in JBoss 4.0.2 the call to rs.getBlob(1) throws the following exception:
java.lang.reflect.UndeclaredThrowableException
at $Proxy77.getBlob(Unknown Source)
Caused by: java.lang.IllegalAccessException: Method=public abstract java.sql.Blob java.sql.ResultSet.getBlob(int) throws java.sql.SQLException does not return Serializable
...
..
Replacing rs.getBlob(1) with rs.getBinaryStream(1) also throws the same exception.
This problem and a few other JDBC related problems are beginning to raise a lot of doubts in my head about JBoss. The application works on Geronimo and Tomcat, but I hate Geronimo and Tomcat has no EJB container. Help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962693#3962693
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962693
More information about the jboss-user
mailing list