cancel
Showing results for 
Search instead for 
Did you mean: 

Passing InputStream to EJB

Former Member
0 Kudos

Hi All,

I have a stateless session bean. I need to pass a ByteArrayInputStream as a parameter to one of the functions. However, when I call the function I get the following error:

com.sap.engine.services.rmi_p4.exception.P4BaseRuntimeException: I/O operation failed : java.io.NotSerializableException: java.io.ByteArrayInputStream

I tried running everything without having the input stream as a parameter and it worked fine. Any idea as to why I might be getting this error?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

ByteArrayInputStream does not implement java.io.Serializable. Therefore it seems EJB container cannot handle that type of data.

Keep in mind EJB's lifecycle managed by the EJB container, at some point the container may need to serialize the whole ejb instance and save it for later use... therefore if something is not serializable it cannot be saved.

I suppose this is your problem. You may look for another way to pass the block of bytes with something serializable. Maybe just a populated array of bytes.

I hope I answered your question.

Kind regards,

Vitaliano

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks Vitaliano,

That solved my problem. The though of passing the array of bytes never even occured to me.

Thanks again.