Я пытаюсь выполнить groovy скрипт в Mule Flow.
Использование версии Mule Server 3.5.1.EE.. Я уже включил groovy-all.jar в classpath
Контент Groovy прост
return "demo payload"
При выполнении я получаю ниже трассировку стека исключений
java.lang.NullPointerException
at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:108)
at org.mule.component.AbstractComponent.process(AbstractComponent.java:152)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
Дайте мне знать, если мне нужно опубликовать более подробную информацию.
Любая помощь будет оценена по достоинству.
Я не уверен, что вы получили это право, но правильное использование Groovy в потоке Mule выглядит так:
<?xml version="1.0" encoding="UTF-8"?>
<mule ...>
<flow name="lab1Flow1" doc:name="lab1Flow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA["demo payload"]]></scripting:script>
</scripting:component>
</flow>
</mule>
Если вы попробуете поток выше с завитком, он должен ответить (как и ожидалось):
$ curl -i http://localhost:8081
HTTP/1.1 200 OK
Date: Sun, 07 Dec 2014 16:52:48 +0000
Server: Mule EE Core Extensions/3.5.2
X-MULE_SESSION: ...
X-MULE_ENCODING: UTF-8
Content-Type: text/plain
Content-Length: 12
Connection: close
demo payload
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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"
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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="groovydemoFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[println('demo payload');]]></scripting:script>
</scripting:component>
</flow>
</mule>
Please try this