java.io.NotSerializableException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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) ********************************************************************************
    via by Puneet Gupta,
  • 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) ********************************************************************************
    via by Puneet Gupta,
  • GitHub comment 855#122357014
    via GitHub by rkaltreider
    ,
    • 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)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    70 more bugmates