0 Replies Latest reply on Aug 2, 2006 11:20 PM by emwamba

    ResultSet getBlob or getBinaryStream Throws an Exception

    emwamba

      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!