While adding attachments of type ByteArrayInputStream with any MIME type as the attachment
      content type. Actually iam reading a file and converting to array of byte streams and
      passing the byte array as an attachment along with the content type (MIME).the source code is:
 
      FileInputStream fis = new FileInputStream(streamAttCo.getFilePath());;
      int noOfBytes = fis.available();
      byte[] fileData = new byte[noOfBytes];
      fis.read(fileData);
      ByteArrayInputStream stream = new ByteArrayInputStream(fileData);
      attachment.setContent(stream,image/jpeg);
 
      
      I am getting the following error. how can i resolve this error.
 
       javax.activation.UnsupportedDataTypeException: no object DCH for MIME type image/jpeg
 
       For other mime types: errors such as the following are coming
 
       java.lang.ClassCastException: java.io.ByteArrayInputStream
 at com.sun.xml.messaging.saaj.soap.DataContentHandler.writeTo(DataContentHandler.java:125)