I am attempting a tutorial from the book 'MULE_ESB_COOKBOOK' by packt publishing and I have posted this question in another forum too. In the first chapter, there is a 'Deploying your first Hello World application on the Mule server' exercise which I am trying out. The expected output is Hello/(The value I enter as part of the url)
However when I run the application, I am getting the following error in the browser when I enter this: http://localhost:9081. The error message is as follow: "Component that caused exception is: DefaultJavaComponent{helloworldFlow.component.1468192631}. Message payload is of type: NullPayload"
The XML file is as follow:
<?xml version="1.0" encoding="UTF-8"?>
<mule 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:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
<flow name="helloworldFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<component class="com.org.Greeting" doc:name="Java"/>
</flow>
</mule>
The Greeting.java file is as follows:
package com.org;
public class Greeting {
public String sayHi(String str)
{
return "Hello " +str;
}
}
I am not sure why I am getting this error. Hope someone can help, thanks.