0

I want to use the Drupal Connector in a MuleStudio Project. But with all actions i have tested (create node, index node, ...) i get the same error:

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)

This is my Configuration 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>

I have installed and Configured the REST Server succesfully. I'am using the new Studio 3.5 Andes Runtime and the new Connectors.

4

1 回答 1

2

错误:org.mule.modules.drupal.client.DrupalRestClient.login(DrupalRestClient.java:125)

与以下 try/catch 中的 throw 相关

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 是绝对路径,而另一个是相对路径。

于 2013-08-20T13:55:17.207 回答