mulesoft / facebook-connector

Facebook Cloud Connector
Other
4 stars 9 forks source link

Connector Throws Serialization Exception When Used with API Kit Router #30

Closed arifcse019 closed 7 years ago

arifcse019 commented 8 years ago

I am using mule 3.8.0 CE. I am getting the following exception when trying to use Facebook Connector with API Kit Router

`ERROR 2016-10-25 14:39:56,699 [[facebook-connector-test].httpListenerConfig.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy:


Message : java.io.NotSerializableException: org.mule.raml.implv1.model.MimeTypeImpl (org.apache.commons.lang.SerializationException) Payload : {NullPayload} Payload Type : org.mule.transport.NullPayload

Element : /get:\/facebook-user-posts:Router/processors/0 @ facebook-connector-test

Root Exception stack trace: java.io.NotSerializableException: org.mule.raml.implv1.model.MimeTypeImpl at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at java.util.ArrayList.writeObject(ArrayList.java:742) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at org.apache.commons.collections.map.AbstractHashedMap.doWriteObject(AbstractHashedMap.java:1182) at org.mule.util.CaseInsensitiveHashMap.writeObject(CaseInsensitiveHashMap.java:142) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:440) at org.mule.DefaultMuleEvent.writeObject(DefaultMuleEvent.java:1005) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at org.apache.commons.lang.SerializationUtils.serialize(SerializationUtils.java:108) at org.mule.serialization.internal.JavaObjectSerializer.serialize(JavaObjectSerializer.java:34) at org.mule.util.store.PersistentObjectStorePartition.serialize(PersistentObjectStorePartition.java:373) at org.mule.util.store.PersistentObjectStorePartition.store(PersistentObjectStorePartition.java:140) at org.mule.util.store.PartitionedPersistentObjectStore.store(PartitionedPersistentObjectStore.java:111) at org.mule.util.store.AbstractPartitionedObjectStore.store(AbstractPartitionedObjectStore.java:51) at org.mule.security.oauth.BaseOAuth2Manager.storeAuthorizationEvent(BaseOAuth2Manager.java:521) at org.mule.security.oauth.processor.BaseOAuth2AuthorizeMessageProcessor.doProcess(BaseOAuth2AuthorizeMessageProcessor.java:89) at org.mule.devkit.processor.DevkitBasedMessageProcessor.process(DevkitBasedMessageProcessor.java:89) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:102) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.construct.DynamicPipelineMessageProcessor.process(DynamicPipelineMessageProcessor.java:55) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.interceptor.AbstractEnvelopeInterceptor.processBlocking(AbstractEnvelopeInterceptor.java:58) at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:52) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.processor.AbstractRequestResponseMessageProcessor.processBlocking(AbstractRequestResponseMessageProcessor.java:56) at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.construct.Flow$2.process(Flow.java:138) at org.mule.construct.Flow$2.process(Flow.java:133) at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16) at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:35) at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:22) at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30) at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14) at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:67) at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50) at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28) at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13) at org.mule.execution.ErrorHandlingExecutionTemplate.execute(ErrorHandlingExecutionTemplate.java:60) at org.mule.execution.ErrorHandlingExecutionTemplate.execute(ErrorHandlingExecutionTemplate.java:30) at org.mule.construct.Flow.process(Flow.java:132) at org.mule.module.apikit.AbstractRouter.processBlockingRequest(AbstractRouter.java:87) at org.mule.module.apikit.AbstractRouter.processBlocking(AbstractRouter.java:77) at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:102) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.construct.DynamicPipelineMessageProcessor.process(DynamicPipelineMessageProcessor.java:55) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.interceptor.AbstractEnvelopeInterceptor.processBlocking(AbstractEnvelopeInterceptor.java:58) at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:52) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:98) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.processor.AbstractRequestResponseMessageProcessor.processBlocking(AbstractRequestResponseMessageProcessor.java:56) at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88) at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) at org.mule.construct.AbstractPipeline$3.process(AbstractPipeline.java:232) at org.mule.module.http.internal.listener.HttpMessageProcessorTemplate.routeEvent(HttpMessageProcessorTemplate.java:73) at org.mule.execution.AsyncResponseFlowProcessingPhase$1.process(AsyncResponseFlowProcessingPhase.java:72) at org.mule.execution.AsyncResponseFlowProcessingPhase$1.process(AsyncResponseFlowProcessingPhase.java:59) at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16) at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:35) at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:22) at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30) at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14) at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:67) at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44) at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50) at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40) at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41) at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48) at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28) at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13) at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:110) at org.mule.execution.AsyncResponseFlowProcessingPhase.runPhase(AsyncResponseFlowProcessingPhase.java:58) at org.mule.execution.AsyncResponseFlowProcessingPhase.runPhase(AsyncResponseFlowProcessingPhase.java:35) at org.mule.execution.PhaseExecutionEngine$InternalPhaseExecutionEngine.process(PhaseExecutionEngine.java:114) at org.mule.execution.PhaseExecutionEngine.process(PhaseExecutionEngine.java:41) at org.mule.execution.MuleMessageProcessingManager.processMessage(MuleMessageProcessingManager.java:32) at org.mule.module.http.internal.listener.DefaultHttpListener$1.handleRequest(DefaultHttpListener.java:133) at org.mule.module.http.internal.listener.grizzly.GrizzlyRequestDispatcherFilter.handleRead(GrizzlyRequestDispatcherFilter.java:83) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.mule.module.http.internal.listener.grizzly.ExecutorPerServerAddressIOStrategy.run0(ExecutorPerServerAddressIOStrategy.java:102) at org.mule.module.http.internal.listener.grizzly.ExecutorPerServerAddressIOStrategy.access$100(ExecutorPerServerAddressIOStrategy.java:30) at org.mule.module.http.internal.listener.grizzly.ExecutorPerServerAddressIOStrategy$WorkerThreadRunnable.run(ExecutorPerServerAddressIOStrategy.java:125) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)`

Following is my configuration

`<?xml version="1.0" encoding="UTF-8"?> <mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:facebook="http://www.mulesoft.org/schema/mule/facebook" xmlns:twitter="http://www.mulesoft.org/schema/mule/twitter" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/apikit" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd http://www.mulesoft.org/schema/mule/facebook http://www.mulesoft.org/schema/mule/facebook/current/mule-facebook.xsd http://www.mulesoft.org/schema/mule/twitter http://www.mulesoft.org/schema/mule/twitter/current/mule-twitter.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/apikit http://www.mulesoft.org/schema/mule/apikit/current/mule-apikit.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">

<http:listener-config name="httpListenerConfig" host="0.0.0.0" port="8082" doc:name="HTTP Listener Configuration"/>

<context:property-placeholder location="mule.properties"/>
<facebook:config-with-oauth name="Facebook" consumerKey="${facebookAppId}" consumerSecret="${facebookAppSecret}" doc:name="Facebook" scope="${facebookScope}">
    <facebook:oauth-callback-config  localPort="8081" remotePort="8081" path="callback"/>
</facebook:config-with-oauth>
<twitter:config name="Twitter__Configuration" accessKey="${access.key}" accessSecret="${access.secret}" consumerKey="${consumer.key}" consumerSecret="${consumer.secret}" doc:name="Twitter: Configuration"/>
<apikit:config name="Router" raml="api.raml" consoleEnabled="false" consolePath="console" doc:name="Router"/>
<flow name="get:/facebook-user-posts:Router">
    <facebook:authorize config-ref="Facebook" doc:name="Authorize"/>
    <facebook:get-user-posts config-ref="Facebook" since="last month" user="me" doc:name="Facebook"/>
    <json:object-to-json-transformer doc:name="Copy_of_Copy_of_List&lt;Photo&gt; to JSON"/>
</flow>

   <flow name="facebook-demo" >
    <http:listener config-ref="httpListenerConfig" path="/api/*" doc:name="HTTP"/>
    <apikit:router config-ref="Router" doc:name="APIkit Router"/>
</flow>

<apikit:mapping-exception-strategy name="apiKitGlobalExceptionMapping">
    <apikit:mapping statusCode="404">
        <apikit:exception value="org.mule.module.apikit.exception.NotFoundException" />
        <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
        <set-payload value="{ &quot;message&quot;: &quot;Resource not found&quot; }" doc:name="Set Payload"/>
    </apikit:mapping>
    <apikit:mapping statusCode="405">
        <apikit:exception value="org.mule.module.apikit.exception.MethodNotAllowedException" />
        <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
        <set-payload value="{ &quot;message&quot;: &quot;Method not allowed&quot; }" doc:name="Set Payload"/>
    </apikit:mapping>
    <apikit:mapping statusCode="415">
        <apikit:exception value="org.mule.module.apikit.exception.UnsupportedMediaTypeException" />
        <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
        <set-payload value="{ &quot;message&quot;: &quot;Unsupported media type&quot; }" doc:name="Set Payload"/>
    </apikit:mapping>
    <apikit:mapping statusCode="406">
        <apikit:exception value="org.mule.module.apikit.exception.NotAcceptableException" />
        <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
        <set-payload value="{ &quot;message&quot;: &quot;Not acceptable&quot; }" doc:name="Set Payload"/>
    </apikit:mapping>
    <apikit:mapping statusCode="400">
        <apikit:exception value="org.mule.module.apikit.exception.BadRequestException" />
        <set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
        <set-payload value="{ &quot;message&quot;: &quot;Bad request&quot; }" doc:name="Set Payload"/>
    </apikit:mapping>
</apikit:mapping-exception-strategy>

`

However, if I replace the <apikit:router config-ref="Router" doc:name="APIkit Router"/> in main flow i.e. "facebook-demo", with a flowref like <flow-ref name="get:/facebook-user-posts:Router" doc:name="get:/facebook-user-posts:Router"/>, then the app runs through.

Please suggest.

arifcse019 commented 7 years ago

The issue was with the RAML file where it said

...... responses: 200: body: application/json ............

During the OAuth dance, the endpoint returns null payload and then redirects the user to the callback. Hence the java.io.NotSerializableException caused at org.mule.raml.implv1.model.MimeTypeImpl.

The correct RAML should replace application/json with nil