在MuleStudio中使用Drupal Connector时出错

时间:2013-08-20 09:28:42

标签: drupal mule mule-studio

我想在MuleStudio项目中使用Drupal Connector。但是我已经测试了所有动作(创建节点,索引节点......),我得到了同样的错误:

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和新的连接器。

1 个答案:

答案 0 :(得分: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是绝对路径而另一个是相对的。