2013-08-20 59 views
0

我想在MuleStudio項目中使用Drupal連接器。但我已經測試過的所有操作(創建節點,索引節點,...),我得到了同樣的錯誤:在MuleStudio中使用Drupal連接器時出錯

ERROR 2013-08-20 11:19:00,291 [[drupal-integration].connector.http.mule.default.receiver.02] org.mule.retry.notifiers.ConnectNotifier: Failed to connect/reconnect: Work Descriptor. Root Exception was: null. Type: class org.mule.api.ConnectionException 
ERROR 2013-08-20 11:19:00,296 [[drupal-integration].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
******************************************************************************** 
Message    : Failed to invoke createNode. Message payload is of type: String 
Code     : MULE_ERROR--2 
-------------------------------------------------------------------------------- 
Exception stack is: 
1. null (org.mule.api.ConnectionException) 
org.mule.modules.drupal.client.DrupalRestClient:125 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/ConnectionException.html) 
2. Failed to invoke createNode. Message payload is of type: String (org.mule.api.MessagingException) 
org.mule.modules.drupal.processors.CreateNodeMessageProcessor:129 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) 
-------------------------------------------------------------------------------- 
Root Exception stack trace: 
org.mule.api.ConnectionException 
at org.mule.modules.drupal.client.DrupalRestClient.login(DrupalRestClient.java:125) 
at org.mule.modules.drupal.DrupalConnector.connect(DrupalConnector.java:145) 
at org.mule.modules.drupal.connectivity.DrupalConnectorConnectionFactory.makeObject(DrupalConnectorConnectionFactory.java:57) 
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) 

這是我的配置XML:

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

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:context="http://www.springframework.org/schema/context" xmlns:twitter="http://www.mulesoft.org/schema/mule/twitter" xmlns:facebook="http://www.mulesoft.org/schema/mule/facebook" xmlns:drupal="http://www.mulesoft.org/schema/mule/drupal" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 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.5.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/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd 
http://www.mulesoft.org/schema/mule/drupal http://www.mulesoft.org/schema/mule/drupal/1.0/mule-drupal.xsd 
http://www.mulesoft.org/schema/mule/facebook http://www.mulesoft.org/schema/mule/facebook/2.0/mule-facebook.xsd 
http://www.mulesoft.org/schema/mule/twitter http://www.mulesoft.org/schema/mule/twitter/2.4/mule-twitter.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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> 
<drupal:config name="Drupal" doc:name="Drupal" apiUrl="api/rest" server="localhost" port="8888" username="${drupal.username.rest}" password="${drupal.password.rest}" commentEndpoint="comment" fileEndpoint="file" nodeEndpoint="node" taxonomyTermEndpoint="taxonomy_term" userEndpoint="user" taxonomyVocabularyEndpoint="taxonomy_vocabulary"> 
    <drupal:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/> 
</drupal:config> 
<context:property-placeholder location="classpath*:mule-app.properties"/> 
<flow name="CheckIfNewContent" doc:name="CheckIfNewContent"> 
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="index" doc:name="HTTP"/> 
    <drupal:create-node config-ref="Drupal" doc:name="Drupal"> 
     <drupal:node type="article" title="mynewtestarticle"> 
      <drupal:body> 
       <drupal:und> 
        <drupal:und> 
         <value>Body content value</value> 
        </drupal:und> 
       </drupal:und> 
      </drupal:body> 
     </drupal:node> 
    </drupal:create-node> 
    <logger message="#[payload]" level="INFO" doc:name="Logger"/> 

    <json:object-to-json-transformer doc:name="Object to JSON"/> 
</flow> 

我已經成功安裝並配置了REST服務器。我正在使用新的Studio 3.5 Andes Runtime和新的連接器。

回答

2

錯誤:org.mule.modules.drupal.client.DrupalRestClient.login(DrupalRestClient.java:125)

涉及扔在下面的try/catch

try { 
    r = this.client.resource(new URI("http", null, server, port, apiUrl 
     +"/"+DrupalCollection.User.getEndpoint() +"/" + LOGIN, null, null)); 
} catch (URISyntaxException e) { 
    throw new ConnectionException(ConnectionExceptionCode.UNKNOWN, 
    null, null); 
} 

因此,有構建URI的問題。嘗試在apiUrl:/ rest/api之前添加一個前導斜槓。

「/ rest/api」也是默認值,因此您可以完全刪除apiUrl屬性。

文檔不太清楚 - 但它需要apiUrl是絕對路徑,而另一個則是相對的。

+0

哇,這的確是問題所在。 – dba