2015-02-26 5 views
0

Я создаю простой успокоительный прокси-сервер, используя mule. в то время как большинство остальных вызовов проксировано правильно, один из вызовов POST бросает исключение нулевого указателя.mule restful proxy throws null Указатель исключений

Вот сообщение въездной:

org.mule.DefaultMuleMessage 
{ 
    id=c856d080-bd55-11e4-8504-6c40089d7cb6 
    payload=java.lang.String 
    correlationId=<not set> 
    correlationGroup=-1 
    correlationSeq=-1 
    encoding=UTF-8 
    exceptionPayload=<not set> 

Message properties: 
    INVOCATION scoped properties: 
    INBOUND scoped properties: 
    accept=text/virl+xml,multipart/mixed 
    authorization=Basic TmV0U2ltOk5ldFNpbQ== 
    connection=keep-alive 
    content-length=1000 
    content-type=application/xml 
    host=localhost:9090 
    http.listener.path=/* 
    http.method=POST 
    [email protected]eee18 
    http.query.string=session=0c603343-49e6-452f-bfdf-1e69cf478f65 
    http.remote.address=/127.0.0.1:52065 
    http.request.path=/ank/rest/process 
    http.request.uri=/ank/rest/process?session=0c603343-49e6-452f-bfdf-1e69cf478f65 
    http.scheme=http 
    [email protected] 
    http.version=HTTP/1.1 
    user-agent=Jersey/2.0-rc1 (HttpUrlConnection 1.7.0_71) 
    OUTBOUND scoped properties: 
    Content-Type=text/plain;charset=UTF-8 
    MULE_ENCODING=UTF-8 
    http.disable.status.code.exception.check=false 
    SESSION scoped properties: 
} 
ERROR 2015-02-25 19:21:26,894 [[restproxy].VIRL-UWM-Management-APIs.worker.02] org.mule.exception.CatchMessagingExceptionStrategy: 
******************************************************************************** 
Message    : null (java.lang.NullPointerException). Message payload is of type: String 
Code     : MULE_ERROR--2 
-------------------------------------------------------------------------------- 
Exception stack is: 
1. null (java.lang.NullPointerException) 
    org.mule.module.http.internal.HttpParser:94 (null) 
2. null (java.lang.NullPointerException). Message payload is of type: String (org.mule.api.MessagingException) 
    org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) 
-------------------------------------------------------------------------------- 
Root Exception stack trace: 
java.lang.NullPointerException 
    at org.mule.module.http.internal.HttpParser.parseMultipartContent(HttpParser.java:94) 
    at org.mule.module.http.internal.request.HttpResponseToMuleEvent.getInboundAttachments(HttpResponseToMuleEvent.java:139) 
    at org.mule.module.http.internal.request.HttpResponseToMuleEvent.convert(HttpResponseToMuleEvent.java:77) 
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) 
******************************************************************************** 

понятия не имеют, почему он терпит неудачу. Нажатие фактической конечной точки при прохождении прокси работает правильно. любые подсказки?

Mule потока:

<?xml version="1.0" encoding="UTF-8"?> 

<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
    xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.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/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd 
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd 
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd"> 
    <http:listener-config name="VIRL-UWM-Management-APIs" host="0.0.0.0" port="9090" doc:name="HTTP Listener Configuration"/> 
    <http:request-config name="Actual-Virl-Enpoint-for-UWM" host="virl03.stic.cisco-services.com" port="19399" doc:name="HTTP Request Configuration"/> 
    <http:listener-config name="AutoNetKit-API" host="0.0.0.0" port="19401" doc:name="HTTP Listener Configuration"/> 
    <http:request-config name="AutoNetkit-End-Point" host="virl03.stic.cisco-services.com" port="19401" doc:name="HTTP Request Configuration"/> 
    <flow name="virl-proxyFlow"> 
     <http:listener config-ref="AutoNetKit-API" path="*" allowedMethods="GET" doc:name="HTTP"/> 
     <set-property propertyName="http.disable.status.code.exception.check" value="false" doc:name="Disable Exception Check"/> 
     <logger message=" payload is: #[message.payload], method is: #[message.inboundProperties.'http.method'], Request URI is: #[message.inboundProperties.'http.request.uri'], message is: #[message]" level="INFO" doc:name="Logger"/> 
     <flow-ref name="copy-headers" doc:name="Copy HTTP Headers"/> 
     <http:request config-ref="AutoNetkit-End-Point" path="#[message.inboundProperties.'http.request.uri']" method="#[message.inboundProperties.'http.method']" responseTimeout="60000" doc:name="AutoNetKit-EndPoint"/> 
     <flow-ref name="copy-headers" doc:name="Copy HTTP Headers"/> 
    </flow> 
    <flow name="VIRL-Restful-Proxy"> 
     <http:listener config-ref="VIRL-UWM-Management-APIs" path="*" doc:name="HTTP"/> 
     <choice doc:name="GET-vs-POST"> 
      <when expression="#[message.inboundProperties.'http.method' == 'POST']"> 
       <object-to-string-transformer doc:name="Object to String"/> 
       <logger message="Set the payload of type string - since it's a post request." level="INFO" doc:name="Logger"/> 
      </when> 
      <otherwise> 
       <logger message="Not setting payload transformation as it's a GET request." level="INFO" doc:name="Logger"/> 
      </otherwise> 
     </choice> 

     <set-property propertyName="http.disable.status.code.exception.check" value="false" doc:name="Disable Exception Check"/> 

     <logger message=" payload is: #[message.payload], method is: #[message.inboundProperties.'http.method'], Request URI is: #[message.inboundProperties.'http.request.uri'], message is: #[message]" level="INFO" doc:name="Logger"/> 
     <flow-ref name="copy-headers" doc:name="Copy HTTP Headers"/> 

     <http:request config-ref="Actual-Virl-Enpoint-for-UWM" path="#[message.inboundProperties.'http.request.uri']" 
         method="#[message.inboundProperties.'http.method']" responseTimeout="60000" doc:name="VIRL End Point"/> 
     <logger message="response payload: #[message]" level="INFO" doc:name="Logger"/> 

     <flow-ref name="copy-headers" doc:name="Copy HTTP Headers"/> 


     <catch-exception-strategy doc:name="Catch Exception Strategy"> 
      <logger level="DEBUG" message="#[exception.exceptions]" doc:name="Logger"/> 
     </catch-exception-strategy> 


    </flow> 

     <sub-flow name="copy-headers" > 
     <copy-properties propertyName="*" doc:name="Copy All HTTP Headers"/> 
     <remove-property propertyName="Content-Length" doc:name="Remove Content Length"/> 
     <remove-property propertyName="MULE_*" doc:name="Remove MULE Properties"/> 
     <remove-property propertyName="X_MULE*" doc:name="Remove X_MULE Properties"/> 
     <remove-property propertyName="X-MULE*" doc:name="Remove X-MULE Properties"/> 
    </sub-flow> 



</mule> 

благодаря

+0

Mule версия? Конфигурация потока? Трассировки стека? Больше информации или мы не можем помочь. –

+0

Это текущая версия - только что загруженная сегодня., Обновленный поток мула. Что касается трассировки стека, это все, что я вижу в консоли anypoint studio. – user3012653

+0

Спасибо за детали. Вы запускаете приложение с помощью '-Dmule.verbose.exceptions = true', у вас будет более подробное исключение. На данный момент, я думаю, вы предоставили достаточно информации. –

ответ

0

Это ошибка в коде мула: Я сообщил об этом таким образом, вы можете отслеживать MULE-8342.

В то же время, вы можете попробовать следующее:

  • Если у вас есть контроль над удаленным сервером, добавьте Content-Disposition заголовок в своих многотомных ответов.
  • Временно используйте http:outbound-endpoint вместо http:request, пока исправленная ошибка не будет исправлена.
+0

Спасибо, Дэвид. Я могу пройти мимо этой проблемы с http: outbound-endpoint. Однако я столкнулся с другой проблемой. Теперь я получаю код ответа 304 для вызовов веб-сокетов. Это известная проблема ? – user3012653

+0

Спасибо, Дэвид. Поддерживаются ли в Mule вызовы websocket? вот что я получаю, когда я вызываю вызовы веб-сокетов: исключение: org.mule.api.transport.DispatchException: не удалось выполнить маршрутизацию через конечную точку: DefaultOutboundEndpoint {endpointUri = http: // host /? uuid = e8d6ceeb-7c9f-4ea5- 97bf-a4ed45d303ae, разъем = HttpPollingConnector – user3012653

+0

подробности об исключении. { имя = HTTP_Polling жизненный цикл = начать это = 236ce4be numberOfConcurrentTransactedReceivers = 4 createMultipleTransactedReceivers = истина связано = истинная supportedProtocols = [HTTP] serviceOverrides = message.receiver = org.mule.transport.http.PollingHttpMessageReceiver } – user3012653

Смежные вопросы