Ошибка при использовании Drupal Connector в MuleStudio

Я хочу использовать Drupal Connector в проекте MuleStudio. Но со всеми действиями, которые я протестировал (создать узел, индексный узел,...), я получаю ту же ошибку:

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 и новые Connectors.

1 ответ

Решение

Ошибка: 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 был абсолютным путем, а другой - относительным.

Другие вопросы по тегам