[mule-user] Rest Service to JSON output

354 views
Skip to first unread message

Collins, Russell

unread,
Jan 30, 2012, 5:07:36 PM1/30/12
to us...@mule.codehaus.org
I am trying to take in a RESTful web-service as input and produce a JSON object as output.  My thought process is to use the jersey component for input, then with a series of transformations, send JSON as output.  Here is how my flow looks:

    <flow name="gsert-rest" >
   
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" />
       
        <jersey:resources >
            <component class="com.gsert.rest.GsertRest" />
        </jersey:resources>
       
        <response>
           <mulexml:xml-to-object-transformer >
               <mulexml:alias name="person" class="com.gsert.rest.Person"/>
           </mulexml:xml-to-object-transformer>
           <json:object-to-json-transformer />
        </response>
       
    </flow>

Some things to note.  The com.gsert.rest.Person object is annotated with the @JsonAutoDetect annotation.  It seems to be working fine until I add the object-to-json transform in the mix.  Any help with this matter would be greatly appreciated.


Russell Collins
Sr. Software Engineer
CoreLogic Spatial Solutions
rcol...@corelogic.com

"Do or do not, there is no try." - Yoda


******************************************************************************************
This message may contain confidential or proprietary information intended only for the use of the
addressee(s) named above or may contain information that is legally privileged. If you are
not the intended addressee, or the person responsible for delivering it to the intended addressee,
you are hereby notified that reading, disseminating, distributing or copying this message is strictly
prohibited. If you have received this message by mistake, please immediately notify us by 
replying to the message and delete the original message and any copies immediately thereafter.

Thank you.
******************************************************************************************
CLLD

Pablo La Greca

unread,
Jan 30, 2012, 8:24:53 PM1/30/12
to us...@mule.codehaus.org
Hi,

Is the flow throwing an exception?. Can you include stack trace?.

Pablo.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Collins, Russell

unread,
Jan 31, 2012, 9:59:06 AM1/31/12
to us...@mule.codehaus.org
In my browser, I receive this message:

No serializer found for class org.mule.module.jersey.MuleResponseWriter$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (org.codehaus.jackson.map.JsonMappingException). Message payload is of type: MuleResponseWriter$1 (org.mule.api.transformer.TransformerMessagingException). Message payload is of type: MuleResponseWriter$1


Here is the output from the console:

ERROR 2012-01-31 08:56:41,267 [connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : No serializer found for class org.mule.module.jersey.MuleResponseWriter$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (org.codehaus.jackson.map.JsonMappingException)
Code : MULE_ERROR-64999
--------------------------------------------------------------------------------
Exception stack is:
1. No serializer found for class org.mule.module.jersey.MuleResponseWriter$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (org.codehaus.jackson.map.JsonMappingException)
org.codehaus.jackson.map.ser.StdSerializerProvider$1:89 (null)
2. No serializer found for class org.mule.module.jersey.MuleResponseWriter$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (org.codehaus.jackson.map.JsonMappingException) (org.mule.api.transformer.TransformerException)
org.mule.module.json.transformers.ObjectToJson:107 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.codehaus.jackson.map.JsonMappingException: No serializer found for class org.mule.module.jersey.MuleResponseWriter$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) )
at org.codehaus.jackson.map.ser.StdSerializerProvider$1.failForEmpty(StdSerializerProvider.java:89)
at org.codehaus.jackson.map.ser.StdSerializerProvider$1.serialize(StdSerializerProvider.java:62)
at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:606)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

ERROR 2012-01-31 08:56:43,484 [connector.http.mule.default.receiver.03] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : No serializer found for class org.mule.module.jersey.MuleResponseWriter$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (org.codehaus.jackson.map.JsonMappingException)
Code : MULE_ERROR-64999
--------------------------------------------------------------------------------
Exception stack is:
1. No serializer found for class org.mule.module.jersey.MuleResponseWriter$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (org.codehaus.jackson.map.JsonMappingException)
org.codehaus.jackson.map.ser.StdSerializerProvider$1:89 (null)
2. No serializer found for class org.mule.module.jersey.MuleResponseWriter$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (org.codehaus.jackson.map.JsonMappingException) (org.mule.api.transformer.TransformerException)
org.mule.module.json.transformers.ObjectToJson:107 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.codehaus.jackson.map.JsonMappingException: No serializer found for class org.mule.module.jersey.MuleResponseWriter$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) )
at org.codehaus.jackson.map.ser.StdSerializerProvider$1.failForEmpty(StdSerializerProvider.java:89)
at org.codehaus.jackson.map.ser.StdSerializerProvider$1.serialize(StdSerializerProvider.java:62)
at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:606)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************


Russell Collins
Sr. Software Engineer
CoreLogic Spatial Solutions
rcol...@corelogic.com

"Do or do not, there is no try." - Yoda


******************************************************************************************
This message may contain confidential or proprietary information intended only for the use of the
addressee(s) named above or may contain information that is legally privileged. If you are
not the intended addressee, or the person responsible for delivering it to the intended addressee,
you are hereby notified that reading, disseminating, distributing or copying this message is strictly
prohibited. If you have received this message by mistake, please immediately notify us by
replying to the message and delete the original message and any copies immediately thereafter.

Thank you.
******************************************************************************************
CLLD


Reply all
Reply to author
Forward
0 new messages