java.io.NotSerializableException: java.io.FileInputStream

MuleSoft JIRA | Puneet Gupta | 8 years ago
  1. 0

    If you use the file transport and have streaming=false, synchronous= false and <queue-profile persistent="true"/> then the inbound endpoint throw the below error: The problem is with FileContentsMessageAdapter (line 59) which creates a new fileInputStream to convert the file payload to byte[] but does not clear the reference to fileInputStream after closing the stream. As a result when FileContentsMessageAdapter is serailsed the reference to fileInputStream throws NotSerializableException exception. The modified working code is attached. ******************************************************************************** Exception stack is: 1. java.io.FileInputStream (java.io.NotSerializableException) java.io.ObjectOutputStream:1081 (http://java.sun.com/j2se/1.5.0/docs/api/java/io/NotSerializableException.html) 2. java.io.NotSerializableException: java.io.FileInputStream (java.lang.RuntimeException) org.mule.util.queue.TransactionalQueueSession$QueueImpl:91 (http://java.sun.com/j2se/1.5.0/docs/api/java/lang/RuntimeException.html) 3. Interrupted while queue event for "ReceiveHL7". Component that caused exception is: ReceiveHL7. Message payload is of type: byte[] (org.mule.FailedToQueueEventException) org.mule.model.seda.SedaService:207 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/FailedToQueueEventException.html) ******************************************************************************** Root Exception stack trace: java.io.NotSerializableException: java.io.FileInputStream at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416) at org.mule.DefaultMuleEvent.writeObject(DefaultMuleEvent.java:590) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at org.mule.util.queue.FilePersistenceStrategy.store(FilePersistenceStrategy.java:75) at org.mule.util.queue.TransactionalQueueManager.doStore(TransactionalQueueManager.java:237) at org.mule.util.queue.TransactionalQueueSession$QueueImpl.offer(TransactionalQueueSession.java:70) at org.mule.util.queue.TransactionalQueueSession$QueueImpl.put(TransactionalQueueSession.java:56) at org.mule.model.seda.SedaService.enqueue(SedaService.java:419) at org.mule.model.seda.SedaService.doDispatch(SedaService.java:224) at org.mule.service.AbstractService.dispatchEvent(AbstractService.java:475) at org.mule.DefaultMuleSession.dispatchEvent(DefaultMuleSession.java:274) at org.mule.routing.inbound.DefaultInboundRouterCollection.dispatch(DefaultInboundRouterCollection.java:223) at org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:192) at org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:364) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:175) at org.mule.transport.file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:281) at org.mule.transport.file.FileMessageReceiver.processFile(FileMessageReceiver.java:238) at org.mule.transport.file.FileMessageReceiver.poll(FileMessageReceiver.java:144) at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Thread.java:619) ********************************************************************************

    MuleSoft JIRA | 8 years ago | Puneet Gupta
    java.io.NotSerializableException: java.io.FileInputStream
  2. 0

    If you use the file transport and have streaming=false, synchronous= false and <queue-profile persistent="true"/> then the inbound endpoint throw the below error: The problem is with FileContentsMessageAdapter (line 59) which creates a new fileInputStream to convert the file payload to byte[] but does not clear the reference to fileInputStream after closing the stream. As a result when FileContentsMessageAdapter is serailsed the reference to fileInputStream throws NotSerializableException exception. The modified working code is attached. ******************************************************************************** Exception stack is: 1. java.io.FileInputStream (java.io.NotSerializableException) java.io.ObjectOutputStream:1081 (http://java.sun.com/j2se/1.5.0/docs/api/java/io/NotSerializableException.html) 2. java.io.NotSerializableException: java.io.FileInputStream (java.lang.RuntimeException) org.mule.util.queue.TransactionalQueueSession$QueueImpl:91 (http://java.sun.com/j2se/1.5.0/docs/api/java/lang/RuntimeException.html) 3. Interrupted while queue event for "ReceiveHL7". Component that caused exception is: ReceiveHL7. Message payload is of type: byte[] (org.mule.FailedToQueueEventException) org.mule.model.seda.SedaService:207 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/FailedToQueueEventException.html) ******************************************************************************** Root Exception stack trace: java.io.NotSerializableException: java.io.FileInputStream at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416) at org.mule.DefaultMuleEvent.writeObject(DefaultMuleEvent.java:590) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at org.mule.util.queue.FilePersistenceStrategy.store(FilePersistenceStrategy.java:75) at org.mule.util.queue.TransactionalQueueManager.doStore(TransactionalQueueManager.java:237) at org.mule.util.queue.TransactionalQueueSession$QueueImpl.offer(TransactionalQueueSession.java:70) at org.mule.util.queue.TransactionalQueueSession$QueueImpl.put(TransactionalQueueSession.java:56) at org.mule.model.seda.SedaService.enqueue(SedaService.java:419) at org.mule.model.seda.SedaService.doDispatch(SedaService.java:224) at org.mule.service.AbstractService.dispatchEvent(AbstractService.java:475) at org.mule.DefaultMuleSession.dispatchEvent(DefaultMuleSession.java:274) at org.mule.routing.inbound.DefaultInboundRouterCollection.dispatch(DefaultInboundRouterCollection.java:223) at org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:192) at org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:364) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:175) at org.mule.transport.file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:281) at org.mule.transport.file.FileMessageReceiver.processFile(FileMessageReceiver.java:238) at org.mule.transport.file.FileMessageReceiver.poll(FileMessageReceiver.java:144) at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Thread.java:619) ********************************************************************************

    MuleSoft JIRA | 8 years ago | Puneet Gupta
    java.io.NotSerializableException: java.io.FileInputStream
  3. 0

    NotSerializableException HttpsURLConnectionFactory

    GitHub | 2 years ago | rwinch
    java.io.NotSerializableException: org.jasig.cas.client.ssl.HttpsURLConnectionFactory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    building graphs fails with an exception during serialization

    GitHub | 5 years ago | novalis
    java.io.NotSerializableException: java.lang.ref.SoftReference - field (class "org.opentripplanner.common.geometry.PackedCoordinateSequence", name: "coordRef", type: "class java.lang.ref.SoftReference") - object (class "org.opentripplanner.common.geometry.PackedCoordinateSequence$Float", org.opentripplanner.common.geometry.PackedCoordinateSequence$Float@5c3ffeaa) - field (class "com.vividsolutions.jts.geom.LineString", name: "points", type: "interface com.vividsolutions.jts.geom.CoordinateSequence") - object (class "com.vividsolutions.jts.geom.LineString", LINESTRING (17.535017013549805 47.09564208984375, 17.535898208618164 47.09583282470703)) - field (class "org.opentripplanner.routing.edgetype.Street", name: "geometry", type: "class com.vividsolutions.jts.geom.LineString") - object (class "org.opentripplanner.routing.edgetype.Street", Street(way 44518491, way 44518491, 69.58539082146817)) - element of array (index: 0) - array (class "[Ljava.lang.Object;", size: 4) - field (class "java.util.Vector", name: "elementData", type: "class [Ljava.lang.Object;") - custom writeObject data (class "java.util.Vector") - object (class "java.util.Vector", [Street(way 44518491, way 44518491, 69.58539082146817), osm node 565534882_13_44518491-> osm node 565534882_14_44518491, osm node 565534882_13_44518491-> osm node 565534882_14_44518491, Street(4.042462440080216)]) - field (class "org.opentripplanner.routing.core.Intersection", name: "incoming", type: "class java.util.Vector") - custom writeObject data (class "org.opentripplanner.routing.core.Intersection") - object (class "org.opentripplanner.routing.core.Intersection", <osm node 565534882_14_44518491 4 4>) - custom writeObject data (class "java.util.HashMap") - object (class "java.util.HashMap", {osm node 410878188_3_35031520=<osm node 410878188_3_35031520 3 3>, ... **long list of verices removed**}) - field (class "org.opentripplanner.routing.core.Graph", name: "vertices", type: "class java.util.HashMap") - root object (class "org.opentripplanner.routing.core.Graph", org.opentripplanner.routing.core.Graph@3899bdc8)
  6. 0

    Exception while serializing graph (CoordinateArrayListSequence is not serializable)

    GitHub | 2 years ago | hannesj
    java.lang.IllegalStateException: java.io.NotSerializableException: org.opentripplanner.api.resource.CoordinateArrayListSequence

  1. Malcshour 19 times, last 7 months ago
12 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.NotSerializableException

    java.io.FileInputStream

    at java.io.ObjectOutputStream.writeObject0()
  2. Java RT
    ObjectOutputStream.defaultWriteObject
    1. java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
    2. java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
    3. java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
    4. java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
    5. java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
    6. java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
    7. java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
    8. java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
    9. java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
    10. java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
    11. java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416)
    11 frames
  3. Mule Core
    DefaultMuleEvent.writeObject
    1. org.mule.DefaultMuleEvent.writeObject(DefaultMuleEvent.java:590)
    1 frame
  4. Java RT
    ObjectOutputStream.writeObject
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:597)
    5. java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
    6. java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
    7. java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
    8. java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
    9. java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
    9 frames
  5. Mule Core
    DefaultMuleSession.dispatchEvent
    1. org.mule.util.queue.FilePersistenceStrategy.store(FilePersistenceStrategy.java:75)
    2. org.mule.util.queue.TransactionalQueueManager.doStore(TransactionalQueueManager.java:237)
    3. org.mule.util.queue.TransactionalQueueSession$QueueImpl.offer(TransactionalQueueSession.java:70)
    4. org.mule.util.queue.TransactionalQueueSession$QueueImpl.put(TransactionalQueueSession.java:56)
    5. org.mule.model.seda.SedaService.enqueue(SedaService.java:419)
    6. org.mule.model.seda.SedaService.doDispatch(SedaService.java:224)
    7. org.mule.service.AbstractService.dispatchEvent(AbstractService.java:475)
    8. org.mule.DefaultMuleSession.dispatchEvent(DefaultMuleSession.java:274)
    8 frames
  6. org.mule.routing
    DefaultInboundRouterCollection.route
    1. org.mule.routing.inbound.DefaultInboundRouterCollection.dispatch(DefaultInboundRouterCollection.java:223)
    2. org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:192)
    2 frames
  7. Mule Core
    AbstractMessageReceiver.routeMessage
    1. org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:364)
    2. org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252)
    3. org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:175)
    3 frames
  8. org.mule.transport
    FileMessageReceiver.poll
    1. org.mule.transport.file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:281)
    2. org.mule.transport.file.FileMessageReceiver.processFile(FileMessageReceiver.java:238)
    3. org.mule.transport.file.FileMessageReceiver.poll(FileMessageReceiver.java:144)
    3 frames
  9. Mule Core
    WorkerContext.run
    1. org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47)
    2. org.mule.work.WorkerContext.run(WorkerContext.java:310)
    2 frames
  10. Backport of JSR 166
    ThreadPoolExecutor$Worker.run
    1. edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
    2. edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
    2 frames
  11. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:619)
    1 frame