MULE连接Derby有错误

时间:2016-03-02 02:29:45

标签: mule

我创建了与DB Derby的连接,并且跟随错误返回浏览:

ERROR 2016-03-01 23:20:31,168
[[fiapacessobancodedados].HTTP_Listener_Configuration.worker.01]
org.mule.exception.DefaultMessagingExceptionStrategy:
Message               : null (java.lang.NullPointerException). Message payload is of type: NullPayload
Type                  : org.mule.api.MessagingException
Code                  : MULE_ERROR--2
JavaDoc               : 
Payload               : {NullPayload}
XML下面的

<spring:beans>
    <spring:bean id="Bean" name="Bean" class="fiapacessobancodedados.ConexaoDerby"/>
</spring:beans>
<db:derby-config name="Derby_Configuration" url="jdbc:derby://localhost:1527/SOAFiap;username=Fiap;password=Fiap" doc:name="Derby Configuration"/>
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="fiapacessobancodedadosFlow">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
    <db:insert config-ref="Derby_Configuration" doc:name="Database">
        <db:parameterized-query><![CDATA[INSERT INTO FIAP.ALUNO (CODIGO, NOME_ALUNO) 
VALUES (5, 'Igor Koba')]]></db:parameterized-query>
    </db:insert>
    <json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>

1 个答案:

答案 0 :(得分:0)

我已经修改了您的流量和连接网址,如下所示,现在它可以正常工作: -

<spring:beans>
         <spring:bean id="Derby_Data_Source" class="org.enhydra.jdbc.standard.StandardXADataSource" >
             <spring:property name="driverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
             <!--  <spring:property name="url" value="jdbc:derby:SOAFiap;create=true"/>   -->
           <spring:property name="url" value="jdbc:derby:memory:SOAFiap;create=true"/>  <!-- Create Database in memory -->
         </spring:bean>
 </spring:beans>
 <db:generic-config name="Generic_Database_Configuration" dataSource-ref="Derby_Data_Source" doc:name="Generic Database Configuration"/>
 <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>

     <flow name="DerbyDBFlow1" >
          <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>

         <db:insert config-ref="Generic_Database_Configuration" doc:name="Database">
            <db:parameterized-query><![CDATA[INSERT INTO FIAP.ALUNO (CODIGO, NOME_ALUNO) 
VALUES (5, 'Igor Koba')]]></db:parameterized-query>
          </db:insert>

         <logger message="#[message.payload]" level="INFO" doc:name="Logger"/>
     </flow>  

这对我来说很好。
您可以根据您的dbname,用户名等修改URL