File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieve image from database and display it in jsp using multipart property

 
monicka rk akilan
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am trying to save and retrieve from database.
Saving is working perfectly . but when i try to retrive
its showing error in the place of casting ByteArrayInputStream to multipart


if ((fileList.get(0).getFileType()).equals("abc")) {
commonVo.gettInfoVO().setStPhoto(

=================================================================
(MultipartFile) fileList.get(0).getInputStream());
here i got error as

SEVERE: Servlet.service() for servlet Havila threw exception
java.lang.ClassCastException: java.io.ByteArrayInputStream cannot be cast to org.springframework.web.multipart.MultipartFile
=================================================================

}


help me to resolve this problem.

 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

ClassCastException means that you try to assign to variable wrong type. Type of variable does not have type of object you assign to it.
Simply change variable type to type of what you assign to it.
This causes exception

Check if MultipartPartFile extend InputStream .
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic