Mule:数据库插入失败并超时

时间:2017-04-03 00:44:27

标签: mule

我正在尝试将数据插入数据库表&我收到以下错误:

异常堆栈是: 1.超时超时(java.util.concurrent.TimeoutException)   com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider:426(null) 2.发送HTTP请求时出错。消息有效内容的类型为:String(org.mule.api.MessagingException)   org.mule.module.http.internal.request.DefaultHttpRequester:287(http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html

Root异常堆栈跟踪: java.util.concurrent.TimeoutException:超出超时     在com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider.timeout(GrizzlyAsyncHttpProvider.java:426)     在com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider $ 3.onTimeout(GrizzlyAsyncHttpProvider.java:274)     at org.glassfish.grizzly.utils.IdleTimeoutFilter $ DefaultWorker.doWork(IdleTimeoutFilter.java:398)     at org.glassfish.grizzly.utils.IdleTimeoutFilter $ DefaultWorker.doWork(IdleTimeoutFilter.java:377)     在org.glassfish.grizzly.utils.DelayedExecutor $ DelayedRunnable.run(DelayedExecutor.java:158)     在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)     在java.lang.Thread.run(Thread.java:745)

我的插入代码如下:

     <flow name="api-main">
   <http:listener config-ref="db-system-api-httpListenerConfig" path="/api/*" doc:name="HTTP"/>
    <apikit:router config-ref="db-system-api-config" doc:name="APIkit Router"/>
    <exception-strategy ref="db-system-api-apiKitGlobalExceptionMapping" doc:name="Reference Exception Strategy"/>
    </flow>

    <flow name="put:/contract/{id}:db-system-api-config" processingStrategy="synchronous" >
    <set-property propertyName="Content-Type" value="application/json" doc:name="Set Content Type"/>
    <logger message="#[payload]" level="INFO" doc:name="Initial Payload"/>

    <json:json-to-object-transformer returnClass="java.util.HashMap" mimeType="text/plain" doc:name="JSON to Object"/>


        <foreach collection="#[payload.entrySet()]" doc:name="For Each">
        <db:insert config-ref="Oracle_Configuration" doc:name="Database">
        <db:parameterized-query><![CDATA[INSERT INTO XX.XX_OE_HDR (ID,
                                                                               NUMBER,
                                                                                EFF_START_DATE,
                                                                                EFF_END_DATE,   
                                                                                CUST_NUMBER) 
                                                                                VALUES (xx.XX_HDR_SEQ.NEXTVAL,   
                                                                                        xx.XX_HDR_NUM_SEQ.NEXTVAL,
                                                                                       TO_DATE('2017-05-23','YYYY-MM-DD HH24:MI:SS'),
                                                                                       TO_DATE('2017-06-23','YYYY-MM-DD HH24:MI:SS'),
                                                                                        #[payload.myField])]]></db:parameterized-query>
         </db:insert>
         </foreach>
        <logger message="Record successful" level="INFO" doc:name="Log Success"/>

1 个答案:

答案 0 :(得分:0)

根据Timeout exceeded at com.ning.http.client您的问题位于http请求中。据我所知,Oracle数据库(与大多数常见数据库一样)使用TCP协议进行传输,而您的问题位于http超时。

您能提供完整的流程吗?您是如何触发流程的?

另一方面,您是否可以尝试隔离问题并将数据库替换为记录器并检查您的http请求是否没有问题? (假设您通过http请求触发此流程)