This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes NullPointerException while trying to get BLOB object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "NullPointerException while trying to get BLOB object " Watch "NullPointerException while trying to get BLOB object " New topic
Author

NullPointerException while trying to get BLOB object

Sachin Deokar
Ranch Hand

Joined: May 09, 2008
Posts: 41
Hi,

I have a pdf file stored in Oracle DB as a Blob and trying to retrieve using a TO. I have copied below the setter and getter method from the TO and also the logs.

Could you please help me try to figure out why am I getting a NullPointerException.

As you can see in the logs the setter method stores the blob object and prints the size as 30. The getter method passes the null check and prints the object.toString() but when it comes to this.docBlob.length() an exception is thrown.

Also, to add flex calls a servlet which calls a spring service to get the pdf from the database. The TO with pdf populated from DB is returned by the service method to the servlet.

Thanks in advance.


Logs:


Regards,
Sachin Deokar
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Did you close the result set that produced the Blob object? Because the Blob may need it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Sachin Deokar
Ranch Hand

Joined: May 09, 2008
Posts: 41
I am using Spring's DAORowmapper to populate the TO from resultset which I believe cloeses the resultset as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPointerException while trying to get BLOB object
 
Similar Threads
Issue Req Storing Result Set Data in a XML File
uploading images using strut
ORA-01460: unimplemented or unreasonable conversion requested
Retrieving database values inside the <s:select> tag
bookstore application error..